inst/QueryLibrary/Aggregate/condition_occurrence/CO02.md

CO02: How to determine the onset of a condition.

Description

Determines the onset of a condition in a dataset.

Query

SELECT
  MIN(condition_start_date::date) AS onset_condition_date
FROM @cdm.condition_occurrence
WHERE condition_concept_id = $1 
      AND   EXISTS (SELECT 1 FROM @cdm.observation_period op 
                    WHERE op.person_id = condition_occurrence.person_id
                    AND   op.observation_period_start_date + 6 * INTERVAL '1 month' < condition_occurrence.condition_start_date)
;

Input

| Parameter | Example | Mandatory | Notes | | --- | --- | --- | --- | | concept_id | 4084167 | Yes | Condition concept ID for 'Acute allergic reaction' |

Output

| Field | Description | | --- | --- | | onset_condition_date | The date when the instance of the condition is recorded first time. |

Example output record

| Field | Description | | --- | --- | | onset_condition_date | 9-Jul-2003 |

Documentation

https://github.com/OHDSI/CommonDataModel/wiki/



sib-swiss/dsQueryLibraryServer documentation built on Feb. 13, 2025, 8:07 p.m.