I’m trying to make a lookup table from drug exposure drug_concept_ids to atc3 classes. I understand some drugs will have more than one atc3 class, but I don’t think I’m doing this quite right. For instance, I got one drug (Acetaminophen 250 MG / Caffeine 30 MG / Chlorpheniramine 2 MG / Hydrocodone Bitartrate 5 MG / Phenylephrine 10 MG Oral Tablet [Hycomine Compound]) that came back with 10 atc3 classes including AGENTS FOR TREATMENT OF HEMORRHOIDS AND ANAL FISSURES FOR TOPICAL USE and COUGH SUPPRESSANTS, EXCL. COMBINATIONS WITH EXPECTORANTS which seems both unlikely and kind of gross.
Here’s the query. The last join is just so I can limit to the list I made with drugs that have lots of atc3 classes. Otherwise I’m just trying to use concept_ancestor to link from standard drug_concept_ids to atc3 classes.
select atc3s.atc3s,
ccd.concept_id drug_concept_id, ccd.concept_name drug_concept_name, ccd.concept_class_id drug_class_id,
atc.concept_id atc_concept_id, atc.concept_name atc_concept_name
from concept atc
join concept_ancestor ca on atc.concept_id = ca.ancestor_concept_id
join concept ccd on ca.descendant_concept_id = ccd.concept_id
and ccd.standard_concept = 'S'
and ccd.invalid_reason is null
join drug_ids_with_many_atc3s atc3s on ccd.concept_id = atc3s.drug_concept_id
where atc.concept_class_id = 'ATC 3rd'
order by 4,3,6
The drug I mentioned is apparently an oral tablet, so it’s not topical but may contain an ingredient that’s used in a topical drug and that’s how that class is being caught. Maybe this kind of issue is uncommon enough that I shouldn’t worry about it, but I just wanted to check if there’s some correct way to do this that I’m missing.
Thanks,
Sigfried