Add JSON schemas documenting the v5.4 table- and field-level metadata#794
Add JSON schemas documenting the v5.4 table- and field-level metadata#794PouyanJay wants to merge 2 commits into
Conversation
014ac8b to
45f1416
Compare
|
@PouyanJay Thanks for your contribution. Could you describe your use case for this PR? To my knowledge, these metadata tables were only intended to be used as input files this CommonDataModel and the DataQualityDashboard package. Would be great to learn about other tooling using these files. |
|
@MaximMoinat Thanks for taking a look! Some angles to the use case:
|
Adds machine-readable JSON Schemas (draft-04) documenting the metadata columns of OMOP_CDMv5.4_Table_Level.csv and OMOP_CDMv5.4_Field_Level.csv, as requested in discussion OHDSI#746. Each schema describes one CSV row represented as a JSON object; the README documents the representation rules and observed cross-field invariants.
Adds a standalone R script (extras/) and a GitHub Actions workflow that validate every metadata CSV row against the schemas in inst/schema/. Neither is part of the R package; no DESCRIPTION changes. The workflow reports the known-malformed cdm_source row (OHDSI#744/OHDSI#775, fixed by OHDSI#792) as a warning rather than a failure until that fix merges.
45f1416 to
efccb37
Compare
Summary
Adds machine-readable JSON Schemas (draft-04) documenting the metadata columns of:
inst/csv/OMOP_CDMv5.4_Table_Level.csvinst/csv/OMOP_CDMv5.4_Field_Level.csvThis addresses the request in discussion #746 for formal definitions of metadata fields such as
conceptPrefixandmeasurePersonCompletenessThreshold.Representation
Each schema describes one CSV row represented as a JSON object (documented in
inst/schema/README.md):unique DQ identifiers.NAstays the string"NA"(notnull).Column descriptions are sourced from this repository's code and the DataQualityDashboard check documentation (
measurePersonCompleteness,fkDomain,fkClasslink to their DQD vignettes). Columns with no current code consumer (conceptPrefix,validation,unique DQ identifiers) are described honestly and marked as pending maintainer confirmation rather than given invented semantics. Cross-field relationships that hold empirically (e.g.isForeignKey = "Yes"⇔fkTableName/fkFieldNameset) are documented in the README as observed invariants but deliberately not enforced by the schemas.Files added
inst/schema/OMOP_CDMv5.4_Table_Level.schema.jsoninst/schema/OMOP_CDMv5.4_Field_Level.schema.jsoninst/schema/README.mdextras/validateMetadataSchemas.R— optional standalone validation script (not part of the package; noDESCRIPTIONchanges).github/workflows/validate-metadata.yml— optional CI validation that runs only when the v5.4 metadata CSVs or schemas changeThe last two commits are separable — if you'd prefer schemas-only, I can drop the tooling commit.
Validation
cdm_source.source_documentation_reference(line 355), the known malformed row from Fix CSV file formatting #744/Missing quotes around text block in CDM definition (CSV file for v5.4) result in incorrect number of items for that row. #775 fixed by fix: wrap comma-containing field in quotes in v5.4 Field_Level CSV (Fixes #775, #744) #792 — the CI workflow reports it as a known-issue warning (not a failure) until that fix merges, then the allowlist entry can be removedScope
No changes to the CDM structure, DDLs, or existing metadata CSV content.
Related discussion
#746