GEM API
cms_icd.gems.GEMKnowledgeBase
GEMKnowledgeBase(provider: MaterialProvider, *, correction_providers: tuple[MaterialProvider, ...] = ())
A CMS fiscal-year GEM release with independently lazy CM and PCS views.
Source code in src/cms_icd/gems.py
from_cms
classmethod
Create a lazy GEM selector for an official CMS fiscal year.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fiscal_year
|
int
|
Official CMS GEM fiscal year. |
required |
cache_dir
|
str | Path | None
|
Persistent artifact cache directory. |
None
|
offline
|
bool
|
Require the catalog and artifacts to already be cached. |
False
|
Source code in src/cms_icd/gems.py
corrected_from_cms
classmethod
corrected_from_cms(fiscal_year: int, *, corrections_through_fiscal_year: int = 2018, cache_dir: str | Path | None = None, offline: bool = False) -> Self
Create GEMs using historical vocabulary and later safe corrections.
Each source remains on the requested fiscal year's vocabulary. Later complete row sets are adopted only until that source encounters an introduced or retired source/target code. Corrections are reviewed through FY2018 by default, the last CMS GEM release.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fiscal_year
|
int
|
Historical vocabulary fiscal year. |
required |
corrections_through_fiscal_year
|
int
|
Last GEM release considered for safe corrections. |
2018
|
cache_dir
|
str | Path | None
|
Persistent artifact cache directory shared by all releases.
|
None
|
offline
|
bool
|
Require the catalog and artifacts to already be cached. |
False
|
Source code in src/cms_icd/gems.py
from_directory
classmethod
Create a knowledge base from locally supplied CMS-format GEM files.
Source code in src/cms_icd/gems.py
__repr__
Return a representation without acquiring any GEM material.
Source code in src/cms_icd/gems.py
cms_icd.gems.GEMSystemView
GEMSystemView(provider: MaterialProvider | None, system: str, *, icd9_to_icd10: GEMStore | None = None, icd10_to_icd9: GEMStore | None = None, correction_providers: tuple[MaterialProvider, ...] = ())
Lazy bidirectional GEMs for one ICD-10 system (CM or PCS).
Source code in src/cms_icd/gems.py
icd9_to_icd10
property
Return mappings from ICD-9-CM to ICD-10-CM or ICD-10-PCS.
icd10_to_icd9
property
Return mappings from ICD-10-CM or ICD-10-PCS to ICD-9-CM.
from_stores
classmethod
from_stores(system: str, *, icd9_to_icd10: GEMStore | None = None, icd10_to_icd9: GEMStore | None = None) -> Self
Construct a view from prebuilt stores for custom sources or tests.
Source code in src/cms_icd/gems.py
__repr__
Return a representation without loading mappings.