fhir-data-pipes icon indicating copy to clipboard operation
fhir-data-pipes copied to clipboard

Unable to Query Extensions Values

Open kreddys opened this issue 8 months ago • 2 comments
trafficstars

Description

When attempting to query FHIR extensions using ViewDefinition, the expected results are not returned. However, the same FHIRPath works correctly in FHIRPath.js.

Steps to Reproduce

  1. Use the following Patient resource sample:
{
    "resourceType": "Patient",
    "id": "1238",
    "extension": [
        {
            "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity",
            "extension": [
                {
                    "url": "ombCategory",
                    "valueCoding": {
                        "system": "urn:oid:2.16.840.1.113883.6.238",
                        "code": "2186-5",
                        "display": "Not Hispanic or Latino"
                    }
                },
                {
                    "url": "text",
                    "valueString": "Not Hispanic or Latino"
                }
            ]
        }
    ]
}
  1. Use the following ViewDefinition query:
{
  "resourceType": "http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition",
  "text": "Minimal ViewDefinition for testing extensions",
  "fhirVersion": ["4.0"],
  "select": [
    {
      "column": [
        {
          "path": "getResourceKey()",
          "name": "id"
        },
        {
          "path": "extension.where(url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity').extension.where(url = 'ombCategory').valueCoding.display",
          "name": "extension_debug"
        }
      ]
    }
  ],
  "name": "patient_minimal",
  "status": "draft",
  "resource": "Patient"
}
  1. Test in views tab (or) Run Full Pipeline:

Expected Outcome

  • The FHIRPath should correctly return Not Hispanic or Latino.
  • This works in FHIRPath.js, but not in fhir-data-pipes.

Actual Outcome

  • The FHIRPath returns null for extension_debug column

Request for Assistance

Please help determine if this is an issue with fhir-data-pipes ViewDefinition processing or if there is a mistake in the query format.

kreddys avatar Feb 23 '25 18:02 kreddys

It is working with this pattern. closing the issuue

        {
          "path": "extension.where(url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity').extension.where(url = 'ombCategory').(value as Coding).display",
          "name": "extension_debug"
        }

kreddys avatar Mar 04 '25 10:03 kreddys

Thanks for reporting this issue and the update. I have not got to this yet and like to see why the first pattern doesn't work if it is expected to; so reopening.

bashir2 avatar Mar 04 '25 15:03 bashir2