onc-healthit / inferno-program

Archived source code for the Inferno Testing Tool and the Program Edition set of tests. No longer maintained.
https://inferno.healthit.gov/
Apache License 2.0
38 stars 12 forks source link

Extension Reference Type Validation for Reference(resource) Types (FI-1379) #411

Closed weiyuzh closed 2 years ago

weiyuzh commented 2 years ago

Thank you for reporting a possible bug in Inferno! Please fill in as much of the template below as you can.

Subject of the issue

When validating extensions of type reference, Inferno checks for the target resource type to ensure that it is allowed by the structure definition. For valueReferences that can target any resource (i.e. of type Reference(resource)), Inferno currently flags all target types as invalid/respond with an error of The type '<insert resource here>' is not a valid Target for this element (must be one of []).

This seems to be an issue w/ the underlying Inferno validator wrapper v1.2.0/FHIR validator v5.2.0, and is fixed in Inferno validator wrapper v1.3.0 and later (w/ the underlying FHIR validator upgrade to 5.3.11).

chat.fhir discussion

Your environment

Steps to reproduce

Sample Observation resource currently failing validation:

{ "resourceType": "Observation", "id": "frOgLtXofzBjEb4a-qvVgUuIGqdNGPXllpagKrLRSVbA4", "extension": [ { "valueReference": { "reference": "DocumentReference/eXhoWyVAhNGFlK.MzFqhY4yvaRWENTinvQ2labjUbYzo3", "type": "DocumentReference" }, "url": "http://hl7.org/fhir/StructureDefinition/workflow-supportingInfo" } ], "status": "amended", "category": [ { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/observation-category", "code": "vital-signs", "display": "Vital Signs" } ], "text": "Vital Signs" } ], "code": { "coding": [ { "system": "urn:oid:1.2.840.114350.1.13.5325.1.7.2.707679", "code": "3956", "display": "FLOQA Custom List Single" }, { "system": "http://open.epic.com/FHIR/StructureDefinition/observation-flowsheet-id", "code": "tynLo.0WfFHWq04l3MeeKTA0", "display": "FLOQA Custom List Single" }, { "system": "http://loinc.org", "code": "8716-3", "display": "Vital signs" } ], "text": "FLOQA Custom List Single" }, "subject": { "reference": "Patient/eF0WY7G7VBngiOFTO6GcAzQ3", "display": "Eagle, Alpha" }, "encounter": { "reference": "Encounter/epN3XnWiuATBBEqN4jAm8tv5GfKQNlLGv6DjqNRttJoE3", "display": "Hospital Encounter" }, "effectiveDateTime": "2021-07-29T18:35:00Z", "issued": "2021-07-29T18:49:14Z", "performer": [ { "reference": "Practitioner/e6jl9CLufoiIZ6oI-7j131A3", "display": "Liz Eagle, MD" } ], "valueCodeableConcept": { "coding": [ { "code": "V", "display": "Violet - Violet wants to be UV so badly, but isn't quite there" } ], "text": "Violet - Violet wants to be UV so badly, but isn't quite there" }, "interpretation": [ { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation", "code": "A", "display": "Abnormal" } ] } ] }

Expected behavior

This following extension should pass validation as the structure definition allows for the value to reference any FHIR resource type.

{ "valueReference": { "reference": "DocumentReference/eXhoWyVAhNGFlK.MzFqhY4yvaRWENTinvQ2labjUbYzo3", "type": "DocumentReference" }, "url": "http://hl7.org/fhir/StructureDefinition/workflow-supportingInfo" }

Actual behavior

Currently, all Observations containing the above extension (with a target type) will fail with the following message:

image

yunwwang commented 2 years ago

I confirmed this is a validator issue for FHIR validator v5.2.1. The error reported by validator is

Error @ Observation.extension[0].value.ofType(Reference) (line 6, col88) :
The type 'DocumentReference' is not a valid Target for this element (must be one of [])

Inferno should check and suppress that validator error if necessary

yunwwang commented 2 years ago

HL7 validator fixed this issue on v5.3.8

yunwwang commented 2 years ago

@weiyuzh Inferno Program v1.8.2 is release. Could you check if your issue has been addressed in this release? Thank you.

weiyuzh commented 2 years ago

Confirmed, this issue has been fixed after updating to v1.8.2. Thanks for addressing this so quickly!