uwrit / leaf

Leaf Clinical Data Explorer
https://www.youtube.com/watch?v=ZuKKC7B8mHI
Other
86 stars 47 forks source link

What's the best way to query on "age at time of encounter"? #482

Closed jnothman closed 2 years ago

jnothman commented 2 years ago

Should we add an Age At Encounter concept, or is this not recommended because of deidentification processes?

ndobb commented 2 years ago

Hey @jnothman,

At UW we add Age at Encounter, based on a datediff between birthdate and encounter date: image

It's true that there are implications for possible re-identification, but it's up to each site to decide what risks they're willing to accept. It's used quite a lot by our users.

You could also set the Leaf Numeric Expression to something like DATEDIFF(DAY, BirthDate, DATEADD(DAY, CONVERT(INT, RAND() * 100), EncounterDate)) / 365.25, which would randomly shift birth date before calculating age at encounter, but this shift unfortunately wouldn't match the shift performed by Leaf in the Patient List.

jnothman commented 2 years ago

but this shift unfortunately wouldn't match the shift performed by Leaf in the Patient List.

and presumably would return a different cohort with different runs of the query?

Thanks. Shall I close the issue?

ndobb commented 2 years ago

Depends on how much of a shift, I suppose. You can control the range both in your SQL statement on the Find Patients screen and in the Patient List (via the appsettings file). But right, at best they'd be close but likely not match, and cohorts could differ query to query.

As the per-patient shift value can't be derived until a cohort has been loaded - and at the stage we're talking, the cohort by definition isn't loaded yet - it's not really possible for Leaf to align the date-shifting as currently architected, unfortunately.

If this answers your question, sure, please close the issue.