Difference in behavior between dateTime and period in date type prefix processing

Firstly, Sorry if there is already a similar question in the forum.

I am using effective[x] in Observation to check the behavior of dateTime,period, but I am a little confused.
I have given examples below, is my understanding correct?
Also, is there a page that clearly explains the behavior of each prefix and Period (start/end) type and others (dateTime, instant etc…)?
Any help would be greatly appreciated.

  1. If the query is [?date=eq2022-10-31] or [?date=2022-10-31].
    The target items are
    Data whose effectiveDateTime is in the range from 2022-10-31T00:00:00 to 2022-10-31T23:59:59.
    Data whose effectivePeriod.start is in the range from 2022-10-31T00:00:00 to 2022-10-31T23:59:59 and effectivePeriod.end is in the range from 2022-10-31T00:00:00 to 2022-10-31T23:59:59

  2. If the query is [?date=gt2022-10-31].
    The target items are
    Data whose effectiveDateTime is after 2022-11-01T00:00:00
    Data whose effectivePeriod.end is after 2022-11-01T00:00:00

  3. If the query is [?date=ge2022-10-31].
    The target items are
    Data whose effectiveDateTime is after 2022-10-31T00:00:00.
    Data whose effectivePeriod.start is after 2022-10-31T00:00:00 or effectivePeriod.end is after 2022-10-31T00:00:00.

  4. If the query is [?date=lt2022-10-31].
    The target items are
    Data whose effectiveDateTime is before 2022-10-30T23:59:59.
    Data whose effectivePeriod.start is before 2022-10-30T23:59:59:59.

  5. If the query is [?date=le2022-10-31].
    The target items are
    Data whose effectiveDateTime is before 2022-10-31T23:59:59.
    Data whose effectivePeriod.start is before 2022-10-31T23:59:59:59 or effectivePeriod.end is before 2022-10-31T23:59:59:59.

Hi and no worries - dates and times are always complicated. We are trying to improve the documentation around this. Overall, the comparisons are considered intersection tests on ranges, if that helps.

I will go through each of your examples and hopefully someone else will jump in if I have any errors or omissions =).

  1. The eq comparison is for when the search value either is or contains the data value.
  • effectiveDateTime: correct
  • effectivePeriod: correct
  1. gt is greater than
  • effectiveDateTime: close - 2022-11-01T00:00:00 is included in matches
  • effectivePeriod: period must start after the search range - it would match when the start is 2022-11-01T00:00:00 or after.
  1. ge is greater than or equal
  • effectiveDateTime: close - it matches on or after 2022-10-31T00:00:00
  • effectivePeriod: start is on or after 2022-10-31T00:00:00
  1. lt is less than
  • effectiveDateTime: close - matches on or before 2022-10-30T23:59:59
  • effectivePeriod: period must end before the search range - it would match when the end is 2022-10-30T23:59:59 or before.
  1. le is less than or equal
  • effectiveDateTime: close - matches on or before 2022-10-31T23:59:59
  • effectivePeriod: matches when end is on or before 2022-10-31T23:59:59
1 Like

Hi @GinoCanessa.

Thank you for your response. If I understand correctly, there are probably two things that are important in a Prefix+Pediod type query search?

When using gt/ge with period type, only [x]period.start is referenced.
When using lt/le with period type, only [x]period.end is referenced.

Thanks in any case.