   select drug_id as did, count(*) as cnt from r_drug_ing group by drug_id
 ;
 -- Set all counts for Ingredient and Clinical Drug Comp to null, so in comparisons it can match whatever number necessary. Reason is that, like ingredients, Clinical Drug Comp is always only one ingredient
-update r_ing_count set cnt=null where did in (select concept_id from devv5.concept where concept_class_id in ('Clinical Drug Comp', 'Ingredient'));
+update r_ing_count set cnt=null where did in (select concept_id from concept where concept_class_id in ('Clinical Drug Comp', 'Ingredient'));
 
 create index x_r_drug_ing on r_drug_ing(drug_id, ing_id) nologging;
 

    r_ds.numerator_value, r_ds.numerator_unit_concept_id,
    nvl(r_ds.denominator_value, 1) as denominator_value, -- Quantified have a value in the denominator, the others haven't.
    r_ds.denominator_unit_concept_id
  from devv5.drug_strength r_ds 
)
-- Create variables div as r amount / q amount, and unit as 1 for matching and 0 as non-matching 
select 

-- Create table containing ingredients for each drug
create table r_drug_ing nologging as
  select de.concept_id as drug_id, an.concept_id as ing_id
  from concept_ancestor a 
  join concept an on a.ancestor_concept_id=an.concept_id and an.concept_class_id='Ingredient' 
    and an.vocabulary_id in ('RxNorm') -- to be expanded as new vocabs are added
  join concept de on de.concept_id=a.descendant_concept_id  
    and de.vocabulary_id in ('RxNorm')
;
-- Remove unparsable Albumin products that have no drug_strength entry: Albumin Human, USP 1 NS
