Open callahantiff opened 5 years ago
mx_case_inclusion_criteria_1: (1) Assuming definition 1 is looking for high TSH and definition 2 is look for low T4. (2) May not matter but UNION ALL will repeat PERSON_ID if same PERSON_ID seen in both parts of the UNION. UNION DISTINCT would return PERSON_ID only once.
mxrx_case_inclusion_criteria_1: Need to rewrite. Need to use V1/V2 as discussed previously where V1.start_datetime = min(medication), V2.start_datetime = max(medication), V3.start_datetime= min(lab), V4.start_datetime = max(lab). Then, first segment looks for DATEDIFF(v1.start_datetime,v2.start_datetime,month)>30; second fragment looks for DATEDIFF(v3.start_datetime, v4.start_datetime, month) > 30 and third fragment looks for DATEDIFF( min(V1.start_datetime,V3.start_datetime), max(V2.start_datetime, V4.start_datetime). MONTH) > 3
Also need to ensure V1<V2 and V3<V4 in previous logic. The entire query will be M-U-C-H simpler than your current query.
px_case_exclusion_criteria_1: is "proceeds" supposed to mean precedes? If so, my interpretation of this English is that you must be diagnosed with hypothyroidism prior to any radiation tx (because radiation tx can cause secondary hypothyroidism). If this is right, then cannot have your first radiation tx event { =min(cont1.procedure.date) } happen before your first hypothyroidism diagnosis { = min(visit_start_datetime) }
If this is the right interpretation, then max(cont1.procedure_date) < max(v.visit_end_date)
needs to be changed to
min(visit.start_date) < min(cont1.procedure_date) // first Dx visit before first RadX visit
We have to talk about dxmx_case_exclusion_criteria_1 -- the one with 6 months before and 1 year after pregnancy. I can't see how you can define the pregnancy interval to know the start of a pregnancy for "6 months before" and the end of a pregnancy for "1 year after, especially when there are multiple pregnancy events for a patient.
Not done. Had to stop for a phone call.
@mgkahn - Can you please help me verify the query to select Hypothyroidism patients?
This one is pretty massive. I broke it apart a bit more than might be expected because it was easier for me to track the different conditions. Note, that I use
A
andB
to signify when I broke the query into subparts.COHORT CRITERIA Case Criteria:
Control Criteria:
visit_admitting_source_concept_id == Ambulatory visit (44814672)
)visit_admitting_source_concept_id == Ambulatory visit (44814672)
)Cohort Logic Table
NOTE.
{database}
withCHCO_DeID_Oct2018
{code_set_group}
Query can be found here and is also included below: