Skip to content

support for datatype extension #93

Description

@esbakker

If you have a primitive datatype with an extension the value can not be read. We have a QuestionnaireResponse with extended datatypes for the answers (in this example a date):

"item": [
    {
        "linkId": "date_1",
        "answer": [
            {
                "_valueDate": {
                    "extension": [
                        {
                            "url": "http://localhost/fhir/StructureDefinition/custom-dateType",
                            "valueString": "someDateString"
                        }
                    ]
                }
            }
        ]
    }
]

As you can see the date is emitted with a _ prefix by HAPI. As described here.

There is no way to access these values. If I do a JSON.dump of the item I only get the linkId:

{"linkId":"date_1"}

For non-primitive datatypes like Coding it works as expected

For XML responses it works a little better, since the extension value is set as hash on the valueDate field:

<FHIR::QuestionnaireResponse::Item::Answer:0x000055c8b430afc0
 @extension=[],
 @id=nil,
 @item=[],
 @modifierExtension=[],
 @valueAttachment=nil,
 @valueBoolean=nil,
 @valueCoding=nil,
 @valueDate=nil,
 @valueDateTime=nil,
 @valueDecimal=
  {"extension"=>
    {"valueString"=> "someDateString",
     "url"=>"http://localhost/fhir/StructureDefinition/custom-dateType"}},
 @valueInteger=nil,
 @valueQuantity=nil,
 @valueReference=nil,
 @valueString=nil,
 @valueTime=nil,
 @valueUri=nil>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions