google / fhir-data-pipes

A collection of tools for extracting FHIR resources and analytics services on top of that data.
https://google.github.io/fhir-data-pipes/
Apache License 2.0
156 stars 89 forks source link

Provide Support for non-local references linked via the `contentReference` tag in the StructureDefinition files #961

Open chandrashekar-s opened 9 months ago

chandrashekar-s commented 9 months ago

The Observation resource particularly for one of the US Core profile definition like US Core Observation Occupation Profile has the StructureDefinition defined with a contentReference tag for the parameter Observation.component.referenceRange as shown below.

{
  "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-occupation",
  "title": "US Core Observation Occupation Profile",
  "type": "Observation",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Observation",
  "snapshot": {
    "element": [
      {
        "id": "Observation.component.referenceRange",
        "path": "Observation.component.referenceRange",
        "short": "Provides guide for interpretation of component result",
        "definition": "Guidance on how to interpret the value by comparison to a normal or recommended range.",
        "contentReference": "http://hl7.org/fhir/StructureDefinition/Observation#Observation.referenceRange"
      }
    ]
  }
}

Since the contentReference is referring to a non-local reference i.e. http://hl7.org/fhir/StructureDefinition/Observation#Observation.referenceRange has something that is not starting with # tag the code is failing at this point for the US Core Observation Occupation Profile.

In the US Core profiles, I have encountered this for Observation profile so far and not others. This has to be fixed if we want to completely support at least US Core Profile definitions.

chandrashekar-s commented 8 months ago

As part of the PR #924, a partial solution has been provided for now i.e. search for the reference locally and use it if found, otherwise fail (this works for the US Core profiles).