Skip to content

Extensions for primitive type 'code' cannot be uploaded individually. #3244

Open
@welbergm-draeger

Description

@welbergm-draeger

Describe the bug
Extensions should be uploadable without their corresponding 'origin' attributes.
Example 1:

{
    "resourceType": "Patient",
	"active": false,
	"_gender": {
        "extension": [{
            "url": "some.url.com",
            "valueCode": "undefined"
        }]
    }
}

POSTing the resource of Example 1 produces the following OperationOutcome issue:

Response 1:

"issue": [
        {
            "severity": "error",
            "code": "invalid",
            "diagnostics": "Value cannot be null.  Parameter name: Patient.gender | Person.gender | Practitioner.gender | RelatedPerson.gender."
        }
    ]

This problem appears to only affect attributes of the type 'code'.

FHIR Version?
R4

Data provider?
CosmosDB

To Reproduce
Steps to reproduce the behavior:

  1. POST patient resource from Example 1 to the FHIR server.

Expected behavior
POSTing the patient resource from Example 1 should not lead to an error, but should create the resource successfully instead.

Resources containing only extension attributes of types other than 'code' (e.g. 'date') produce the expected behaviour already:
Example 2:

{
    "resourceType": "Patient",
	"active": false,
	"_birthDate": {
        "extension": [{
            "url": "some.url.com",
            "valueString": "undefined"
        }]
    }
}

Uploading resources with extensions for 'code' type attributes already works, when the 'origin' attribute is also present.
Example 3:

{
    "resourceType": "Patient",
	"active": false,
	"gender": "male",
	"_gender": {
        "extension": [{
            "url": "some.url.com",
            "valueCode": "undefined"
        }]
    }
}

Example 1 should produce the same response as Examples 2 and 3 (e.g. a valid resource is created on the server),
as "The extensions may appear in place of the value of the primitive datatype." [1].

Actual behavior
POSTing the patient resource from Example 1 to the azure FHIR server leads to a HTTP 400 Bad Request server response.
Additional Information regarding the error can be found in the response body:

{
    "resourceType": "OperationOutcome",
    "id": "1b6335849153345badc0ffeedeadbeef",
    "meta": {
        "lastUpdated": "2023-04-20T08:24:19.9243218+00:00"
    },
    "issue": [
        {
            "severity": "error",
            "code": "invalid",
            "diagnostics": "Value cannot be null.  Parameter name: Patient.gender | Person.gender | Practitioner.gender | RelatedPerson.gender."
        }
    ]
}

[1] https://www.hl7.org/fhir/extensibility.html#primitives

AB#102748

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugBug bug bug.Feedback-DiscussionDiscussion is needed.SpecificationAn issue referring or related to the FHIR Specification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions