-
Notifications
You must be signed in to change notification settings - Fork 483
Description
The official definition gap_days is: The Gap Days determine how many total drug-free days are observed between all Drug Exposure events that contribute to a DRUG_ERA record. It is assumed that the drugs are “not stockpiled” by the patient, i.e. that if a new drug prescription or refill is observed (a new DRUG_EXPOSURE record is written), the remaining supply from the previous events is abandoned. The difference between Persistence Window and Gap Days is that the former is the maximum drug-free time allowed between two subsequent DRUG_EXPOSURE records, while the latter is the sum of actual drug-free days for the given Drug Era under the above assumption of non-stockpiling
If I understood correctly this means that in this circumstance with 4 records:
day: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
exposure 1: |-----------| (day 1 to 5)
exposure 2: |-----------| (day 3 to 7)
exposure 3: |-----| (day 11 to 13)
exposure 4: |-----------| (day 16 to 20)
I would expect that this is collapsed in a single era day 1 to 20. And that gap_days is 5 (8, 9, 10, 14, 15)
Applying the drug era script:
https://ohdsi.github.io/CommonDataModel/sqlScripts.html#Drug_Eras
As expected the drug era spans from day 1 to 20, but gap_days is 7 which is for me an unexpected result, this is because gap days is calculated as:
duration of era - duration of exposure 1+2 - duration of exposure 3 - duration of exposure 4
duration of an exposure is calculated as end - start, so the duration of era is estimated as 19 (20 -1), duration of exposure 1+2 is 6 (7 - 1), duration of exposure 3 is 2 (13 - 11) and duration of exposure 4 is 4 (20 - 16).
gap_days = 19 - 6 - 2 - 4 = 7
This could be solved if we would calculate duration as end - start + 1 then:
gap_days = 20 - 7 - 3 - 5 = 5
Giving a more simple example if we have two consecutive exposures:
day: 1 2 3 4 5 6 7 8 9 10
exposure 1: |-----------| (day 1 to 5)
exposure 2: |-----------| (day 6 to 10)
This would result in gap_days = 1, which for me it is not the case as the individual is exposed every day.
This can be solved adding a +1 in two lines of the drug_era code. But I am wondering if I am wrong and there is a reason to consider that there is a gap between two consecutive exposures.
@clairblacketer @MaximMoinat @wibeasley (tagging the three persons I've seen contributed to the documentation of how drug era is calculated)