This query is used to count all drugs (drug_concept_id) across all drug exposure records stratified by condition (relevant_condition_concept_id). The input to the query is a value (or a comma-separated list of values) of a drug_concept_id and a relevant_condition_concept_id. If the input is omitted, all existing value combinations are summarized.
The following is a sample run of the query. The input parameters are highlighted in blue
SELECT
drug_concept_id,
COUNT(1) AS drugs_count,
condition_concept_id AS relevant_condition_concept_id
FROM @cdm.drug_exposure
INNER JOIN @cdm.condition_occurrence
ON drug_exposure.visit_occurrence_id = condition_occurrence.visit_occurrence_id
AND drug_exposure.person_id = condition_occurrence.person_id
-- Filter by input drug_concept_id
WHERE drug_concept_id in (906805, 1517070, 19010522)
-- filter by input condition_concept_id
AND condition_concept_id in (26052, 258375)
GROUP BY condition_concept_id, drug_concept_id;
| Parameter | Example | Mandatory | Notes | | --- | --- | --- | --- | | list of drug_concept_id | 906805, 1517070, 19010522 | Yes | | list of relevant_condition_concept_id | 26052, 258375 | Yes |
| Field | Description | | --- | --- | | drug_concept_id | A foreign key that refers to a standard concept identifier in the vocabulary for the drug concept. | | relevant_condition_concept_id | A foreign key to the predefined concept identifier in the vocabulary reflecting the condition that was the cause for initiation of the procedure. Note that this is not a direct reference to a specific condition record in the condition table, but rather a condition concept in the vocabulary | | Count | The number of individual drug exposure occurrences used to construct the drug era. |
| Field | Description | | --- | --- | | drug_concept_id | 1517070| | relevant_condition_concept_id | 26052 | | Count | 78 |
https://github.com/OHDSI/CommonDataModel/wiki/
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.