Search code examples
hl7-fhirdstu2-fhir

How does a date search parameter work with a Period field?


I'm looking at the DSTU2 CarePlan resource which has a date search parameter that searches the CarePlan.period field.

The DSTU2 search page specifies that when the target value is a Period, the target is explicitly a range (though the upper or lower bound may not be actually specified on the resource), with the following example:

date=ge2013-03-14    |    Includes a period "from 21-Jan 2013 onwards"

Does the target explicitly being a range mean that the date search parameter in this case should be treated as a range from "ge2013-03-14" to "highest possible date"?

In this case, would all CarePlans that have a period that encompasses some subset of that range qualify? For example, would a CarePlan with period:

"period": {
  "end": "2013-03-15"
}

also be included in the results?


Solution

  • All dates that aren't fully expressed down to the 10th of a millisecond are automatically treated as periods for comparison purposes. And matches would be based on whether there's a non-empty intersection between the period specified in the search and the period specified in the instance. So yes, in the example you provided, ge2013-03-14 would search for any timestamp from 2013-03-14T00:00:00.0000 and higher in the receiver's default timezone. From a matching perspective, the instance you indicated would be treated as having a start of negative-infinity and an end that would encompass all times from 2013-03-15T00:00:00.0000 through 2013-03-15:23:59:59.9999. That would have an overlap of the range of just under 2 days.