pharmaverse / sdtmchecks

Analysis facing checks for SDTM data
https://pharmaverse.github.io/sdtmchecks/
Apache License 2.0
21 stars 8 forks source link

Refine logic for check_ae_aedthdtc_ds_death.R #92

Open sarabodach opened 1 year ago

sarabodach commented 1 year ago

Suwen inquired about the direction of the check: DS discon due to AE --> fatal AE only vs. DS discon due to AE <--> fatal AE for fatal AEs

The rationale for DS discon due to AE --> fatal AE was to reduce false positives because oncology studies may have both Death due to PD and Death due to AE, and only the former would be indicated as the "primary" cause.

Upon closer inspection of the logic, this check requires DSTERM to have the text string "DEATH DUE TO ADVERSE EVENT". This requirement is too rigid and reflected legacy mapping; newer studies are more likely to specify DSTERM == 'DEATH' when the patient has a fatal AE.

Potential update: fatal AE --> then DS.DSTERM == 'DEATH'

sarabodach commented 1 year ago

check_dd_death_date.R covers the flipped logic and perhaps can be combined with check_ae_aedthdtc_ds_death.R.

check_dd_death_date.R has the subtitles: Check that patients with death dates in AE also have a DS recording indicating reason for Death is AE • If AE has death date populated then a record with reason for death indicating Adverse Event should exist in DS • i.e. If AE.AEDTHDTC exists there should be at least one DS record with DS.DSDECOD indicating ‘DEATH’ and DS.DSTERM indicating ‘ADVERSE EVENT’ • For example, the standard reason for discon (DS.DSDECOD) might be ‘DEATH’ with reported reason (DS.DSTERM) as “DEATH DUE TO ADVERSE EVENT” 

The 2nd and 3rd bullet are not really true to the current logic-- https://github.com/pharmaverse/sdtmchecks/blob/d0342784e00b2974cbbbbdeb24d00d372d8b0aba/R/check_dd_death_date.R#L66-L74

This was a check that was updated after initial creation, and the subtitles must not have been updated to match. Should be:

Check that patients with death dates in AE also have a DS record indicating Death. • If AE.AEDTHDTC exists there should be at least one DS record with DS.DSDECOD indicating ‘DEATH’ and DS.DSTERM indicating ‘DEATH' (unless Other, specify text populated given) • Older, legacy studies would require reported reason to be DS.DSTERM as "DEATH DUE TO ADVERSE EVENT"