OHDSI Home | Forums | Wiki | Github

Could Atlas Measure Amount of change?

Hi all,

I have a question about illustrate amount of change in atlas.
First, I’ve defined cohort who has a change in Hba1c record after prescription of medicine A (era length 90 days)

like this.
initial event : Medicine A era length 90 days
inclusion criteria :

  1. a Measurement of HbA1c record with value as number greater than 6.5
    event starts between all days before and 0 days before index start date.
  2. a Measurement of HbA1c record with value as number less or equal to 6.5
    event starts between 30 days after and 60 days after index start date.

However what I want to know is “Is there 0.5 of changes after eating medicine A?” . So my way could capture wrong case like 6.7 to 6.4 ( changes < 0.5 ) or couldn’t capture right case like 7.1 to 6.6 (changes = 0.5) !!
Therefore, Is there a way to represent a criteria in which the difference between the first and second records is more than 0.5 in atlas?

To the best of knowledge, this isn’t currently possible in Atlas (and I think it’s a pity). I had a similar need and ended up writing an SQL query to get the outcome cohort. Basically, you’d want something like this:

WITH cte_hba1c_changes AS (
    SELECT 
        bl.person_id,
        bl.measurement_date AS baseline_measurement_date,
        fu.measurement_date AS subsequent_measurement_date,
        bl.value_as_number - fu.value_as_number AS absolute_change,
        (bl.value_as_number - fu.value_as_number > 0.5) AS change_is_greater_than_threshold
    FROM @cdm_schema.measurement AS bl, @cdm_schema.measurement AS fu -- cartesian product of baseline (bl) and follow-up (fu)
    WHERE bl.measurement_concept_id = fu.measurement_concept_id
        AND bl.measurement_concept_id = 37393623 -- the HbA1c you're looking for?
        AND bl.measurement_date <= @index_date
        AND fu.measurement_date BETWEEN @index_date@ + 1 AND @index_date + 90
)

INSERT INTO @cdm_results_schema.@cohort_table
SELECT 
    DISTINCT ON (person_id)
    @cohort_definition_id AS cohort_definition_id,
    person_id AS subject_id,
    @index_date AS cohort_start_date
    NULL AS cohort_end_date
FROM cte_hba1c_changes
WHERE change_is_greater_than_threshold IS TRUE

The values prefixed by @ must be supplied explicitly, e.g. with the loadRenderTranslateSql function in the SqlRender package.

I currently don’t have a functioning OMOP’ed database available (how embarrassing is that…), so this might not work out-of-the-box. Let me know if you need help making this work!

Cheers,
Ben

1 Like

Are you assuming that the units between records is consistent? Or is it in this case that the measurement concept ID is assumed to only have one possible unit? that will probably work for this case, but one reason why functions like this don’t make it into the tools is that there’s not a general solution.

Yeah, that’s a good point. Either you assume (prove/enforce) just one unit, or you include some logic to handle cases where that doesn’t apply. But true, it’s use-case specific.

hmmm, Then if I assume one unit, how can I get it?
Cause I can’t find the any calculation method in atlas 8o8

It’s because Atlas doesn’t support this kind of outcome generation, for the reasons mentioned by @Chris_Knoll. You could use something along the lines of the query I included above, which (implicitly) assumes one unit is used.

t