CQL snippet from QiCoreCommon-v2-0-000-20231020-from-MADiE 20231213 /* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, or has an abatement date the resulting interval will have a closed ending boundary. Otherwise, the resulting interval will have an open ending boundary. @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead */ define function ToPrevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)] else (end of ToAbatementInterval(condition)) abatementDate return if abatementDate is null then Interval[start of ToInterval(condition.onset), abatementDate) else Interval[start of ToInterval(condition.onset), abatementDate] /* @description: Returns an interval representing the normalized prevalence period of a given Condition. @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from onset to abatement as specified in the given Condition. If the condition is active, or has an abatement date the resulting interval will have a closed ending boundary. Otherwise, the resulting interval will have an open ending boundary. */ define fluent function prevalenceInterval(condition Condition): if condition.clinicalStatus ~ "active" or condition.clinicalStatus ~ "recurrence" or condition.clinicalStatus ~ "relapse" then Interval[start of condition.onset.toInterval(), end of condition.abatementInterval()] else (end of ToAbatementInterval(condition)) abatementDate return if abatementDate is null then Interval[start of ToInterval(condition.onset), abatementDate) else Interval[start of ToInterval(condition.onset), abatementDate]