Hello all,
I encounter an error when trying to validate a code in a derived profile, and I’m not sure whether this is related to the profile definition itself, or my (HAPI-based) implementation. I have two profiles on Condition, “ParentCondition” and “ChildCondition”. “ChildCondition” derives from “ParentCondition”, “derivation” is set to “constraint” in the StructureDefinition. “ParentCondition” restricts the “code” element as follows:
{
"id": "Condition.code.coding:sct",
"path": "Condition.code.coding",
"sliceName": "sct",
"max": "1",
"patternCoding": {
"system": "http://snomed.info/sct"
},
"mustSupport": true,
"binding": {
"strength": "required",
"valueSet": "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/ValueSet/diagnoses-sct"
}
}
The referenced ValueSet contains 3 codes, we see that a “required” binding is applied.
Now “ChildCondition” overwrites the “code” element definition as follows:
"patternCoding": {
"system": "http://snomed.info/sct",
"code": "840539006"
},
"condition": [
"ele-1"
],
"constraint": [
{
"key": "ele-1",
"severity": "error",
"human": "All FHIR elements must have a @value or children",
"expression": "hasValue() or (children().count() > id.count())",
"xpath": "@value|f:*|h:div",
"source": "http://hl7.org/fhir/StructureDefinition/Element"
}
],
"mustSupport": true,
"isSummary": true,
"binding": {
"strength": "required",
"valueSet": "https://www.medizininformatik-initiative.de/fhir/core/modul-diagnose/ValueSet/diagnoses-sct"
},
The code pattern “840539006” is NOT defined in the ValueSet referenced by “ParentCondition”. When attempting to POST a Condition that uses code “840539006” I get a “code is not defined in ValueSet” error, which is what I expect.
Is this expected behavior, i.e. is the “ChildCondition” profile definition wrong? Or is the implementation at fault here? As a side note, the Condition resource is accepted if I remove the ValueSet from the terminology validator (which also kinda makes sense to me). Any insights on this are appreciated.
BR Mike