cidgoh / DataHarmonizer

A standardized browser-based spreadsheet editor and validator that can be run offline and locally, and which includes templates for SARS-CoV-2 and Monkeypox sampling data. This project, created by the Centre for Infectious Disease Genomics and One Health (CIDGOH), at Simon Fraser University, is now an open-source collaboration with contributions from the National Microbiome Data Collaborative (NMDC), the LinkML development team, and others.
MIT License
94 stars 27 forks source link

implement a function to check valid date range #214

Closed wwhsiao closed 3 years ago

wwhsiao commented 3 years ago

sample collection dates and other date fields may require a valid date range. Enabling a template to specify a valid date range and an application function to check if the dates entered meet the date range specification.

griffie commented 3 years ago

Can we circle back to this? We need a mechanism to ensure no sample collection dates are before 2019-01-01. Can we also enforce that no collection date should be in the future i.e. beyond the date the data is entered into the template? Is that possible? And can we apply this to both the CanCOGeN template and the PHA4GE template?

Thanks!

ddooley commented 3 years ago

I think we could have the template specification min and max fields also take on min and max dates which can be applied to date fields.

ddooley commented 3 years ago

As well, for any date or number field, we could have it that a mention of another field name in the min or max field spec would cause validation to look at that other field's value to validate that given field is greater or less than another field.

ddooley commented 3 years ago

So I have implemented this with DataHarmonizer "min value" and "max value" google fields (xs:minInclusive and xs:maxInclusive" in data.js), but didn't go so far as to have field name recognition. Just pop a minimum or maximum date in that field, and with a vocabulary update, that validation will occur.