During my translation of ICD9CM and ICD10CM encounter based conditions, I ran across several codes that are both in the ICD9 and 10 code sets. Our source tables do not inform us of which code set is being used, other than local knowledge that everything is ICD9 or 10. From my preamble above, I am having to make some interesting
logic to find the correct concept_id, which appears to be within a rounding error of 100%, at least for our internal data.
I am not asking for a fix, I am posting this as I would have saved hours on researching this if I could have found this here, or for that matter, anywhere that a search engine would have crawled to.
Here is the SQL that I am basing one of my bridge tables on:
SELECT ax.concept_code,
c3.vocabulary_id AS icd9_vocab, c3.domain_id AS icd9_domain, c3.concept_name AS icd9_desc,
c4.vocabulary_id AS icd10_vocab, c4.domain_id AS icd10_domain, c4.concept_name AS icd10_desc
FROM
(
SELECT c1.concept_code FROM concept (NOLOCK) c1 WHERE c1.vocabulary_id = 'ICD9CM'
INTERSECT
SELECT c2.concept_code FROM concept (NOLOCK) c2 WHERE c2.vocabulary_id = 'ICD10CM'
)ax
INNER JOIN concept (NOLOCK) c3
ON ax.concept_code = c3.concept_code AND c3.vocabulary_id = 'ICD9CM'
INNER JOIN concept (NOLOCK) c4
ON ax.concept_code = c4.concept_code AND c4.vocabulary_id = 'ICD10CM'
ORDER BY ax.concept_code;