COC08: Patients with condition and some observation criteria some number of days prior to or after initial condition

 Parameter  Example  Mandatory  Notes
concept_name OMOP Aplastic Anemia 1 Yes
list of observation_concept_id 3000905, 3003282, 3010813   Leukocytes #/volume in blood

Sample query run:
The following is a sample run of the query. The input parameters are highlighted in blue

SELECT DISTINCT condition.person_id
     , observation_date, condition_era_start_date
  FROM condition_era condition
  JOIN -- definition of Aplastic Anemia
     ( SELECT DISTINCT descendant_concept_id
         FROM vocabulary.relationship
         JOIN vocabulary.concept_relationship rel USING( relationship_id ) 
         JOIN vocabulary.concept concept1 ON concept1.concept_id = concept_id_1
         JOIN vocabulary.concept_ancestor ON ancestor_concept_id = concept_id_2
        WHERE relationship_name = 'HOI contains SNOMED (OMOP)'
          AND concept1.concept_name = 'OMOP Aplastic Anemia 1'
           AND sysdate BETWEEN rel.valid_start_date and rel.valid_end_date
     ) ON descendant_concept_id = condition_concept_id
  JOIN observation ON observation.person_id = condition.person_id
                  AND observation_date BETWEEN condition_era_start_date - 7
                                           AND condition_era_start_date + 7
 WHERE observation_concept_id 
    IN /* leukocytes #/volume in blood */
       ( 3000905, 3003282, 3010813 )
   AND unit_concept_id = 8961 /* Thousand per cubic millimeter */
   AND value_as_number <= 3.5;
Output field list:
 Field  Description
condition_concept_id A foreign key that refers to a standard condition concept identifier in the vocabulary.
observation_concept_id A foreign key to the standard observation concept identifier in the vocabulary.
relationship_id The type of relationship as defined in the relationship table.
concept_name An unambiguous, meaningful and descriptive name for the concept.
condition_era_start_date The start date for the condition era constructed from the individual instances of condition occurrences. It is the start date of the very first chronologically recorded instance of the condition.
valid_start_date The date when the concept was first recorded.
valid_end_date The date when the concept became invalid because it was deleted or superseded (updated) by a new concept. The default value is 31-Dec-2099.

Sample output record:
 Field  Description