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

Y24-332 - Fix typo in Sample Manifest column header #4359

Open
harrietc52 opened this issue Sep 20, 2024 · 1 comment
Open

Y24-332 - Fix typo in Sample Manifest column header #4359

harrietc52 opened this issue Sep 20, 2024 · 1 comment

Comments

@harrietc52
Copy link
Contributor

Describe the Housekeeping

Update the column header in sample manifests, from DATE OF SAMPLE COLLECTION (YYY-MM-DD) to DATE OF SAMPLE COLLECTION (YYYY-MM-DD).

This change would be across all sample manifest types
Tests would need to be performed for existing sample manifests with the old text YYY, as well as new sample manifests with the new text YYYY, to ensure they are both supported.

Additional context

(Further information from Andrew)

See config/sample_manifest_excel/columns.yml in SS

The date_of_sample_collection column is defined twice with two different header texts:

date_of_sample_collection:
  heading: DATE OF SAMPLE COLLECTION (YYYY-MM-DD)
  unlocked: true
  validation:
    options:
      type: :custom
      formula1: 'IF(OR(EXACT(A1,"not collected"),EXACT(A1,"not provided"),EXACT(A1,"restricted access")), TRUE, AND((_xlfn.NUMBERVALUE(LEFT(A1,4))>0),OR(LEN(A1)=4,EXACT(MID(A1,5,1),"-")),OR(LEN(A1)<=7,EXACT(MID(A1,8,1),"-")),AND((_xlfn.NUMBERVALUE(MID(A1,6,2))>=0),(_xlfn.NUMBERVALUE(MID(A1,6,2))<=12)),AND((_xlfn.NUMBERVALUE(MID(A1,9,2))>=0),(_xlfn.NUMBERVALUE(MID(A1,9,2))<=31))))'
      allowBlank: false
      showInputMessage: true
      promptTitle: "Sample Collection Date"
      prompt: "Date should be in the format YYYY-MM-DD, Partial dates are supported. eg. YYYY or YYY-MM. See https://ena-docs.readthedocs.io/en/latest/submit/samples/missing-values.html if you can't provide a value."
      showErrorMessage: true
      errorStyle: :stop
      errorTitle: "Sample Collection Date"
      error: "Date should be in the format YYYY-MM-DD, Partial dates are supported. eg. YYYY or YYY-MM. See https://ena-docs.readthedocs.io/en/latest/submit/samples/missing-values.html if you can't provide a value."
  conditional_formattings:
    empty_mandatory_cell:
date_of_sample_extraction:
  heading: DATE OF DNA EXTRACTION (MM/YY or YYYY only) <--- different header
  unlocked: true
  validation:
    options:
      type: :textLength
      operator: :lessThanOrEqual
      formula1: "5"
      allowBlank: false
      showInputMessage: true
      promptTitle: "Sample Collection Date"
      prompt: "Please Enter either a Month and Year or a complete Year e.g. 04/05 or 2004."
      showErrorMessage: true
      errorStyle: :stop
      errorTitle: "Sample Collection Date"
      error: "This must be either a combination of month and year, or a whole year, with no spaces."
  conditional_formattings:
    empty_cell:
    len:
      formula:
        operator: ">"
        operand: 5

I think the way it works on upload is it looks for a column definition with a matching header, and uses that definition.
So if you create 2 column definitions, one with YYY and one with YYYY, you could solve your issue that way.
NB. I have had a silent error before where 2 different columns had the exact same header text, and it used the first it found in the list (the wrong column definition). So check for uniqueness of column headers if you change this file, or if you introduce a regex that ignores things in brackets.

NB. there's a copy in the spec directory too, update that if you change anything. spec/data/sample_manifest_excel/columns.yml

@psd-issuer psd-issuer bot changed the title Fix typo in Sample Manifest column header Y24-332 - Fix typo in Sample Manifest column header Sep 20, 2024
@stevieing
Copy link
Contributor

Might be worth deciding if it is something we want to fix as it is aesthetic? If a user does enter a wrong date then it does error. I must admit I have created a few manifests and never noticed.

If we do feel it is necessary to fix then my idea would be to create an alternative_heading option in the columns yaml. We could then modify the way it finds the column headings in here https://github.com/sanger/sequencescape/blob/eadfcba871a05683e000bf8f874a75a73e8733b0/app/sequencescape_excel/sequencescape_excel/column_list.rb

This would then add the flexibility to change column headings in the future. Plus it does not look like a massive job if it is done this way.

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

No branches or pull requests

2 participants