inspectomop.queries.drug.ingredients_for_drug_concept_ids¶
- inspectomop.queries.drug.ingredients_for_drug_concept_ids(concept_ids, inspector, return_columns=None)¶
Get ingredients for brand or generic drug concept_ids.
- Parameters:
concept_id (list of int) – concept_ids corresponding to brand or generic drug concept_ids
inspector (inspectomop.inspector.Inspector)
return_columns (list of str, optional) –
optional subset of columns to return from the query
columns : [‘drug_concept_id’, ‘drug_name’, ‘drug_concept_code’, ‘drug_concept_class’, ‘ingredient_concept_id’, ‘ingredient_name’, ‘ingredient_concept_code’, ‘ingredient_concept_class’]
- Returns:
results
- Return type:
Notes
Original SQL
- D03: Find ingredients of a drug::
- SELECT
D.Concept_Id drug_concept_id, D.Concept_Name drug_name, D.Concept_Code drug_concept_code, D.Concept_Class_id drug_concept_class, A.Concept_Id ingredient_concept_id, A.Concept_Name ingredient_name, A.Concept_Code ingredient_concept_code, A.Concept_Class_id ingredient_concept_class
- FROM
full_201706_omop_v5.concept_ancestor CA, full_201706_omop_v5.concept A, full_201706_omop_v5.concept D
- WHERE
CA.descendant_concept_id = D.concept_id AND CA.ancestor_concept_id = A.concept_id AND LOWER(A.concept_class_id) = ‘ingredient’ AND sysdate BETWEEN A.VALID_START_DATE AND A.VALID_END_DATE AND sysdate BETWEEN D.VALID_START_DATE AND D.VALID_END_DATE AND CA.descendant_concept_id IN (939355, 19102189, 19033566)