OHDSI Home | Forums | Wiki | Github

ICD9 codes that are procedures - mappings issue

While converting all our ICD9 codes to SNOMED codes using the query:

select source.concept_id as source_concept_id, source.concept_code as
source_concept_code, source.concept_name as source_concept_name,
target.concept_id as target_concept_id, target.concept_name as
target_concept_name, target.domain_id as target_domain_id
from
(
select concept_id, concept_name, concept_code
from concept
where vocabulary_id = ‘ICD9CM’ OR vocabulary_id = ‘ICD9Proc’
) source
inner join
concept_relationship
on source.concept_id = concept_relationship.concept_id_1
and concept_relationship.relationship_id = ‘Maps to’
inner join
concept target
on concept_relationship.concept_id_2 = target.concept_id
and target.standard_concept = ‘S’;

(provided to me here ICD9/CPT mappings to SNOMED for condition_occurrence table)

Produces incorrect mappings for ICD9 codes that are procedures as the ‘Maps to’ relationship is circular for many (possibly all of them) for example for ICD9 codes 15, 21 etc. Should this be the case? can we have ICD9Proc stuff in the Procedures table?

Looking into the relationship table I find: ICD9P - SNOMED eq which apparently does the correct mapping. Should I modify this query to use this relationship instead?

select source.concept_id as source_concept_id, source.concept_code as
source_concept_code, source.concept_name as source_concept_name,
target.concept_id as target_concept_id, target.concept_name as
target_concept_name, target.domain_id as target_domain_id, target.vocabulary_id as target_vocabulary_id
from
(
select concept_id, concept_name, concept_code
from concept
where vocabulary_id = ‘ICD9CM’ OR vocabulary_id = ‘ICD9Proc’
) source
inner join
concept_relationship
on source.concept_id = concept_relationship.concept_id_1
and concept_relationship.relationship_id = ‘ICD9P - SNOMED eq’
inner join
concept target
on concept_relationship.concept_id_2 = target.concept_id
and target.standard_concept = 'S;

This one seems to get all the procedures in SNOMED concept_id’s.

Thanks in advance @Christian_Reich, @Patrick_Ryan!

Can you add

where concept_relationship.invalid_reason is null

to your query?

I add it to the second query (my query) and still produces the mappings. If I add it to the first query, it still produces the circular references.

This also should not make a difference as the query looks for standard_concepts only.

The idea that the ICD9Procedure map to themselves is correct. Unlike using
SNOMED for conditions and RxNorm for drugs the vocabulary does not have a
single ‘standard’ vocabulary for procedures. So the procedure_concept_id
will be the same as the procedure_source_concept_id. Which is what you are
seeing the from your query using the ‘maps to’ relationship for ICD9
procedures.

1 Like

Ok, this indeed makes sense. Thanks for the explanation. I am concerned, however, on how to map them into the procedures table. Either leaving them as concept_id’s from the ICD9Proc vocabulary, or keeping with the standard of making all ICD9 codes into SNOMED concept_id’s.

Depends on the domain: I think all ICD9s (procs and CMs) will map to snomed in the condition table. Ont he other hand, some ICD9Proc are standard concepts, and so you’ll usethe conceptID for the ICD9 in the procedure table. I think the procedure table (and probably observation) is the domain that has the most diversity of ‘vocabularies’. I think you can find CPT4, HCPCS, ICD9Proc and snomed as standard concpets for the procedure domain. To find this out you can:

select vocabulary_id, count(*) from concept where domain_id = ‘Procedure’ and standard_concept=‘S’

1 Like

Indeed you make a great point on this. I think I will just hold off on re-mapping (only CPT and SNOMED) or leaving my stuff as-is (CPT and ICD9Proc) when @Christian_Reich says it is ok to do so :smile: Thanks for pointing this out @Chris_Knoll!

Yes, since most icd9 procedure codes are standard concepts, you needn’t map
them to another vocabulary.

1 Like

Thanks! I will write this down on my internal OHDSI standards list for future ETL’s.

This is wonderful. I don’t have to say anything. :smile:

Don and Chris and Patrick are right, @Juan_Banda. Just trust the mapping relationship. They tell you what to map to, even if it is the code itself.

Of course, don’t trust it and always check to help us keeping it clean.

t