vignettes/checks/plausibleStartBeforeEnd.Rmd
plausibleStartBeforeEnd.Rmd
Level: FIELD
Context: Verification
Category: Plausibility
Subcategory: Temporal
Severity: CDM convention ⚠
The number and percent of records with a value in the
cdmFieldName field of the cdmTableName
that occurs after the date in the
plausibleStartBeforeEndFieldName. Note that this check
replaces the previous plausibleTemporalAfter
check.
This check is attempting to apply temporal rules within a table, specifically checking that all start dates are before the end dates. For example, in the VISIT_OCCURRENCE table it checks that the VISIT_OCCURRENCE_START_DATE is before VISIT_OCCURRENCE_END_DATE. The start date can be before the end date or equal to the end date. It is applied to the start date field and takes the end date field as a parameter. Both date and datetime fields are checked.
source_release_date
is before
cdm_release_date
.If the start date is after the end date, it is likely that the data is incorrect or the dates are unreliable.
There main reason for this check to fail is often that the source data is incorrect. If the end date is derived from other data, the calculation might not take into account some edge cases.
Any violating checks should either be removed or corrected. In most cases this can be done by adjusting the end date: - With a few exceptions, the end date is not mandatory and can be left empty. - If the end date is mandatory (notably visit_occurrence and drug_exposure), the end date can be set to the start date if the event. Make sure to document this as it leads to loss of duration information. - If this check fails for the observation_period, it might signify a bigger underlying issue. Please investigate all records for this person in the CDM and source. - If neither the start or end date can be trusted, please remove the record from the CDM.
Make sure to clearly document the choices in your ETL specification.
An start date after the end date gives negative event durations,
which might break analyses. Especially take note if this check fails for
the observation_period
table. This means that there are
persons with negative observation time. If these persons are included in
a cohort, it will potentially skew e.g. survival analyses.