Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
welbergm-draeger opened this issue Apr 20, 2023 · 2 comments
Labels
Bug Bug bug bug. Feedback-Discussion Discussion is needed. Specification An issue referring or related to the FHIR Specification

Comments

@welbergm-draeger
Copy link

welbergm-draeger commented Apr 20, 2023

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

@welbergm-draeger welbergm-draeger added the Bug Bug bug bug. label Apr 20, 2023
@LTA-Thinking
Copy link
Collaborator

This seems to be an issue in our CodeToTokenSearchValueConverter class. When passed a value that doesn't have a code or system it is returning an array with a null element instead of an empty array. Our TypedElementSearchIndexer then throws an exception because it can't work with a null value. The DateToDateTimeSearchValueConverter is returning an empty array, which is why _birthDate is working.

@EXPEkesheth EXPEkesheth added Specification An issue referring or related to the FHIR Specification Feedback-Discussion Discussion is needed. labels Apr 26, 2023
@nielsrustenburg
Copy link

We are experiencing the same issue

Fhir-server Version: 3.4.143
Dataprovider: CosmosDB
Fhir Version: STU3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug bug bug. Feedback-Discussion Discussion is needed. Specification An issue referring or related to the FHIR Specification
Projects
None yet
Development

No branches or pull requests

4 participants