callahantiff / PheKnowVec

Translational Computational Phenotyping
2 stars 0 forks source link

Query Verification: Sleep Apena Cohort #106

Closed callahantiff closed 5 years ago

callahantiff commented 5 years ago

@mgkahn - Can you please help me verify the query to select Sleep Apnea patients?


COHORT CRITERIA Case Criteria:

Control Criteria:

NOTE.

  1. Replace all instances of {database} with CHCO_DeID_Oct2018
  2. Comment out all instances of {code_set_group}

Query can be found here and is also included below:

WITH dx_case_inclusion_criteria_1 AS (
  SELECT co.person_id, cohort.standard_code_set AS code_set
    FROM 
     {database}.condition_occurrence co, 
     {database}.SLEEPAPNEA_COHORT_VARS cohort 
   WHERE co.condition_concept_id = CAST(cohort.standard_concept_id AS int64) 
     AND cohort.phenotype_definition_number = 1 
     AND cohort.standard_code_set = {code_set_group} 
   GROUP BY
      co.person_id, code_set
   HAVING
     COUNT(DISTINCT co.condition_concept_id) >= 1
)

SELECT person_id, code_set, 'SLEEPAPNEA_CASE_TYPE1' AS cohort_type FROM (
  SELECT * FROM dx_case_inclusion_criteria_1)
;
mgkahn commented 5 years ago

Agree with SQL code as written. The criteria does not seem to care if the two codes are on the same or different visit_occurrences. This query allows for both as long as the two codes are different (DISTINCT).

callahantiff commented 5 years ago

Agree with SQL code as written. The criteria does not seem to care if the two codes are on the same or different visit_occurrences. This query allows for both as long as the two codes are different (DISTINCT).

Excellent, that's how I understood the logic as well. Thanks!