Closed Takadonet closed 11 months ago
This would be a welcome feature. It suggests that one could have a bit of a conditional language in addition to just marking a field as required or recommended. E.g. "required if [field x] value is [value y]".
Is there any movement on this feature request? If not, we will implement some backend validation.
LinkML now has a rule language that enables this functionality so next steps are for the DH project to get that implemented to some extent in https://github.com/cidgoh/DataHarmonizer/issues/370 . We have hired a developer that will be able to take on DH development but have him dedicated on another task for one month. I'll try to scope out the task of implementing portions of the rule language in the next week; perhaps this is something we can collaborate on.
A first move would be if you could see what the rules you need look like in one of your LinkML schemas, so we can test against that as a priority? The LinkML specs for rules: https://linkml.io/linkml/schemas/advanced.html#rules
By the way, is your DH/LinkML incoming data in JSON format? If so, LinkML's generated JSON-Schema will apparently have the LinkML rules compiled into JSON schema rules, and that is a way to validate such things. Stated here: https://linkml.io/linkml/generators/json-schema.html#rules
It will at the layer where we hit valid button. Our hosted version does not allow end user to submit data if it is not valid.
To my understanding then it will need to be implemented in DH layer in the template (schema_*) files.
For sure the rules should be expressed in schema.yaml , then when DH loads them, javascript will enable Validate (button) to detect / report required but empty fields. But that aside, LinkML comand line tool ability to output json schema could then be used via jason schema validator to check for required fields, and conditionally required fields, as far as I can tell, via if-then-else https://json-schema.org/understanding-json-schema/reference/conditionals.html but I'll have to verify that LinkML rules flow through to this json schema expressivity.
Sounds good. Our hope is to reduce lots of manually checking with scripts/humans.
@Takadonet We'll address this functionality in newer https://github.com/cidgoh/DataHarmonizer/issues/370 so will close it here.
Is it possible that a column B is default optional but is mandatory after Column A has a certain value.
Example: Column Sequenced : Value : ['yes','no','failed']
Column Reason_Failed: Value: Free form text ; Mandatory only when value 'failed' is given to Column Sequenced.