# \[ANN\] ICD\_GEMs.jl: A Package to Translate Between ICD-9 and ICD-10 Codes

**URL:** <https://discourse.julialang.org/t/ann-icd-gems-jl-a-package-to-translate-between-icd-9-and-icd-10-codes/81679>\
**Category:** Package Announcements\
**Tags:** package, statistics, data, dataframes, arrays\
**Created:** [May 25, 2022, 9:29pm UTC](https://discourse.julialang.org/t/ann-icd-gems-jl-a-package-to-translate-between-icd-9-and-icd-10-codes/81679 "2022-05-25T21:29:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![PietroMonticone](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pietromonticone/32/44881_2.png) [@PietroMonticone](https://discourse.julialang.org/u/PietroMonticone)\
**Post date:** [May 25, 2022, 9:29pm UTC](https://discourse.julialang.org/t/ann-icd-gems-jl-a-package-to-translate-between-icd-9-and-icd-10-codes/81679/1 "2022-05-25T21:29:05Z")

</div>

We’re glad to announce [ICD\_GEMs.jl](https://github.com/InPhyT/ICD_GEMs.jl): a package that allows to translate ICD-9 codes in ICD-10 and viceversa via the General Equivalence Mappings ([GEMs](https://www.asco.org/practice-policy/billing-coding-reporting/icd-10/general-equivalence-mappings-gems)) of the International Classification of Diseases ([ICD](https://www.who.int/standards/classifications/classification-of-diseases)).

The package exports the [latest GEMs release](https://www.cdc.gov/nchs/icd/Comprehensive-Listing-of-ICD-10-CM-Files.htm) from the CDC and internally utilizes it to perform translations. To understand how GEMs work and the terminology and choices found throughout this package, please read the official documentation. It may be found in the package repository ([here](https://github.com/InPhyT/ICD_GEMs.jl/blob/main/data/Dxgem_guide_2018.pdf) and [here](https://github.com/InPhyT/ICD_GEMs.jl/blob/main/data/GemsTechDoc_2018.pdf)), or it may be downloaded, together with the GEMs, from the [CDC’s website](https://ftp.cdc.gov/pub/Health_Statistics/NCHS/Publications/ICD10CM/2018/Dxgem_2018.zip).

GEMs and applied mappings are represented by the package via a custom type `GEM`, and once a GEM (or an applied mapping) has been loaded (here we load an ICD10 → ICD9 GEM from a CDC-formatted .txt source file) :

```julia
using ICD_GEMs
path = "path/to/cdc_txt_file"
direction = "I10_I9" # If the GEM translates from ICD-10 to ICD-9, otherwise "I9_I10"
GEM_I10_I9_dictionary = get_GEM_dictionary_from_cdc_gem_txt(path, direction) # Or get_GEM_dictionary_from_cdc_gem_txt(path, direction)

```

It can be applied to perform custom translations:

```julia
# Translate codes from ICD-10 to ICD-9
ICD_10_neoplasms = ["C00-D48"] # This is equivalent as explicitly specifiying all codes from C00.XX to D48.XX separated by commas
ICD_9_neoplasm = execute_applied_mapping(GEM_I10_I9_dictionary, ICD_10_neoplasms)

```

Notice that the package supports the `-` notation between pairs of codes, which is equivalent to specifying all codes in between separated by commas.

More complex translations, involving both single codes and ranges with arbitrary precision on both ends, can be performed:

```julia
execute_applied_mapping(GEM_I10_I9_dictionary, ["I60-I661", "I670", "I672-I679"])

```

For more information, please consider reading the [documentation](https://inphyt.github.io/ICD_GEMs.jl/dev).

[Discussions](https://github.com/InPhyT/ICD_GEMs.jl/discussions), [issues](https://github.com/InPhyT/ICD_GEMs.jl/issues) and [PRs](https://github.com/InPhyT/ICD_GEMs.jl/pulls) are always welcome!

## References

- Butler (2007), [ICD-10 General Equivalence Mappings: Bridging the Translation Gap from ICD-9](https://library.ahima.org/doc?oid=74265#.Ynre9i8RoiM), _Journal of AHIMA_
- CMS (2018), [2018 ICD-10 CM and GEMs](https://www.cms.gov/Medicare/Coding/ICD10/2018-ICD-10-CM-and-GEMs)
- NCHS-CDC (2018), [Diagnosis Code Set General Equivalence Mappings: ICD-10-CM to ICD-9-CM and ICD-9-CM to ICD-10-CM](https://ftp.cdc.gov/pub/health_statistics/nchs/publications/ICD10CM/2018/Dxgem_guide_2018.pdf)
- NCHS-CDC (2022), [Comprehensive Listing ICD-10-CM Files](https://www.cdc.gov/nchs/icd/Comprehensive-Listing-of-ICD-10-CM-Files.htm) (download General Equivalence Mappings [here](https://ftp.cdc.gov/pub/Health_Statistics/NCHS/Publications/ICD10CM/2018/Dxgem_2018.zip))

## Contacts

| Author | GitHub | Twitter | Discourse |
| --- | --- | --- | --- |
| Pietro Monticone | [@pitmonticone](https://github.com/pitmonticone) | [@PietroMonticone](https://twitter.com/PietroMonticone) | [@PietroMonticone](https://discourse.julialang.org/u/PietroMonticone) |
| Claudio Moroni | [@ClaudMor](https://github.com/ClaudMor) | [@Claudio\_\_Moroni](https://twitter.com/Claudio__Moroni) | [@claudio20497](https://discourse.julialang.org/u/claudio20497) |

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [May 25, 2022, 11:56pm UTC](https://discourse.julialang.org/t/ann-icd-gems-jl-a-package-to-translate-between-icd-9-and-icd-10-codes/81679/2 "2022-05-25T23:56:32Z")

</div>

Quick suggestion if there is time: rename the package to ICDGEMs.jl if there is time. It is not common to use underscores in package names.

---

<div class="post-metadata">

**Author:** ![PietroMonticone](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pietromonticone/32/44881_2.png) [@PietroMonticone](https://discourse.julialang.org/u/PietroMonticone)\
**Post date:** [May 26, 2022, 9:34am UTC](https://discourse.julialang.org/t/ann-icd-gems-jl-a-package-to-translate-between-icd-9-and-icd-10-codes/81679/4 "2022-05-26T09:34:24Z")

</div>

Thank you very much for the feedback.

We’ll certainly consider changing name in the near future.

---

<div class="post-metadata">

**Author:** ![TheCedarPrince](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thecedarprince/32/17323_2.png) [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Post date:** [May 26, 2022, 3:07pm UTC](https://discourse.julialang.org/t/ann-icd-gems-jl-a-package-to-translate-between-icd-9-and-icd-10-codes/81679/6 "2022-05-26T15:07:28Z")

</div>

How exciting @PietroMonticone and congrats on the package release!  
This looks super interesting and something I may experiment with in the near future.  
Do you have any interest in hosting it in [JuliaHealth](https://juliahealth.org/)?  
I would be happy to help migrate it over there with you as it could help with discovery while you continue to maintain full permissions to the repo.

~ tcp 🌳

---

<div class="post-metadata">

**Author:** ![PietroMonticone](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pietromonticone/32/44881_2.png) [@PietroMonticone](https://discourse.julialang.org/u/PietroMonticone)\
**Post date:** [May 26, 2022, 3:56pm UTC](https://discourse.julialang.org/t/ann-icd-gems-jl-a-package-to-translate-between-icd-9-and-icd-10-codes/81679/7 "2022-05-26T15:56:10Z")

</div>

Hi @TheCedarPrince, thank you very much for your interest in this package that I’ve co-authored with @claudio20497.

It’d be great to host ICD\_GEMs.jl in the JuliaHealth organization.

What should we do next? Enter the GitHub organization? How can we help?

---

<div class="post-metadata">

**Author:** ![TheCedarPrince](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thecedarprince/32/17323_2.png) [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Post date:** [May 26, 2022, 4:21pm UTC](https://discourse.julialang.org/t/ann-icd-gems-jl-a-package-to-translate-between-icd-9-and-icd-10-codes/81679/8 "2022-05-26T16:21:32Z")

</div>

Hey @PietroMonticone !

Not too much needs to be done actually - shouldn’t take more than an hour or so.  
Would you be willing to coordinate setting a time to have a chat (or one of the coauthors such as @claudio20497 ) over email?  
My email is [jacobszelko@gmail.com](mailto:jacobszelko@gmail.com) and I could explain the process and if you are comfortable with things, we could go ahead with moving the repository to JuliaHealth all in the same call. 🙂

---

<div class="post-metadata">

**Author:** ![PietroMonticone](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pietromonticone/32/44881_2.png) [@PietroMonticone](https://discourse.julialang.org/u/PietroMonticone)\
**Post date:** [May 26, 2022, 5:05pm UTC](https://discourse.julialang.org/t/ann-icd-gems-jl-a-package-to-translate-between-icd-9-and-icd-10-codes/81679/9 "2022-05-26T17:05:10Z")

</div>

Yes, it sounds good!

Please feel free to write your preferred dates and times to our collective email address [inphyt@gmail.com](mailto:inphyt@gmail.com).
