Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch sample import activities #971

Merged
merged 14 commits into from
Mar 7, 2025
Merged

Conversation

JeffreyThiessen
Copy link
Member

@JeffreyThiessen JeffreyThiessen commented Mar 5, 2025

What does this PR do and why?

Describe in detail what your merge request does and why.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other pull requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. seed your db
  2. Start irida next with command line enabled
  3. Sign into User3
  4. navigate to http://localhost:3000/borrelia/borrelia-burgdorferi/outbreak-2024/-/samples
  5. in the file test/fixtures/files/batch_sample_import_with_metadata_valid.csv, edit the project_puid values to match the project we are importing to.
  6. run the following in the terminal to import new samples.
u = User.all[3];n = Project.all[0].namespace;

# replace this path with the path to your irida next git directory
filepath = '/home/CSCScience.ca/jthiessen/git/irida-next-core/test/fixtures/files/batch_sample_import_with_metadata_valid.csv'

blob = ActiveStorage::Blob.create_and_upload!(io: File.open(filepath), filename: 'batch_sample_import_with_metadata_valid.csv')

s = Samples::BatchFileImportService.new(n,u, blob.id, {sample_name_column: 'sample_name', project_puid_column: 'project_puid', sample_description_column: "description"} )

s.execute
  1. You should see 2 new samples added to the project you are viewing. Verify that activities were made for this project.

Then repeat the above but with a group for the namespace, and verify that activities were made for both the project and the group samples were added to.

PR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

@JeffreyThiessen JeffreyThiessen marked this pull request as ready for review March 5, 2025 22:01

This comment has been minimized.

Copy link
Contributor

@deepsidhu85 deepsidhu85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Just one comment about changing the key name which will require you to update wherever the key is used.

@JeffreyThiessen JeffreyThiessen force-pushed the batch_sample_import_activities branch from 0231518 to a6f7858 Compare March 7, 2025 16:36

This comment has been minimized.

Copy link
Contributor

@deepsidhu85 deepsidhu85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more changes but looking good

Copy link
Contributor

@deepsidhu85 deepsidhu85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@deepsidhu85 deepsidhu85 merged commit 236f2f9 into main Mar 7, 2025
4 checks passed
@deepsidhu85 deepsidhu85 deleted the batch_sample_import_activities branch March 7, 2025 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants