Skip to main content

CMS ICD

CI Documentation CMS catalog Python 3.12+ License: Apache-2.0

cms-icd provides version-aware, structured access to official CMS ICD-10-CM and ICD-10-PCS materials. Downloads and parsing are lazy: using diagnosis codes does not download PCS files, and reading a tabular list does not parse indexes or guideline PDFs.

Python 3.12 or newer is required. The package is tested on Python 3.12–3.14. CMS-backed discovery supports production ICD-10 releases from FY 2016 onward, including advertised intra-year updates.

Full documentation is available at ipolharvard.github.io/cms-icd.

The package also exposes the official ICD-9/ICD-10 General Equivalence Mappings without imposing an application-specific target-selection policy:

from cms_icd import GEMKnowledgeBase

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

Use a retrospectively corrected view when historical target-code validity must be preserved while later correction-only GEM revisions are incorporated:

gems = GEMKnowledgeBase.corrected_from_cms(
    fiscal_year=2016,
)
mapping = gems.cm.icd9_to_icd10.mapping("27906")
provenance = gems.cm.icd9_to_icd10.provenance("27906")

The same exact and retrospectively corrected views apply to procedure GEMs through gems.pcs. The package also exports the stable ordered ICD10_PCS_CHARACTERS alphabet for consumers that need a complete, fold-independent PCS vocabulary.

The correction horizon defaults to FY2018, the final CMS GEM release, and can be overridden explicitly for a narrower audit. A source stops accepting later revisions when its mapping encounters an introduced or retired source/target code.

Installation

Install the published package with uv:

uv add cms-icd

For development, install an editable checkout:

uv pip install -e /path/to/cms-icd

Choosing a release

Select the release using the date that controls coding:

from datetime import date

from cms_icd import ICD10KnowledgeBase

icd = ICD10KnowledgeBase.for_date(
    date(2026, 5, 1),
    cache_dir="data/cms_icd",
)
cm = icd.cm
code = cm["I10"]  # downloads and parses CM tabular material on first use

Use the discharge date for inpatient ICD-10-CM and ICD-10-PCS, and the encounter or date of service for other ICD-10-CM coding.

For reproducible research, select an exact effective snapshot:

icd = ICD10KnowledgeBase.from_cms(
    fiscal_year=2026,
    release_date=date(2026, 4, 1),
    cache_dir="data/cms_icd",
)

CMS commonly publishes an October release and an April 1 update. Materials not changed in an update are inherited from the latest earlier revision in that fiscal year. CMS does not always retain every historical revision, so snapshot selection is strict by default. Pass fallback="latest_for_fy" only when using the latest available fiscal-year material is scientifically acceptable.

The release guide documents supported guideline years and the exact October/April selection rules.

Offline and custom stores

An existing directory is not inspected until a material is requested:

>>> from datetime import date
>>> from pathlib import Path
>>> from tempfile import TemporaryDirectory
>>> from cms_icd import ICD10KnowledgeBase
>>> with TemporaryDirectory() as directory:
...     kb = ICD10KnowledgeBase.from_directory(
...         directory,
...         fiscal_year=2026,
...         release_date=date(2025, 10, 1),
...     )
...     repr(kb)
'ICD10KnowledgeBase(release=Release(fiscal_year=2026, release_date=datetime.date(2025, 10, 1)), loaded=[])'

Small custom or synthetic stores can be supplied directly:

>>> from cms_icd import Code, ICD10CMKnowledgeBase
>>> from cms_icd.models import Node
>>> from cms_icd.stores import TabularStore
>>> root = Node("cm", "cm", children_ids=("I10",))
>>> code = Code("I10", "I10", "Essential hypertension", parent_id="cm")
>>> tabular = TabularStore({"cm": root, "I10": code}, {"I10": "I10"}, ("cm",))
>>> cm = ICD10CMKnowledgeBase.from_stores(tabular=tabular)
>>> cm["I10"].description
'Essential hypertension'
>>> cm.get_leaves("cm")
['I10']

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 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

Normal tests are offline. make test-live accesses CMS and must be run only when live integration testing is explicitly intended.

CMS compatibility is validated in separate catalog, fresh-current, historical, and manual exhaustive lanes. See the testing strategy.

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.0.tar.gz (42.4 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.0-py3-none-any.whl (37.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cms_icd-0.1.0.tar.gz
  • Upload date:
  • Size: 42.4 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.0.tar.gz
Algorithm Hash digest
SHA256 69f29d204b2b957a0d93b6ebb8524f5149d18547f3980cca0322dcb14b81b1e0
MD5 8f95d631d514da19744ee6f3f3d40f61
BLAKE2b-256 9288da51e7b726ca2142d7e643470cbf9a0da2112137f125408c7c7be47ebe29

See more details on using hashes here.

Provenance

The following attestation bundles were made for cms_icd-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: cms_icd-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 37.1 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5fd1443f185f258d1b22e3b66df850e301871e1e09e3924dc284dd10de751252
MD5 460a7c61f7fd7cbbd7b298b9ae3d75fd
BLAKE2b-256 99a7a8416369cd8622922166c43057412eb338f0e260239d08f3f15046e8cc47

See more details on using hashes here.

Provenance

The following attestation bundles were made for cms_icd-0.1.0-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

0.1.1

2 files

This release

0.1.0 This release

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