Skip to content

Commit

Permalink
RxE qa
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexdavv authored Dec 17, 2020
1 parent 4389a84 commit 065121c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions RxNorm_E/manual_work/specific_qa/manual_checks_after_generic.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--Drug Standard concepts aren't linked to the Standard Drug Ingredients
--1893499
--19783 (1%)
SELECT c.vocabulary_id, c.concept_class_id, COUNT (*)
FROM concept c

WHERE c.domain_id = 'Drug'
AND c.standard_concept = 'S'
AND c.vocabulary_id IN ('RxNorm', 'RxNorm Extension')
AND c.concept_class_id NOT IN ('Ingredient')

AND NOT EXISTS (
SELECT 1
FROM concept_ancestor ca
JOIN concept c2
ON ca.ancestor_concept_id = c2.concept_id
AND c2.concept_class_id = 'Ingredient'
AND c2.domain_id = 'Drug'
AND c2.standard_concept = 'S'
WHERE ca.descendant_concept_id = c.concept_id
)
GROUP BY 1,2
;

0 comments on commit 065121c

Please sign in to comment.