Here is a query that you can get to the descendants using the ingredient name based on the standard vocabulary.
select ca.descendant_concept_id from concept_ancestor ca
inner join concept c
on ca.ancestor_concept_id = c.concept_id
where lower(c.concept_name) in (âdiclofenacâ, âmeloxicamâ,âibuprofenâ, âoxaprozinâ)
and c.standard_concept = âSâ
and c.concept_class_id = âIngredientâ
This is the query from the OMOP tutorial that shows you how to query using the concept_ancestor table. This is only showing you how to query on one ingredient concept_ID. You can change it to an âINâ statement for multiple ingredient concept_ids.
The query is looking for people who took any drugs that has the ingredient of warfarin with a 6 month washout period before the first exposure to warfarin.
WITH CTE_DRUG_INDEX AS (
SELECT de.PERSON_ID, MIN(de.DRUG_EXPOSURE_START_DATE) AS INDEX_DATE
FROM DRUG_EXPOSURE de
WHERE de.DRUG_CONCEPT_ID IN (
SELECT DESCENDANT_CONCEPT_ID
FROM CONCEPT_ANCESTOR WHERE ANCESTOR_CONCEPT_ID = 1310149 /warfarin/
)
GROUP BY de.PERSON_ID
)
SELECT i.PERSON_ID, i.INDEX_DATE, op.OBSERVATION_PERIOD_START_DATE, op.OBSERVATION_PERIOD_END_DATE,
(i.INDEX_DATE-op.OBSERVATION_PERIOD_START_DATE) AS DAYS_BEFORE_INDEX
FROM CTE_DRUG_INDEX i
JOIN OBSERVATION_PERIOD op
ON op.PERSON_ID = i.PERSON_ID
AND i.INDEX_DATE BETWEEN op.OBSERVATION_PERIOD_START_DATE AND op.OBSERVATION_PERIOD_END_DATE
WHERE (i.INDEX_DATE-op.OBSERVATION_PERIOD_START_DATE) >= 180
ORDER BY i.PERSON_ID