bluehalo/graphql-fhir

New extension to an existing resource

shanilsasikumar opened this issue · 2 comments

Can you please guide us on how can we add a new custom extension to an existing resource

Example: like "gender" for a Practitioner resource. I need to add "custom" extension to a resource.

Hi @shanilsasikumar,

Sorry for the delayed response. Currently extensions are supported as long as it used in the extension or modifierExtension properties.

For example, I took the US Core patient from https://www.hl7.org/fhir/us/core/Patient-example.json.html which has nested custom extensions, you could return this in your resolver, and with a query that looks something like this:

{
  Patient(identifier:"example"){
    id
    extension{
      extension{
        url
        valueCoding{
          system
          code
          display
        }
      }
    }
  }
}

You would get these results (truncated the results to keep them short):

{
  "data": {
    "Patient": {
      "id": "example",
      "extension": [
        {
          "extension": [
            {
              "url": "ombCategory",
              "valueCoding": {
                "system": "urn:oid:2.16.840.1.113883.6.238",
                "code": "2106-3",
                "display": "White"
              }
            },
            {
              "url": "ombCategory",
              "valueCoding": {
                "system": "urn:oid:2.16.840.1.113883.6.238",
                "code": "1002-5",
                "display": "American Indian or Alaska Native"
              }
            },
            {
              "url": "ombCategory",
              "valueCoding": {
                "system": "urn:oid:2.16.840.1.113883.6.238",
                "code": "2028-9",
                "display": "Asian"
              }
            },
            {
              "url": "detailed",
              "valueCoding": {
                "system": "urn:oid:2.16.840.1.113883.6.238",
                "code": "1586-7",
                "display": "Shoshone"
              }
            },
            {
              "url": "detailed",
              "valueCoding": {
                "system": "urn:oid:2.16.840.1.113883.6.238",
                "code": "2036-2",
                "display": "Filipino"
              }
            }
          ]
        }
      ]
    }
  }
}

Are you looking to allow extensions to be used or to validate them?

Closing due to inactivity, feel free to re open if you still have questions.