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-equallt
- less thanle
- less or equalgt
- greater thange
- greater or equalsa
- starts aftereb
- 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:
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:00Z
—2020-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:00Z
—2020-01-01T23:59:59Z
.
Aidbox date search operators
Let be the search range; be the resource range.
Description of Aidbox search operators.
eq
- equal (default). Formula:ne
- not equal. Formula: lt
- less than. Formula:le
- less than or equal. Formula:gt
- greater than. Formula: ge
- greater than or equal. Formula:
FHIR date search operators
Let be the search range; be the resource range.
Description of FHIR search operators
eq
- equal. Formula: ne
- not equal. Formula: lt
- less than. Formula: le
- less than or equal. Formula:gt
- greater than. Formula:ge
- greater than or equal. Formula: sa
- starts after. Formula: eb
- ends before. Formula:
Last updated