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

Add attributes to existing sample types #1708

Draft
wants to merge 46 commits into
base: main
Choose a base branch
from

Conversation

kdp-cloud
Copy link
Collaborator

  • Add policies and sharing permissions to sample types
  • Making existing sample types more editable
  • Simplifying assays and studies creation forms.

@kdp-cloud kdp-cloud force-pushed the add_attributes_to_existing_sample_types branch from e20ec0d to 2f34db2 Compare February 13, 2024 14:21
@kdp-cloud kdp-cloud marked this pull request as ready for review February 13, 2024 14:52
Copy link
Member

@stuzart stuzart left a comment

Choose a reason for hiding this comment

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

A partial review, to get started with.

@@ -65,6 +73,10 @@ def update

private

def update_sample_json_metadata
UpdateSampleMetadataJob.new(@isa_assay.assay.sample_type).perform_now
Copy link
Member

Choose a reason for hiding this comment

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

This will run immediately and not trigger a job. should be:

UpdateSampleMetadataJob.perform_later(@isa_assay.assay.sample_type)

also it's an expensive job that will be triggered whenever the :update is called, regardless of whether the sample attributes change

Comment on lines +88 to +90
@isa_study.study.sample_types.map do |st|
UpdateSampleMetadataJob.new(st).perform_now
end
Copy link
Member

Choose a reason for hiding this comment

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

again, should be perform_later and will be triggered for each sample type during the :update regardless of whether they have changed


private

def update_sample_json_metadata
# UpdateSampleMetadataJob.new(@sample_type).queue_job
UpdateSampleMetadataJob.new(@sample_type).perform_now
Copy link
Member

Choose a reason for hiding this comment

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

should be UpdateSampleMetadataJob.perform_later(@sample_type) and only triggered when neccessary

Copy link
Member

Choose a reason for hiding this comment

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

since this is quite common across several controllers, I'm wondering if it should go in a module and include checks for whether sample type attributes have changed in a particular way

queue_with_priority 1
queue_as QueueNames::SAMPLES
def perform(sample_type)
Seek::Samples::MetadataUpdater.new(sample_type).update_metadata
Copy link
Member

Choose a reason for hiding this comment

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

this is going to need some profiling and scalability testing with a sample type linked to large set of samples. I'll get some metrics from fairdomhub about what is a our current maximum

<%= form_submit_buttons(resource, { validate:false, update_sample_types: true }) %>
Copy link
Member

Choose a reason for hiding this comment

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

I don't see where update_sample_types param is used, and shouldn't be set to true in all cases

@@ -18,6 +18,7 @@
</div>

<%= render partial: "projects/project_selector", locals: { resource: @sample_type } -%>
<%= render partial: 'assets/manage_specific_attributes', locals:{f:f} if show_form_manage_specific_attributes? %>
Copy link
Member

Choose a reason for hiding this comment

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

for consistency, should use assets/asset_form_bottom with the relevant options passed

@@ -51,13 +50,11 @@
display_isa_tag: false } %>
<% end %>

<% unless @sample_type.uploaded_template? || !@sample_type.editing_constraints.allow_new_attribute? %>
Copy link
Member

Choose a reason for hiding this comment

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

check for @sample_type.uploaded_template? should remain for now, but might be revisited as part of #1766

@@ -1715,7 +1715,9 @@
t.text "description"
t.integer "isa_tag_id"
t.boolean "allow_cv_free_text", default: false
t.integer "template_attribute_id"
Copy link
Member

Choose a reason for hiding this comment

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

not part of the migration, looks like contamination from switching branches

t.index ["sample_type_id"], name: "index_sample_attributes_on_sample_type_id"
t.index ["template_attribute_id"], name: "index_sample_attributes_on_template_attribute_id"
Copy link
Member

Choose a reason for hiding this comment

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

not part of the migration, looks like contamination from switching branches

Comment on lines +2119 to 2121
t.integer "parent_attribute_id"
t.index ["parent_attribute_id"], name: "index_template_attributes_on_parent_attribute_id"
t.index ["template_id", "title"], name: "index_template_id_asset_id_title"
Copy link
Member

Choose a reason for hiding this comment

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

not part of the migration, looks like contamination from switching branches

@stuzart stuzart modified the milestones: v1.15.0, 1.15.1 Mar 19, 2024
@kdp-cloud kdp-cloud modified the milestones: 1.15.1, 1.16.0 May 8, 2024
@stuzart stuzart removed this from In progress in SEEK 1.15.x May 15, 2024
@kdp-cloud kdp-cloud marked this pull request as draft May 24, 2024 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment