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 26 forks source link

Conditional select menus #306

Closed pkalita-lbl closed 2 years ago

pkalita-lbl commented 2 years ago

These changes to script/data-harmonizer/index.js and script/data-harmonizer/field_rules.js provide hooks that allow a client application to customize certain column aspects. The client passes the configuration to a DataHarmonizer instance via a new property called field_settings.

This will be useful to NMDC because it will enable our code which sets up a DataHarmonizer instance to customizer the behavior columns that represent GOLD Ecosystem Classification Levels and let them interact with each other. But I think these hooks are generic enough to be useful to other clients of DataHarmonizer as well.

Fixes #302

pkalita-lbl commented 2 years ago

@ddooley @turbomam I think this is ready for review now

ddooley commented 2 years ago

As mentioned in commit, "Field function hooks are now possible by assigning a dictionary of field names as keys in dh.field_settings{} to an object containing functions such as onChange() which are merged with the template's "field" data structure. Validation rules trigger onChange() etc. functions when value of field changes. onChange() can then trigger effects on other field picklist content etc."