Open TomWhite-MedStar opened 1 year ago
With the above detail table as a foundation, users are likely to want certain calculations. For example:
It would be nice to have the option to specify optional variable names and the calculation so that those calculations could be part of the final details table.
Ultimately, it would nice to have more support for calculations directly within the cohort design (e.g. to look for a sequence of decreasing values, or to do calculations on whether drug dosing is adequate based upon the patients weight and the dosage administered); but I presume that adding such logic would be much more complicated.
Current State
Atlas can create very complex cohorts with multiple inclusion criteria. The generated reports can show attrition diagrams, or tables and graphics showing counts of patients who met each inclusion criteria.
However, the raw underlying data are not saved. It is not possible to export a table showing which inclusion criteria applied to each entry in the cohort. Or when and why those inclusion rules are triggered (e.g. the datetime, relevant concept, and relevant values that allowed it to meet inclusion criteria).
However, that level of detail is often needed for follow-up analysis.
For example, for the hospital harm measures mentioned in #2886 , the metrics define tight time criteria. For example:
As we profile these across our multi-hospital system, I want to find near misses, and understand where there is variability. For example, are there cases of glucose follow-up within 10, 15, etc. minutes? Or did the glucose not quite get up to 80 within those 5 minutes? Or what about cases where Narcan was needed within 18 hours.
Rather then creating many cohort variants, I'd like to make two. One which strictly meets the criteria, and another which casts a wider net. For the hypoglycemia measure, I might allow for f/u glucose within 8 hours. Then, once I generate that cohort, I'd like to review the frequency distribution of time from initial event (the critically low glucose level) to the inclusion event (when they got a follow-up), and what the follow-up glucose values were..
The way I have to do that today is to extract create custom SQL logic (often adapted from what is generated from OHDSI). This often requires multiple iterations as we test out different inclusion criteria and time ranges - so it is quite time consuming.
Desired Future State
Atlas already creates most of the needed staging tables as part of the generated SQL before dropping them (e.g. qualified_events, inclusion_0 -- inclusion_N, included_events, strategy_ends).
Theoretically, those tables could be (optionally) augmented to include fields per row to indicate which concept_id triggered the event (and when, via datetime), plus additional relevant attributes (like value, age, source_concept_id). Those standard attributes could be part of the inclusion_0 -- inclusion_N tables; and they could then be transposed so that each of those variables could be available (by inclusion number) in the included_events table.
In the end, what would help me most is a left join of the qualified_events with that new included_events table, including the separate timestamps for each (so that I know the timestamp of the qualifying event along with the timestamps of each inclusion event). That way I can build time to event values for inclusion metrics, plus profile the numeric values that allowed inclusions to happen. Then, by having two versions of such tables (one with exact criteria and second with looser criteria), I could better optics into those cases that nearly missed inclusion into the strict definition.
I know I can do this manually, but this is such a common need that I'd love to find a way to automate it, and take advantage of all the computation that Atlas is already doing along the way.
Detailed Request