ppazos / cabolabs-ehrserver

Open platform to manage and share standardized clinical data, designed by @ppazos at CaboLabs Health Informatics.
https://cabolabs.com
Apache License 2.0
181 stars 110 forks source link

There is an issue with querying for documents returning empty results on staging #343

Closed ppazos closed 8 years ago

ppazos commented 8 years ago
  1. test the "documents with high BP" query
  2. you will see an empty result

new query 1

ppazos commented 8 years ago

The problem is that the query says: systolic > 140.0 but the query says > 1400.0 !!! Also for the diastolic is 900.0 instead of 90.0.

This is a problem with parsing floats and the locale. It might be related to the client sending this header: Content-Language:es

On the database, the data_criteria_dv_quantity is saved OK as 140 and 90.

The problem seems to be on the client side, since the query is done using a JS object from chrome/winxp it's failing, but from android/chrome is working OK, the query has 140/90. Maybe the parsing of this is not done correctly, because on the submitted JSON the value is correct: magnitudeValue : "140.0" (in query.where[0])

FROM CompositionIndex ci WHERE ci.lastVersion=true AND ci.ehrUid = '11111111-1111-1111-1111-111111111111' AND ci.organizationUid = '3edb4053-d248 -46cd-87a5-d5906e1e6e32' AND ( EXISTS (SELECT dvi.id FROM DataValueIndex dvi , DvQuantityIndex dqi WHERE dvi.owner.id = ci.id AND dvi.archetypeId = 'openEHR-EHR-OBSERVATION.blood_pressure.v1' AND dvi.archetypePath = '/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value' AND dqi.id = dvi.id AND dqi.magnitude > 1400.0 AND dqi.units = 'mm[Hg]') OR EXISTS (SELECT dvi.id FROM DataValueIndex dvi , DvQuan tityIndex dqi WHERE dvi.owner.id = ci.id AND dvi.archetypeId = 'openEHR-EHR-OBSERVATION.blood_pressure.v1' AND dvi.archetypePath = '/data[at0001]/events[at0006]/data[at0003]/items[at0005]/value' AND dqi.id = dvi.id AND dqi.magnitude > 900.0 AND dqi.units = 'mm[Hg]'))

ppazos commented 8 years ago

Fixed, need to test on stating.