OHDSI / Vocabulary-v5.0

Build process for the OHDSI Standardized Vocabularies. Currently not available as independent release.
The Unlicense
212 stars 73 forks source link

Deprecated concepts are related to non-deprecated concepts in RxNorm/RxE #951

Open thisismexp opened 6 months ago

thisismexp commented 6 months ago

Describe the problem in content or desired feature There are a number of deprecated concepts (invalid_reason U or D) in RxNorm and RxE that are related to other non-deprecated concepts. A simple search revealed about 300k such relationships.

How to find it

--sqlite
WITH invalids AS (
    SELECT *
    FROM CONCEPT
    WHERE vocabulary_id IN ('RxNorm', 'RxNorm Extension')
    AND invalid_reason != ''
)
SELECT invalids.concept_id, invalids.concept_name, invalids.concept_class_id, invalids.invalid_reason,
       cr.relationship_id,
       c.concept_class_id, c.concept_name, c.concept_class_id, c.invalid_reason
FROM invalids
INNER JOIN CONCEPT_RELATIONSHIP cr
    ON cr.concept_id_1 = invalids.concept_id
    AND cr.invalid_reason = ''
    AND cr.relationship_id NOT IN ('Maps to', 'Concept replaced by')
INNER JOIN CONCEPT c
    ON cr.concept_id_2 = c.concept_id
    AND c.vocabulary_id IN ('RxNorm', 'RxNorm Extension')
    AND c.invalid_reason = ''
;

Expected adjustments
Invalidate the related concepts of invalid ones, or if remapped, replace the concept relationship accordingly.

Additional context - Example concept_id concept_name concept_class_id invalid_reason
41182488 Verapamil 80 MG Extended Release Oral Tablet [Falicard] Box of 96000 Branded Drug Box D

is related by relationship_id="Box of" to the valid concept:

concept_id concept_name concept_class_id invalid_reason
41119845 Verapamil 80 MG Extended Release Oral Tablet [Falicard] Branded Drug
aostropolets commented 6 months ago

Is there a specific problem you encounter with these relationships? Your example looks valid: there is a valid Falicard Branded Drug on the market but a box of 96K tablets of such a drug is highly implausible (hence was deemed an error and was deprecated).

cgreich commented 6 months ago

I think @thisismexp is complaining that there is a valid relationship to an invalid concept. When it should be also invalid. He is right of course, except there are situations when he isn't: When the relationship links an invalidated concept to a valid one, upgrading it.

We should add to our principles which relationships are permitted between concepts of different validity.

thisismexp commented 6 months ago

@cgreich Thanks for making that clear, i totally agree