Date format

70 views
Skip to first unread message

Alexander

unread,
Nov 10, 2015, 5:07:34 AM11/10/15
to FHIRbase
Hi,

I have a question regarding date handling in Fhirbase. It seems that Fhirbase expects dates on the postgreSQL-format for comparisons to work properly, but the fhir specification states date should follow the xsDateTime-format. Have I misunderstood how it works or is this something that should perhaps be adressed?

Yours truly, Alexander Takacs

Николай Рыжиков

unread,
Nov 10, 2015, 5:21:57 AM11/10/15
to Alexander, FHIRbase

Hi, Alexander. Do you have some examples?

--
You received this message because you are subscribed to the Google Groups "FHIRbase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fhirbase+u...@googlegroups.com.
To post to this group, send email to fhir...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fhirbase/3bd7a89a-4a50-4080-883e-548a781ba5e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

tak...@gmail.com

unread,
Nov 10, 2015, 6:52:57 AM11/10/15
to FHIRbase, tak...@gmail.com
Sure!

I have the following Observation in the database:

{"type": "searchset", "entry": [{"resource": {"id": "59188a47-d696-430d-9ee1-dc843a1ba10d", "code": {"coding": [{"code": "MDC_ECG_CARD_BEAT_RATE", "system": "MDC"}]}, "meta": {"versionId": "59188a47-d696-430d-9ee1-dc843a1ba10d", "lastUpdated": "2015-11-09T16:29:40.303872+01:00"}, "subject": {"reference": "111111-2425"}, "resourceType": "Observation", "valueQuantity": {"code": "MDC_BEATS_MIN", "value": 89.000000, "system": "MDC"}, "appliesDateTime": "2015-03-28T12:59:00.000Z"}}], "resourceType": "Bundle"}

I then run:

select fhir.search_sql('Observation','date=2015-03-28T12:59:00.000+00:00');

Which gives 0 results.

The SQL for the above statement gives:

SELECT observation.version_id, observation.logical_id, observation.resource_type, observation.updated, observation.published, observation.category, observation.content FROM observation
 WHERE ( (fhirbase_date_idx.index_as_date(content, '{"*[starts-with(local-name(.), ''applies'')]"}'::text[], NULL::text) && '["2015-03-28 13:59:00+01","2015-03-28 13:59:00+01"]'))

I'm thinking this has do do with the date format of the inserted object being 2015-03-28T12:59:00.000Z. Using this exact string as the search parameter yields

WHERE ( (fhirbase_date_idx.index_as_date(content, '{"*[starts-with(local-name(.), ''applies'')]"}'::text[], NULL::text) && NULL))

Yours truly, Alexander Takacs

Николай Рыжиков

unread,
Nov 10, 2015, 8:01:33 AM11/10/15
to Alexander, FHIRbase

There could be couple of problems with this search: fhirbase does not handle such xpaths and not time zones aware. Both this issues are fixed or will be fixed in plv8 version.

73's nicola

--
You received this message because you are subscribed to the Google Groups "FHIRbase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fhirbase+u...@googlegroups.com.
To post to this group, send email to fhir...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages