Closed rmhayek closed 2 years ago
@rmhayek fixed on the :edge. Please pull the newest image and check if the fox works for you
@KGOH - It works to retrieve deceased=false
, but does not retrieve patient that has deceasedDateTime
in resource and in query we pass deceased=true
parameter.
@rmhayek
you can use following Search resource instead of Patient.deceased
search parameter
resourceType: Search
id: Patient.deceased
name: deceased
resource:
id: Patient
resourceType: Entity
where: "{{table}}.resource ?? 'deceased' AND NOT {{table}}.resource @> '{\"deceased\": {\"boolean\": false}}'"
@krevedkokun
With the Search resource, the REST API only returns resources that have { "deceased" : {"dateTime": "xyz"}
.
So GET /fhir/Patient?deceased=false
always returned deceased patients.
I tested this with HAPI FHIR test server, if I specify:
GET /fhir/Patient?deceased=false
: it returns all patients that don't have deceased.boolean
field and deceased.boolean=false
.
GET /fhir/Patient?deceased=true
: it returns all patients that have deceased.dateTime
and deceased.boolean=true
.
@rmhayek
With following Search resource:
GET /fhir/Patient?deceased=false
returns all patients that don't have deceased field (boolean or dateTime) or patients with deceased.boolean=false
.
GET /fhir/Patient?deceased=true
returns all patients that have deceased.dateTime
and deceased.boolean=true
.
resourceType: Search
id: Patient.deceased
name: deceased
resource:
id: Patient
resourceType: Entity
where: "coalesce((resource#>>'{deceased,boolean}')::boolean, resource ?? 'deceased', false) = {{param}}"
Thanks @spicyfalafel - this works very well! Would that be part of a future product release or do I have to create the Search
resource in every environment?
Describe the bug Testing if a patient is deceased or living returns both deceasedBoolean and deceasedDateTime.
Severity Major
Steps to reproduce the behavior: Here is a notebook https://aidbox.app/ExportedNotebook/a891e6e6-b988-420e-b127-bb9fc0a7d443
Expected behavior
name
be an exact match? Replacing it withgiven
has the same behavior.GET /fhir/Patient?name=Max&deceased=false
should returnMaxine
only if name is not an exact match.GET /fhir/Patient?name=Max&deceased=true
should returnMax
only. SinceMax
has adeceasedDateTime
it is implied thatdeceased=true
.Versions: devbox:edge v:2206.4c06e7e9