FHIR Chat · SearchParameter date type · implementers

Stream: implementers

Topic: SearchParameter date type


view this post on Zulip Dave Henderson (Oct 09 2017 at 11:00):

Hi,
I'm using Vonk as my FHIR server and I'm having an issue using the SearchParameter for date searches. I have the SP type="date" and created a organization entry that uses a date:

<extension url=" https://fhir.nhs.uk/STU3/StructureDefinition/ODSAPI-ActivePeriod-1">
    <valuePeriod>
        <start value="2017-10-09"/>
    </valuePeriod>
</extension>

If I do a REST GET http://localhost:4080/Organization?orgperiod=2017-10-09 I get no results. I tried adding =eq2017-10-09 and still no result, however if I do a =ge2017-10-09 it returns the record. Why can't I find an exact match ? I added the comparator "eq" to my SP but that made no difference.

Any suggestions most welcome.
Thanks
Dave

view this post on Zulip Christiaan Knaap (Oct 09 2017 at 12:01):

Hi Dave, I can see the extension as part of the project https://simplifier.net/Test-FHIRODSLookupAP/~introduction, but the SearchParameter is not yet on the project (or not visible to me). If you could either add that or send it in a pm, along with the example Organization resource you uploaded, I want to try to find out what happens.

view this post on Zulip Dave Henderson (Oct 10 2017 at 10:26):

Hi,
After a discussion with Christiaan, the issue is with the use of valuePeriod.

My search =eq2017-10-09 is interpreted as [2017-10-09T00:00:00 - 2017-10-10T00:00:00)
The period is only equal if it falls within the period.
Since I have no end date, this cannot be equal and therefore, cannot be found.

The question is now, how to return an exact match for a valuePeriod that only has a start date available ?

FHIR itself is not clear on the equality of periods (http://www.hl7.org/implement/standards/fhir/search.html#date) and Christiaan suggested a better interpretation could be "A period in a resource is considered 'equal' if it has any overlap with the period searched for."

view this post on Zulip Brian Postlethwaite (Oct 16 2017 at 03:47):

I've been reconsidering my date searching implementation to use strings rather than native datetime values in some cases, as the timezones keep getting in my way.

view this post on Zulip Brian Postlethwaite (Oct 16 2017 at 03:48):

The example you provided 2017-10-09T00:00:00 - 2017-10-10T00:00:00 doesn't have the timezone there, so what does that mean to your local values?

view this post on Zulip Ben Spencer (Oct 16 2017 at 05:22):

FHIR itself is not clear on the equality of periods (http://www.hl7.org/implement/standards/fhir/search.html#date) and Christiaan suggested a better interpretation could be "A period in a resource is considered 'equal' if it has any overlap with the period searched for."

For ranges, 'ap' means "any overlap" and 'eq' means "the range of the search value fully contains the range of the target value" (see right column: http://www.hl7.org/implement/standards/fhir/search.html#prefix)

The question is now, how to return an exact match for a valuePeriod that only has a start date available ?

A period without an end date extends indefinitely into the future, so an exact match doesn't really make sense, but 'ap' or 'ge' might do what you want.


Last updated: Apr 12 2022 at 19:14 UTC