Skip to main content

CMS ICD

PyPI CI Docs CMS source License DOI

cms-icd makes official CMS ICD-10 materials easy to use from Python. Look up ICD-10-CM diagnoses and ICD-10-PCS procedures, browse their hierarchies and indexes, read coding guidelines, and work with ICD-9/ICD-10 General Equivalence Mappings (GEMs).

Choose data by service date or by an exact CMS release. Files are downloaded from CMS only when needed and cached for later use.

Install

With uv:

uv add cms-icd

Or with pip:

pip install cms-icd

Look up ICD-10 codes

Use the date that controls coding for the encounter:

from datetime import date

from cms_icd import ICD10KnowledgeBase

icd = ICD10KnowledgeBase.for_date(date(2026, 5, 1))

diagnosis = icd.cm["I10"]
print(diagnosis.description)

Use the discharge date for inpatient ICD-10-CM and ICD-10-PCS. For other ICD-10-CM use cases, use the encounter or service date.

The knowledge base provides separate views for:

  • icd.cm: ICD-10-CM codes, hierarchy, index, and guidelines;
  • icd.pcs: ICD-10-PCS codes, hierarchy, index, and guidelines.

See the documentation for code navigation, index lookup, and guideline access.

Choose an exact release

Use from_cms() when you need a specific CMS fiscal-year revision:

from datetime import date

from cms_icd import ICD10KnowledgeBase

icd = ICD10KnowledgeBase.from_cms(
    fiscal_year=2026,
    release_date=date(2026, 4, 1),
)

CMS commonly starts a fiscal year with an October release and may publish an April update. If a material did not change in the update, cms-icd uses the most recent earlier material from the same fiscal year.

Release selection is strict by default. The release guide explains available years, midyear updates, and explicit fallback behavior.

Use General Equivalence Mappings

Access the official GEM rows and flags without losing alternatives or combination mappings:

from cms_icd import GEMKnowledgeBase

gems = GEMKnowledgeBase.from_cms(fiscal_year=2018)
entries = gems.cm.icd9_to_icd10["4280"]
mapping = gems.cm.icd9_to_icd10.mapping("4280")

Diagnosis mappings are available through gems.cm, and procedure mappings through gems.pcs. Each provides both ICD-9-to-ICD-10 and ICD-10-to-ICD-9 directions.

For historical GEMs with later CMS corrections, use:

gems = GEMKnowledgeBase.corrected_from_cms(fiscal_year=2016)

The library returns the official mapping structure and does not choose a preferred target for you. See the GEM guide for alternatives, combinations, flags, and correction history.

Configure caching and offline access

By default, downloaded CMS files are stored in the platform cache directory. Provide cache_dir to use a project, scratch, or shared location:

from datetime import date
from pathlib import Path

from cms_icd import ICD10KnowledgeBase

icd = ICD10KnowledgeBase.for_date(
    date(2026, 5, 1),
    cache_dir=Path("/shared/cache/cms_icd"),
)

After the selected files have been cached, set offline=True to prevent network access:

icd = ICD10KnowledgeBase.for_date(
    date(2026, 5, 1),
    cache_dir="/shared/cache/cms_icd",
    offline=True,
)

Use ICD10KnowledgeBase.from_directory() or GEMKnowledgeBase.from_directory() when you already manage the original CMS files yourself.

Citation and acknowledgment

If you use cms-icd in research or published work, please cite the software using CITATION.cff and acknowledge IPOL at MGH.

The version-independent project DOI is 10.5281/zenodo.21952934.

The source code is licensed under the Apache License 2.0. See NOTICE for attribution information.

Development

make install-dev
make test
make install-docs
make docs

See the development guide and testing guide for the available checks and CMS integration tests.

cms-icd is an independent open-source project. It is not affiliated with, endorsed by, or sponsored by the Centers for Medicare & Medicaid Services.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cms_icd-0.1.1.tar.gz (41.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cms_icd-0.1.1-py3-none-any.whl (36.6 kB view details)

Uploaded Python 3

File details

Details for the file cms_icd-0.1.1.tar.gz.

File metadata

  • Download URL: cms_icd-0.1.1.tar.gz
  • Upload date:
  • Size: 41.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for cms_icd-0.1.1.tar.gz
Algorithm Hash digest
SHA256 963332f9716ed9ac631ba6211b652951463a0ea56e9c2ed7cb0a47b7b38fd83c
MD5 6a8b22fc4f6f829c7ba20d99cca71264
BLAKE2b-256 71a1ab36e2569c281c0af1f65d2d7b100ead68def4e48c60436e33ea6bea8cc7

See more details on using hashes here.

Provenance

The following attestation bundles were made for cms_icd-0.1.1.tar.gz:

Publisher: publish.yml on ipolharvard/cms-icd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cms_icd-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cms_icd-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 36.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for cms_icd-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6f7de30464552b3df4d3867806717a4b28c2cd9c5e29394d9cc88e3fbdd9f466
MD5 0dc3e7ef32420500955d13218449537a
BLAKE2b-256 e3a69560888be31d27df291e1a79b31fca6f9617c257aaf6e401a7049368e7e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for cms_icd-0.1.1-py3-none-any.whl:

Publisher: publish.yml on ipolharvard/cms-icd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.2.0

2 files

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page