fhirbase / fhirbase-plv8

[DEPRECATED] Fhirbase 2.0 is an FHIR relational storage
https://health-samurai.io/fhirbase
Other
105 stars 39 forks source link

Seaching by token parameter with optional types in underlying data returns wrong results #74

Open Andrzej-Pietrzak opened 8 years ago

Andrzej-Pietrzak commented 8 years ago

On beta5: Using Patient.deceased search param, which should allow to search on patient.deceased[x](patient.deceasedBoolean, patient.deceasedDateTime) This may be the same issue as https://github.com/fhirbase/fhirbase-plv8/issues/67

-- test for multi type search param - e.g. patient.deceased[x] (patient.deceasedBoolean, patient.deceasedDateTime)
SELECT fhir_create_resource('{"allowId": true, "resource": {"id":"id1","deceasedBoolean":true,"resourceType":"Patient"}}');
SELECT fhir_create_resource('{"allowId": true, "resource": {"id":"id2","deceasedBoolean":"true","resourceType":"Patient"}}');  -- can be ignored
SELECT fhir_create_resource('{"allowId": true, "resource": {"id":"id3","deceasedBoolean":false,"resourceType":"Patient"}}');
SELECT fhir_create_resource('{"allowId": true, "resource": {"id":"id4","deceasedBoolean":"false","resourceType":"Patient"}}'); -- can be ignored
SELECT fhir_create_resource('{"allowId": true, "resource": {"id":"id5","deceasedDateTime":"1972-10-11","resourceType":"Patient"}}');
SELECT fhir_create_resource('{"allowId": true, "resource": {"id":"id6","resourceType":"Patient"}}');

SELECT fhir_search('{"resourceType": "Patient", "queryString": "deceased=true"}'); -- ok, id1, id2, id5 correct
SELECT fhir_search('{"resourceType": "Patient", "queryString": "deceased=true"}'); -- ok, id1, id2, id5 correct
SELECT fhir_search('{"resourceType": "Patient", "queryString": "deceased=false"}'); -- nok, got everything except id5, expected id3, id4 and id5
SELECT fhir_search('{"resourceType": "Patient", "queryString": "deceased:missing=true"}'); -- nok, got id3, id5, id6 where exepcted only id6
SELECT fhir_search('{"resourceType": "Patient", "queryString": "deceased:missing=false"}'); -- nok, got all back
mlapshin commented 8 years ago

@Andrzej-Pietrzak are you sure that query deceased=false should match against id5 ? I think you mean deceased=false should match id3, id4 and id6.

mlapshin commented 8 years ago

please note this issue is still not fixed

Andrzej-Pietrzak commented 8 years ago

After having read the documentation I was thinking it should, quoting: "deceased token This patient has been marked as deceased, or as a death date entered Patient.deceased[x]" On the other hand - after checking with two other servers it seems that it doesn't do that anywhere.

The thing is - is it possible to find all dead patients (assuming inconsistent data) without merge'ing two result sets ?

szymonp-kainos commented 8 years ago

What's the status on this issue ?

vadi2 commented 8 years ago

Possibly fixed? See here.