plausibleTemporalAfter only correctly works with same or person table #446
MaximMoinat
started this conversation in
General
Replies: 1 comment
-
Good catch on this. I think I might vote for the short term solution to be # 1 from the the long term ideas! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
The check
plausibleTemporalAfter
will only work whenplausibleTemporalAfterTableName
refers to the same table or the person table. Currently, this is the case: the check either checks whether end_date > start_date or start_date > birth_datetime. However, in other cases the behaviour of this check is not well defined.Underlying issues
cdmTable
andplausibleTable
(plausibleTemporalAfterTableName) on person_id:DataQualityDashboard/inst/sql/sql_server/field_plausible_temporal_after.sql
Lines 35 to 37 in 1197d5d
If a person has multiple records in
plausibleTable
it is not defined against which record to compare. This could e.g. result in more violations than records in thecdmTable
. An example: comparing an event date before observation period start date in a database where a person can have more than one observation_period.DataQualityDashboard/inst/sql/sql_server/field_plausible_temporal_after.sql
Lines 49 to 50 in 1197d5d
Line 49 should be
CAST(plausibleTable.@plausibleTemporalAfterFieldName AS DATE)
Currently this does not cause issues as the join is either against itself or against the person table.
Proposed solution
Short-term
At least it would be good to document this behaviour in the check description:
Long-term
In the long term we might want to split things up to avoid confusion:
plausibleTemporalAfter
by removing option to specify a tableName, making it only possible to compare within the same table.a.
plausibleAfterBirth
(or combine withplausibleDuringLife
), see also RewritetemporalPlausibleAfter
for checking events before birth #445b.
plausibleDuringObservationPeriod
c.
plausibleDuringVisit
(e.g. visit_detail must be during linked visit_occurrence)d. ...
Beta Was this translation helpful? Give feedback.
All reactions