Hello,
I’m not sure why I’m getting this error:
SingleValidationMessage[
col=-1,
row=-1,
locationString=Observation,
message=[error] in /*:Observation[namespace-uri()='http://hl7.org/fhir'][1] @ Observation obs-7: If code is the same as a component code then the value element associated with the code SHALL NOT be present Test=not(exists(f:*[starts-with(local-name(.), 'value')])) or not(count(for $coding in f:code/f:coding return parent::*/f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value and
f:system/@value=$coding/f:system/@value])=0),
severity=error
]
for a JSON such as this:
{
"identifier": {
"system": "urn:oid:1.2.3.4",
"value": "1234"
},
"entry": [
{
"resource": {
"valueCodeableConcept": {
"coding": [
{
"system": "urn:oid:2.16.840.1",
"code": "258219007",
"display": "Stage 2 (qualifier value)"
}
]
},
"identifier": [
{
"system": "urn:oid:1.2.3.4",
"type": {
"coding": [
{
"system": "http://example.com",
"code": "Document"
}
]
},
"value": "1234"
}
],
"code": {
"coding": [
{
"code": "397137005",
"system": "urn:oid:2.16.840.1",
"display": "Mammography assessment finding (finding)"
}
]
},
"effectiveDateTime": "2020-07-07T14:53:05-04:00",
"subject": {
"reference": "Patient/pt1"
},
"context": {
"reference": "Encounter/en1"
},
"id": "ob1",
"category": [
{
"coding": [
{
"code": "imaging",
"system": "http://hl7.org/fhir/observation-category",
"display": "Imaging"
}
]
}
],
"resourceType": "Observation",
"status": "final"
},
"fullUrl": "ob1"
}
],
"meta": {
"versionId": "v78979"
},
"id": "bu1",
"type": "collection",
"resourceType": "Bundle"
}
I’m using HAPI version 4.2.0 and FHIR STU3.
These are the FHIR specifications given for this error:
obs-7 : If code is the same as a component code then the value element associated with the code SHALL NOT be present (expression: value.empty() or component.code.where( (coding.code = %resource.code.coding.code) and (coding.system = %resource.code.coding.system)).empty())
If I understand that correctly, this should only ever be relevant if there is a component
element in an Observation resource. Since my bundle only contains one Observation resource, I assume that the error refers to that resource, even though the error message from the ValidationResult object seems to locate the error at column -1 and row -1. However, my Observation resource does not have a component
element, so I don’t see why the presence of the valueCodeableConcept
should be a problem according the constraint.
Am I missing something? Is there possibly a bug in the validation code?
Thank you!