You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: vignettes/checks/plausibleAfterBirth.Rmd
+1
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ output:
18
18
19
19
## Description
20
20
The number and percent of records with a date value in the **cdmFieldName** field of the **cdmTableName** table that occurs prior to birth.
21
+
Note that this check replaces the previous `plausibleTemporalAfter` check.
21
22
22
23
## Definition
23
24
This check verifies that events happen after birth. The birthdate is taken from the `person` table, either the `birth_datetime` or composed from `year_of_birth`, `month_of_birth`, `day_of_birth` (taking 1st month/1st day if missing).
The number and percent of records with a date value in the @cdmFieldName field of the @cdmTableName table that occurs after death.
21
+
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.
22
+
Note that this check replaces the previous `plausibleDuringLife` check.
22
23
23
24
24
25
## Definition
26
+
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.
25
27
26
-
-*Numerator*:
27
-
-*Denominator*:
28
-
-*Related CDM Convention(s)*:
29
-
-*CDM Fields/Tables*:
30
-
-*Default Threshold Value*:
28
+
-*Numerator*: The number of records where date in **cdmFieldName** is more than 60 days after the persons' death date.
29
+
-*Denominator*: Total number of records of persons with a death date, in the **cdmTableName**.
30
+
-*Related CDM Convention(s)*: -Not linked to a convention-
31
+
-*CDM Fields/Tables*: This check runs on all date and datetime fields.
32
+
-*Default Threshold Value*: 1%
31
33
32
34
33
35
## User Guidance
34
-
36
+
Events are expected to occur between birth and death. The check `plausibleAfterbirth` checks for the former, this check for the latter.
37
+
The 60-day period is a conservative estimate of the time it takes for administrative records to be updated after a person's death.
38
+
By default, both start and end dates are checked.
35
39
36
40
### Violated rows query
37
41
```sql
38
-
42
+
SELECT
43
+
'@cdmTableName.@cdmFieldName'AS violating_field,
44
+
cdmTable.*
45
+
FROM @cdmDatabaseSchema.@cdmTableName cdmTable
46
+
JOIN @cdmDatabaseSchema.death de
47
+
ONcdmTable.person_id=de.person_id
48
+
WHERE cdmTable.@cdmFieldName IS NOT NULL
49
+
AND CAST(cdmTable.@cdmFieldName ASDATE) > DATEADD(day, 60, de.death_date)
39
50
```
40
51
41
-
42
52
### ETL Developers
53
+
Start dates after death are likely to be source data issues, and failing this check should trigger investigation of the source data quality.
54
+
End dates after death can occur due to derivation logic. For example, a drug exposure can be prescribed as being continued long after death.
55
+
In such cases, it is recommended to update the logic to end the prescription at death.
43
56
44
57
45
58
### Data Users
46
-
59
+
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.
60
+
However, it might signify a larger data quality issue.
61
+
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.
Copy file name to clipboardexpand all lines: vignettes/checks/plausibleStartBeforeEnd.Rmd
+4-2
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: "plausibleStartBeforeEnd"
3
-
author: ""
3
+
author: "Maxim Moinat"
4
4
date: "`r Sys.Date()`"
5
5
output:
6
6
html_document:
@@ -19,10 +19,12 @@ output:
19
19
20
20
## Description
21
21
The number and percent of records with a value in the **cdmFieldName** field of the **cdmTableName** that occurs after the date in the **plausibleStartBeforeEndFieldName**.
22
+
Note that this check replaces the previous `plausibleTemporalAfter` check.
22
23
23
24
24
25
## Definition
25
-
Most tables have a field for the start and a field for the end date for the event. This check verifies that the start date is not after the 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.
26
+
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.
27
+
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.
26
28
27
29
-*Numerator*: The number of records where date in **cdmFieldName** is after the date in **plausibleStartBeforeEndFieldName**.
28
30
-*Denominator*: The total number of records with a non-null start and non-null end date value
0 commit comments