so you added to your package RxNorm Extension vocabulary and the query
atc.concept_id as atc_id, atc.concept_name as atc_name, atc.concept_code as atc_code, atc.concept_class_id as atc_class,
ndc.concept_id as atc_id, ndc.concept_name as ndc_name, ndc.concept_code as ndc_code, ndc.concept_class_id as ndc_class
from concept atc
join concept_ancestor a on a.ancestor_concept_id=atc.concept_id
join concept_relationship r on r.concept_id_1=a.descendant_concept_id and r.invalid_reason is null and r.relationship_id='Mapped from'
join concept ndc on ndc.concept_id=concept_id_2 and ndc.vocabulary_id='NDC'
I'm wondering, because it looks like the query doesn't affect the RxNorm Extension;
you take the ATC, then find its descendants - ATCs with lower level and RxNorm concepts
then use concept_relationships to find NDCs Mapped to RxNorm.
Logically if ATC goes to RxNorm Extension, it doesn't have RxNorm in this hierarchical branch anyway.
So there's now RxNorm Extension in this logical chain.