As Wyclif and I have been reviewing the recent work on expanding cohort membership to support start and end dates, we noticed that there’s an “isActive” method and we wanted to check on what our standard behavior is here.
When we have a domain object with a startDate
and endDate
, is endDate included in the range or not?
In the codebase I see:
-
PatientState.getActive(Date)
which is exclusive of endDate. - Relationship has an endDate, but no logic around it
- PersonAddress has an endDate, but some bad logic that we shouldn’t be copying
- Visit has a stopDatetime (not quite the same) and in the emrapi module, the “isSuitableVisit” method is inclusive of stopDatetime
- In the reporting module I recall we did something like “if an ‘onOrBeforeDatetime’ has 00:00:00 time component treat it as 23:59:59, i.e. include the day of the end datetime”
My bias is that for cohort membership we should include the end date. It’s more natural to say “the patient was in the cohort from Jan 1 to Jan 31 (inclusive)” as opposed to “…from Jan 1 to Feb 1 (exclusive)”.