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

update manifest conditional format by asset type #4752

Closed
wants to merge 5 commits into from

Conversation

sabrine33
Copy link
Contributor

No description provided.

@sabrine33 sabrine33 linked an issue Mar 18, 2025 that may be closed by this pull request
SequencescapeExcel::ConditionalFormatting.new(
name: 'empty_mandatory_cell',
options: {
'type' => :cellIs,
Copy link
Contributor

Choose a reason for hiding this comment

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

What is cellIs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not really sure actually, I basically copy past the object as they are defined in the conditional_format yml file

# SampleManifest::Generator
class SampleManifest::ColumnConditionalFormatUpdater
# Predefined conditional formats for required fields.
REQUIRED_COLUMNS_CONDITIONAL_FORMATS = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Messaged re an alternative/ additional way of doing this :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Messaged re an alternative/ additional way of doing this :)

The proposed solution is to modify the columns.yml config file. This will result in modifying the column format for all templates where the columns in question are present. Here, the column background is set to red, which may cause confusion, as the columns may be present without necessarily having the "not empty" constraint. For example, in the multiplex library manifest types, the library_type column is present but not required to be filled in.

Copy link
Contributor

Choose a reason for hiding this comment

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

Where is the code that makes library_type required for one manifest type but not the other?

I would prefer a different approach, as this adds a new place where columns are configured - it's all quite neat at the moment, in columns.yml.

Can't find the words to explain this properly, but I also don't think that 'by asset type' will turn out to be a common thing to control the requiredness.

Another thing we can do is, if we want a column to behave differently in one manifest type vs another, we make a new column definition for it - e.g. see collected_by_for_cardinal, collected_by_for_controls and collected_by_for_scrna_core, which all save to the 'collected_by' column, but have different configuration, to be used in different manifest types.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Where is the code that makes library_type required for one manifest type but not the other?

It is happening here:

 def update_column_formatting_by_asset_type
    if library_asset?
      update_columns_formatting(%w[library_type insert_size_from insert_size_to], REQUIRED_COLUMNS_CONDITIONAL_FORMATS)
    else
      @columns
    end
  end

I would prefer a different approach, as this adds a new place where columns are configured - it's all quite neat at the moment, in columns.yml.

Can't find the words to explain this properly, but I also don't think that 'by asset type' will turn out to be a common thing to control the requiredness.

Another thing we can do is, if we want a column to behave differently in one manifest type vs another, we make a new column definition for it - e.g. see collected_by_for_cardinal, collected_by_for_controls and collected_by_for_scrna_core, which all save to the 'collected_by' column, but have different configuration, to be used in different manifest types.

Thank you for pointing to right direct, this is seems to put a simpler approach!

@sabrine33 sabrine33 requested a review from harrietc52 March 19, 2025 10:58
Copy link

codecov bot commented Mar 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.38%. Comparing base (0dd9e8c) to head (bcc60e3).
Report is 62 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4752      +/-   ##
===========================================
+ Coverage    89.35%   89.38%   +0.03%     
===========================================
  Files         1410     1411       +1     
  Lines        30355    30425      +70     
===========================================
+ Hits         27123    27195      +72     
+ Misses        3232     3230       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@harrietc52 harrietc52 left a comment

Choose a reason for hiding this comment

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

Sorry it's taken me a while to get back to this.
I’m just wondering whether there is a way to split up the app/models/sample_manifest/column_conditional_format_updater.rb file to make it as general as the name suggests, as it is currently quite specific to the library/asset code.
Maybe the library/ asset specific code could be passed in as a sort of validation, and then this file could be reused and generic, as I think its a good layer of abstract to have between the column config not being coupled with every manifest. I’m sure there is a design pattern for this which I’ll try dig out!
Equally, this works so ok if you would like to keep it as is thats fine. Maybe worth seeing what other members of the team say in code reviews. I’m happy to try help design it out if we decide to go down that route

@sabrine33
Copy link
Contributor Author

Sorry it's taken me a while to get back to this. I’m just wondering whether there is a way to split up the app/models/sample_manifest/column_conditional_format_updater.rb file to make it as general as the name suggests, as it is currently quite specific to the library/asset code. Maybe the library/ asset specific code could be passed in as a sort of validation, and then this file could be reused and generic, as I think its a good layer of abstract to have between the column config not being coupled with every manifest. I’m sure there is a design pattern for this which I’ll try dig out! Equally, this works so ok if you would like to keep it as is thats fine. Maybe worth seeing what other members of the team say in code reviews. I’m happy to try help design it out if we decide to go down that route

No worries at all! I see what you mean about making column_conditional_format_updater.rb more generic. asset_type is indeed more generic than the manifest, as different manifests can share the same asset type.

I agree that decoupling the column formatting logic from the manifest could be beneficial, though currently, we rely on the manifest type to generate the spreadsheet and apply formatting. I’ve kept the class general and extensible to accommodate similar future requirements, but for now, it only checks for asset_type = library.

Copy link
Contributor

@KatyTaylor KatyTaylor left a comment

Choose a reason for hiding this comment

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

Hey, haven't reviewed the code fully but I have a concern about the approach - see other comment. Thanks.

# SampleManifest::Generator
class SampleManifest::ColumnConditionalFormatUpdater
# Predefined conditional formats for required fields.
REQUIRED_COLUMNS_CONDITIONAL_FORMATS = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is the code that makes library_type required for one manifest type but not the other?

I would prefer a different approach, as this adds a new place where columns are configured - it's all quite neat at the moment, in columns.yml.

Can't find the words to explain this properly, but I also don't think that 'by asset type' will turn out to be a common thing to control the requiredness.

Another thing we can do is, if we want a column to behave differently in one manifest type vs another, we make a new column definition for it - e.g. see collected_by_for_cardinal, collected_by_for_controls and collected_by_for_scrna_core, which all save to the 'collected_by' column, but have different configuration, to be used in different manifest types.

@sabrine33
Copy link
Contributor Author

Hey, haven't reviewed the code fully but I have a concern about the approach - see other comment. Thanks.

Thank you for the pointing out to the right direction - it makes more sense and it is more straightforward !

@sabrine33 sabrine33 closed this Mar 31, 2025
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.

Y24-454 - Update required fields in library manifests
4 participants