Stream: hapi
Topic: Setting name.given and .family
Marvin Kampf (Sep 08 2020 at 08:14):
Hello All,
I do not quite understand why setting name.given
and name.family
does not work
I have tried it in different ways, always with the same result:
"name": [
{
"use": "official",
"_family": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason",
"valueCode": "unsupported"
}
]
},
"given": [
null
],
"_given": [
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason",
"valueCode": "unsupported"
...
Currently I am trying to do it this way:
var absentName = new HumanName();
absentName.setUse(NameUse.OFFICIAL);
absentName
.getFamilyElement()
.addExtension(
fhirProps.getExtensions().getDataAbsentReason(), new CodeType("unsupported"));
absentName
.addGivenElement()
.addExtension(
fhirProps.getExtensions().getDataAbsentReason(), new CodeType("unsupported"));
patient.addName(absentName);
But there are always these strange _family
and _given
fields. Besides given == NULL
.
Does anyone have a tip for me?
Thanks in advance. Marvin
Patrick Werner (Sep 08 2020 at 08:29):
the underscore are needed when adding extensions to primitive values (in JSON) https://www.hl7.org/fhir/json.html#primitive
Marvin Kampf (Sep 08 2020 at 08:34):
I see, thank you @Patrick Werner .
How about validation. If the element given
is required (1..1), is it sufficient to only add an extension (to _given
) like in the example above, or do I still need a (primitive) value for given
?
Patrick Werner (Sep 08 2020 at 08:36):
you don't need a value for given when adding the extension. The extension "populates" the primitive values (given & _given are the same element, just a technical detail in json)
Marvin Kampf (Sep 08 2020 at 08:36):
okay, thank you very much
Last updated: Apr 12 2022 at 19:14 UTC