inst/shinyApps/QueryLibrary/queries/drug_exposure/DEX14.md

DEX14: Among people who take drug A, how many take drug B at the same time?

Description

Calculate among the people who take a drug from a given class, how many take another given drug class at the same time.

Query

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

WITH statins AS (
SELECT descendant_concept_id AS concept_id
  FROM @vocab.concept_ancestor
 WHERE ancestor_concept_id = 1539403
), diuretics AS (
SELECT descendant_concept_id AS concept_id
  FROM @vocab.concept_ancestor
 WHERE ancestor_concept_id = 974166
)
SELECT COUNT(DISTINCT de1.person_id) AS num_users,
       COUNT(DISTINCT de2.person_id) AS also_bp
  FROM @cdm.drug_exposure de1
  JOIN statins s
    ON de1.drug_concept_id = s.concept_id
  JOIN @cdm.drug_exposure de2
    ON de1.person_id = de2.person_id
  LEFT JOIN diuretics d
    ON de2.drug_concept_id = d.concept_id
   AND de2.drug_exposure_start_date < de1.drug_exposure_end_date
   AND de2.drug_exposure_end_date   > de1.drug_exposure_start_date;

Input

| Parameter | Example | Mandatory | Notes | | --- | --- | --- | --- | | ancestor_concept_id | 1539403 | Yes | Statins | | ancestor_concept_id | 974166 | Yes | Diuretics |

Output

| Field | Description | | --- | --- | | num_users | The number of users of statins. | | also_bp | The number of users that also use diuretics. |

Example output record

| Field | Description | | --- | --- | | num_users | 5484 | | also_bp | 1577 |

Documentation

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



OHDSI/QueryLibrary documentation built on Aug. 1, 2023, 5:42 a.m.