Open cmungall opened 1 month ago
The top-level JSON Schema document phenopacket-schema.json
used by phenopacket-tools
is in this folder under v2
subfolder. It is indeed a little hard to find.
I think validation of Phenopacket Schema elements such as phenopacket, family or cohort needs to have multiple tiers. The lowest tier can be implemented with JSON Schema to check types, absence of random fields, correct cardinalities, etc.
The upper level tiers should e.g. check presence of a Metadata | Resource
element for all used OntologyClass
es, using current term IDs for an ontology version (easiest to implement for HPO for me), or more exotic requirements, such as not using term (e.g. Clonic seizure) and its ancestor (e.g. Seizure) in a single phenopacket.
I think it may be hard to implement all these just using JSON Schema, Pydantic, or LinkML. So, we should have an API somewhere and a bunch of out-of-the-shelf validators. I would favor writing these in Python.
Nevertheless, right now we check the validity mostly manually in the code and we manually run phenopacket-tools
afterwards. It would probably be good to automatize this.
I was confused as to why https://github.com/monarch-initiative/phenopacket-store/issues/97 was necessary
As I understand the following java repo does validation using json-schema https://github.com/phenopackets/phenopacket-tools
(I wasn't able to find the json-schema)
I had assumed that pyphetools used the same schema, but it looks like the only validation is procedural, not complete schema validation.
Shouldn't pyphetools do schema validation (using any of jsonschema, pydantic, linkml, ...)