FHIR resource extension

Hi ,

Our company is using R4 version FHIR,But some resources don’t have the fields we want, such as the birthplace of the patient.

I did the following two steps:
1.I use Forge tool extension Patient resource and send a put request(new StructureDefinition)
2.send a new Patient to create(Contains new fields)

But there are no new fields in the created patient.
what should I do? Please help me.

thanks!
Arvin

You can’t add new fields to Patient (or any other resource). What you can do is use the existing ‘extension’ elements to convey additional content. For example, there’s already a standard extension defined for birthplace (http://hl7.org/fhir/extension-patient-birthplace.html)
So your instance would look like this:

<Patient>
  <extension url="http://hl7.org/fhir/StructureDefinition/patient-birthPlace">
    <valueAddress>
      <city value="Saskatoon"/>
      <state value="SK"/>
      <country value="Canada"/>
    </valueAddress>
  </extension>
  <name>
    <text value="John Smith"/>
  </name>
  ...
</Patient>

If you were using Forge to define your own extensions, you would send them in the same way. (It’s always best to look for existing defined ‘standard’ extensions before defining your own though.)

Thank you for your reply!

I defined the extension in Forge and added it to the Patient.

Next I send the update Patient StructureDefinition request

Then I create a new Patient, below is Payload:

{
“resourceType”: “Patient”,
“extension”: [
{
“brithPlace”: {
“url”:“http://hl7.org/fhir/StructureDefinition/patient-birthPlace”,
“valueAddress”: {
“use”: “home”,
“type”: “physical”,
“text”: “USA”,
“line”: [
“Address line 1”
],
“city”: “City1”,
“district”: “District1”,
“state”: “State1”,
“postalCode”: “Postalcode1”,
“country”: “County1”,
“period”: {
“start”: “2019-08-13T13:32:37.3764528-04:00”,
“end”: “2019-08-13T13:32:37.3764635-04:00”
}
}
}
}
],
“active”: false,
“name”: [
{
“family”: “Smith”,
“given”: [
“Alice”
]
},
{
“use”: “official”,
“family”: “Last”,
“given”: [
“First”,
“Second”
]
}
],
“telecom”: [
{
“system”: “phone”,
“value”: “1111111111”,
“use”: “mobile”,
“rank”: 1,
“period”: {
“start”: “2019-08-13T13:32:37.3718441-04:00”,
“end”: “2019-08-13T13:32:37.3718646-04:00”
}
}
],
“gender”: “male”,
“birthDate”: “2000-01-01”,
“deceasedDateTime”: “2019-08-13T13:32:37.3730984-04:00”,
“address”: [
{
“use”: “home”,
“type”: “physical”,
“text”: “USA”,
“line”: [
“Address line 1”
],
“city”: “City1”,
“district”: “District1”,
“state”: “State1”,
“postalCode”: “Postalcode1”,
“country”: “County1”,
“period”: {
“start”: “2019-08-13T13:32:37.3764528-04:00”,
“end”: “2019-08-13T13:32:37.3764635-04:00”
}
}
],
“maritalStatus”: {
“coding”: [
{
“system”: “Marital Status code URI”,
“version”: “V1”,
“code”: “Code1”,
“display”: “Display1”,
“userSelected”: true
}
],
“text”: “Codeable concept text2”
},
“multipleBirthBoolean”: false,
“photo”: [
{
“contentType”: “binary”,
“language”: “binary”,
“data”: “MTAxMDEwMTAxMTExMDAwMDAxMDEwMTA=”,
“url”: “photo.com”,
“size”: 32767,
“hash”: “MTIzNDU2Nzg5QUJDREVGMTIzNDU2”,
“title”: “Patient Photo”,
“creation”: “2000-01-01”
}
],
“managingOrganization”: {
“reference”: “Organization/55709”
}
}

But there is no birthPlace on the created Patient.
Is it wrong for me?

Yes, that’s wrong. What it should look like is this:

{
  “resourceType”: “Patient”,
  “extension”: [
    {
      “url”:“http://hl7.org/fhir/StructureDefinition/patient-birthPlace”,
      “valueAddress”: {
      “city”: “City1”,
      “state”: “State1”,
      “country”: “County1”
    }
  ],
  "active": true,
  ...
}

I.e. There’s no property named “birthPlace”, just an extension object that has the appropriate URL and desired value[x]. (In my example, I eliminated address properties unlikely to be relevant for a birth address, but technically they’re all allowed to be present.)

1 Like

Tanks a lot! I tried it as you said, it is.

But I have a question, why is the property named “birthPlace” in the profile not reflected in the payload?

I found that this extension is also supported for individual fields. The field name is underlined(_line), but I didn’t find this part in the FHIR document. Do you know where to explain this extension?

What you are seeing there in Forge is the slice name - i.e. a named constraint on a repeating element. Slice names never show up in an instance.

Look here: http://hl7.org/fhir/json.html#primitive
Specifically at the birthDate example.

OK ,a big thanks to you!:smile: