Closed pnrobinson closed 1 year ago
The HpoPhenotypeValidators.Primary.phenopacketHpoPhenotypeValidator(hpo)
and HpoPhenotypeValidators.Ancestry.phenopacketHpoAncestryValidator(hpo)
do almost all of that.
HpoPhenotypeValidators.Primary.phenopacketHpoPhenotypeValidator(hpo)
HpoPhenotypeValidators.Ancestry.phenopacketHpoAncestryValidator(hpo)
On top of the above checks, the Ancestry
validator checks if a negated term is used together with its negated parent, and suggests using the least specific term.
With regards to the ancestry checks, the term and parents are allowed only if the parent term is present and the child term is negated (e.g. Abnormality of finger but NOT Arachnodactyly).
The last item of the list above is not yet implemented:
Perhaps in the next minor release?
@ielis This seems pretty easy
PhenopacketHpoCoverageValidator (Ontology hpo, Set<TermId> requiredTopLevelTerms) {
}
validate() {
// create map<TermId,Boolean> covered....
for PhenotypicFeature feature : component.getPhenotypicFeaturesList() {
TermId tid = feature.getTermId()
for (TermId topLevelTid : covered.keySet()) {
if (OntologyAlgorithm.isAncestor(topLevelTid, tid)) {
covered.put(topLevelTid, True);
}
}
// check if any term in covered is False and if so emit a warning
}
Should we just add a class like this as another example?
@pnrobinson I wrote the validator, it is at #117 . Can you please check if this is what you had in mind?
Done
Somehow some classes got refactored that performed ontology based validation. These classes would do things that are not easy to do with JSON Schema, such as