Date search

Search by date in Aidbox

As mentioned in FHIR Search specification, Date parameters may be used with the date, dateTime, instant, Period, or Timing data types. Every date in search matches yyyy-mm-ddThh:mm:ss[Z|(+|-)hh:mm] format.

Prefixes for date search supported:

  • eq - equal (default)

  • ne - non-equal

  • lt - less than

  • le - less or equal

  • gt - greater than

  • ge - greater or equal

  • sa - starts after

  • eb - ends before

By default, search by date in Aidbox does not confirm to FHIR spec due historical reasons. We highly recommend to use FHIR compliant date search. Turn it on with:

BOX_SEARCH_FHIR__COMPARISONS=true

FHIR Ranges

All date comparisons in FHIR are range-based. Range consists of lower bound and upper bound.

FHIR dateTIme value can be incomplete datetime. E.g. 2020 is a FHIR dateTime but it is an incomplete datetime, since it doesn't specify month, day, etc.

Lower bound of the FHIR dateTime is the earliest complete datetime, which matches the FHIR dateTime value. For 2020 the lower bound is 2020-01-01T00:00:00Z.

Vice versa the upper bound of the FHIR dateTime is the latest complete datetime.

For FHIR Period lower bound is the lower bound of the Period.start, similarly for the upper bound. Missing start or end in Period is treated as infinity.

Search using ranges

Searching by date is done by comparing search range and resource (target) range.

Search range is the range of the search value.

For example, searching GET /fhir/Patient?birthdate=2020 means that the search range is 2020-01-01T00:00:00Z2020-12-31T23:59:59Z.

Resource range is the range of the target resource value.

For example, if Patient resource contains birthDate 2020-01-01, the resource range is 2020-01-01T00:00:00Z2020-01-01T23:59:59Z.

Aidbox date search operators

Description of Aidbox search operators.

FHIR date search operators

Description of FHIR search operators

Last updated