FHIR Chat · Extension format · implementers

Stream: implementers

Topic: Extension format


view this post on Zulip Lentic Li (Sep 24 2018 at 21:53):

Hi I am new to FHIR and only have limited coding background. If I am make wrong comment please correct me. Thanks.

For the phone number extension, can we use the format with "_telecom" like below:
"telecom": [
{
"system": "phone",
"value": "(777)456-4566",
"use": "work",
"period": {
"start": "20180313"
}
}
],
"_telecom": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/contactpoint-extension",
"valueString": "12345"
}
]
}
If yes, does anyone know how could the extension be specific to one phone number? Since there can be several phone number for one person(work, home, mobile).

The reason why I am ask this is because , I have run into several examples that adding extension using "_"prefix. For example, in one of the patient resource, they put the birth time extension under "_ birthDate" like below:

"birthDate": "1974-12-25",
"_birthDate": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/patient-birthTime",
"valueDateTime": "1974-12-25T14:35:45-05:00"
}
]
},

Is this the correct format to using in extension? Or in what situation should we use this "_" prefix?

Thanks in advance for your help!
Lentic

view this post on Zulip Chris Moesel (Sep 24 2018 at 22:12):

Hi @Lentic Li. Welcome to FHIR!

In general, if a type is complex (i.e., not a primitive), then extensions will be embedded inside the element itself. So:

"telecom": [
  {
    "system": "phone",
    "value": "(777)456-4566",
    "use": "work",
    "period": {
      "start": "20180313"
    },
    "extension": [
      {
        "url": "http://hl7.org/fhir/StructureDefinition/contactpoint-extension",
        "valueString": "12345"
      }
    ]
  }
]

Since primitives are not an object in JSON, however, we can't easily embed additional data within them. This is why the _ convention is necessary (and why you see it for birthDate, which is a primitive string).

See: http://hl7.org/fhir/json.html#primitive

view this post on Zulip Lentic Li (Sep 24 2018 at 22:20):

@Chris Moesel Thank you for your explanation. This is very helpful!


Last updated: Apr 12 2022 at 19:14 UTC