vignettes/checks/plausibleBeforeDeath.Rmd
plausibleBeforeDeath.Rmd
Level: FIELD
Context: Verification
Category: Plausibility
Subcategory: Temporal
Severity: Characterization ✔
The number and percent of records with a date value in the
cdmFieldName field of the cdmTableName
table that occurs more than 60 days after death. Note that this check
replaces the previous plausibleDuringLife
check.
A record violates this check if the date is more than 60 days after the death date of the person, allowing administrative records directly after death.
Events are expected to occur between birth and death. The check
plausibleAfterbirth
checks for the former, this check for
the latter. The 60-day period is a conservative estimate of the time it
takes for administrative records to be updated after a person’s death.
By default, both start and end dates are checked.
SELECT
'@cdmTableName.@cdmFieldName' AS violating_field,
cdmTable.*
FROM @cdmDatabaseSchema.@cdmTableName cdmTable
JOIN @cdmDatabaseSchema.death de
ON cdmTable.person_id = de.person_id
WHERE cdmTable.@cdmFieldName IS NOT NULL
AND CAST(cdmTable.@cdmFieldName AS DATE) > DATEADD(day, 60, de.death_date)
Start dates after death are likely to be source data issues, and failing this check should trigger investigation of the source data quality. End dates after death can occur due to derivation logic. For example, a drug exposure can be prescribed as being continued long after death. In such cases, it is recommended to update the logic to end the prescription at death.
For most studies, a low number of violating records will have limited impact on data use as it could be caused by lagging administrative records. However, it might signify a larger data quality issue. Note that the percentage violating records reported is among records from death persons and such might be slightly inflated if comparing to the overall population.