-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RxNorm Extension buider changes #421
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,44 +122,7 @@ JOIN concept c ON c.concept_id = r.concept_id_2 | |
'RxNorm', | ||
'RxNorm Extension', | ||
'UCUM' | ||
) | ||
|
||
UNION ALL | ||
|
||
SELECT DISTINCT c1.concept_code AS concept_code_1, | ||
c1.vocabulary_id AS vocabulary_id_1, | ||
r.concept_id_2 AS concept_id_2, | ||
1 AS precedence, | ||
NULL::NUMERIC AS conversion_factor | ||
FROM concept c1 | ||
JOIN concept_relationship r ON r.concept_id_1 = c1.concept_id | ||
AND r.relationship_id IN ( | ||
'Maps to', | ||
'Source - RxNorm eq' | ||
) | ||
AND r.invalid_reason IS NULL | ||
JOIN concept c2 ON c2.concept_id = r.concept_id_2 | ||
AND c2.invalid_reason IS NULL | ||
WHERE c1.vocabulary_id = ( | ||
SELECT dcs.vocabulary_id | ||
FROM drug_concept_stage dcs LIMIT 1 | ||
) | ||
AND c2.vocabulary_id IN ( | ||
'RxNorm', | ||
'RxNorm Extension' | ||
) | ||
AND c2.concept_class_id IN ( | ||
'Ingredient', | ||
'Dose Form', | ||
'Brand Name', | ||
'Supplier' | ||
) | ||
AND NOT EXISTS ( | ||
SELECT 1 | ||
FROM relationship_to_concept rtc | ||
WHERE rtc.concept_code_1 = c1.concept_code | ||
); | ||
|
||
); | ||
CREATE INDEX idx_rtc ON r_to_c (concept_code_1, concept_id_2); | ||
ANALYZE r_to_c; | ||
|
||
|
@@ -6408,10 +6371,11 @@ FROM maps_to m | |
JOIN ex e ON e.concept_id = m.to_id | ||
JOIN r_to_c rtc ON rtc.concept_code_1 = m.from_code | ||
JOIN concept dc ON dc.concept_id = rtc.concept_id_2 | ||
WHERE dc.vocabulary_id IN ( | ||
WHERE EXISTS ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ой. а разве так работает? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Да, это работает. @ekorchmar посоветовал так сделать. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. а он случайно не объяснил, зачем нам подзапрос, который всегда дает true? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WHERE dc.vocabulary_id = c_int.vocabulary_id Добавила условие |
||
SELECT c_int.vocabulary_id | ||
FROM concept c_int | ||
WHERE c_int.domain_id = 'Drug' | ||
WHERE dc.vocabulary_id = c_int.vocabulary_id | ||
AND c_int.domain_id = 'Drug' | ||
AND c_int.standard_concept = 'C' | ||
); | ||
|
||
|
@@ -6710,4 +6674,4 @@ DROP TABLE pack_name; | |
DROP SEQUENCE omop_seq; | ||
DROP TABLE rl; | ||
DROP TABLE ex; | ||
DROP TABLE xxx_replace; | ||
DROP TABLE xxx_replace; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it non-needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we made a mistake in one of the RxE releases there's no chance to fix it.
Anyway, when we populate relationship_to_concept we go through existing mappings and synomyms. So this step not only redundant but dangerous.