HAPI FHIR: deceasedDateTime removed from @ResourceParam Patient

190 views
Skip to first unread message

Philip Dimeski

unread,
Sep 7, 2022, 1:57:08 AM9/7/22
to HAPI FHIR
Hey folks, 

I've created a basic REST operation to create a patient but I've noticed that if I pass in deceasedDateTime AND deceasedBoolean in the create FHIR resource for the patient, HAPI FHIR is removing the deceasedDateTime from the Patient @ResourceParam.  Looking into the object there is no reference at all to the deceasedDateTime, only the deceasedBoolean.

Has anyone run into this issue, is this intended behaviour? I need the deceasedDateTime if the patient is indeed deceased. If deceasedBoolean is removed then I get the deceasedDateTime which is the field I care about but I can't guarantee that upstream system's will not send both. 

Thanks in advance! 

Ian Bacher

unread,
Sep 7, 2022, 7:13:32 AM9/7/22
to Philip Dimeski, HAPI FHIR
The resource you’ve described sending is not a valid FHIR resource. If you look at the definition of a FHIR patient (https://www.hl7.org/fhir/patient.html), deceased[x] is a a choice of data types which (per the spec https://www.hl7.org/fhir/formats.html#choice) must resolve into only one of the options. The deceased[x] element also has a cardinality of one. The upshot of all of this is that a valid FHIR Patient resource can have either a deceasedBoolean or a deceasedDateTime but not both. The “correct” behaviour for receiving an invalid FHIR resource is undefined, but HAPI is making some attempt to at least capture the data that’s there.

If you’re concerned that in a real-world scenario a client would send you a resource like this, your best bet would be to add a custom server interceptor (https://hapifhir.io/hapi-fhir/docs/interceptors/server_interceptors.html) to your instance that drops the deceasedBoolean element before HAPI processes the request.

On 7 Sep 2022, at 01:57, Philip Dimeski <philip....@bigpicturemedical.com> wrote:

Hey folks, 


I've created a basic REST operation to create a patient but I've noticed that if I pass in deceasedDateTime AND deceasedBoolean in the create FHIR resource for the patient, HAPI FHIR is removing the deceasedDateTime from the Patient @ResourceParam.  Looking into the object there is no reference at all to the deceasedDateTime, only the deceasedBoolean.

Has anyone run into this issue, is this intended behaviour? I need the deceasedDateTime if the patient is indeed deceased. If deceasedBoolean is removed then I get the deceasedDateTime which is the field I care about but I can't guarantee that upstream system's will not send both. 

Thanks in advance! 

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/905fcc36-646e-46ec-9207-e0046d8c4598n%40googlegroups.com.

Philip Dimeski

unread,
Sep 7, 2022, 6:07:01 PM9/7/22
to HAPI FHIR
Ahh yes that makes sense. Thank you!
Reply all
Reply to author
Forward
0 new messages