@lowlysre/icd-10-cm 2.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,12 +4,13 @@
4
4
  <img src="assets/hero.png" alt="icd-10-cm hero" width="640">
5
5
  </p>
6
6
 
7
- ![NPM Version](https://img.shields.io/npm/v/%40lowlysre%2Ficd-10-cm)
7
+ [![NPM Version](https://img.shields.io/npm/v/%40lowlysre%2Ficd-10-cm)](https://www.npmjs.com/package/@lowlysre/icd-10-cm)
8
+ [![downloads](https://img.shields.io/npm/dm/@lowlysre/icd-10-cm)](https://npm-stat.com/charts.html?package=@lowlysre/icd-10-cm)
9
+ [![jsDelivr](https://data.jsdelivr.com/v1/stats/packages/npm/@lowlysre/icd-10-cm/badge?style=rounded)](https://www.jsdelivr.com/package/npm/@lowlysre/icd-10-cm)
8
10
  [![Test](https://github.com/lowlysre/icd-10-cm/actions/workflows/test.yml/badge.svg)](https://github.com/lowlysre/icd-10-cm/actions/workflows/test.yml)
9
11
  [![sustainable-npm](https://img.shields.io/badge/sustainable--npm-🌱-blue?style=flat)](https://github.com/lowlysre/sustainable-npm)
10
- [![immutable releases](https://img.shields.io/badge/immutable%20releases-active-green?logo=github)](https://github.com/lowlysre/icd-10-cm/releases)
11
12
 
12
- A data package containing the latest ICD-10 CM codes and descriptions, types included!
13
+ A data package containing the FY2027 ICD-10-CM diagnosis codes and descriptions (effective October 1, 2026), types included!
13
14
 
14
15
  - ⚡ Fast, lookups via dictionary of minified json
15
16
  - 🔒 Secure, a zero dependency package with provenance
@@ -41,26 +42,68 @@ if (!maybeDescription) {
41
42
  const normalized = normalizeICD10Code(" a00.1 "); // "A001"
42
43
  ```
43
44
 
44
- ## Data Source
45
+ CommonJS works too:
46
+
47
+ ```js
48
+ const { getICD10Description } = require("@lowlysre/icd-10-cm");
49
+ ```
50
+
51
+ ### Checking which release is bundled
52
+
53
+ `ICD10_CM_RELEASE` describes the code set shipped in the installed version, so an app can log it, show it, or fail fast when it expects a different year:
54
+
55
+ ```ts
56
+ import { ICD10_CM_RELEASE } from "@lowlysre/icd-10-cm";
57
+
58
+ ICD10_CM_RELEASE.fiscalYear; // 2027
59
+ ICD10_CM_RELEASE.effectiveDate; // "2026-10-01"
60
+ ICD10_CM_RELEASE.codeCount; // 74879
61
+ ```
62
+
63
+ ## API
45
64
 
46
- [www.cdc.gov/nchs](https://www.cdc.gov/nchs/icd/icd-10-cm/files.html)
65
+ - `getICD10Description(code)` (also the default export) returns the description for a code, or `undefined` when the code isn't in the bundled release. Input is normalized first.
66
+ - `normalizeICD10Code(code)` trims whitespace, strips dots, and uppercases, matching the dataset keys.
67
+ - `ICD10_CM_RELEASE` is a frozen object with the bundled release's `fiscalYear`, `effectiveDate`, and `codeCount`.
68
+ - `ensureICD10DatasetLoaded(data)` returns `data`, or throws when it's empty or missing.
69
+ - Types: `ICD10Dictionary`, `ICD10CMRelease`.
47
70
 
48
- ## Development
71
+ The package supports Node.js 22 or later.
72
+
73
+ ## Raw data via CDN
74
+
75
+ The dataset is a flat JSON object of normalized code to description. Browsers and other runtimes can fetch it straight from jsDelivr without installing anything:
76
+
77
+ ```js
78
+ const res = await fetch(
79
+ "https://cdn.jsdelivr.net/npm/@lowlysre/icd-10-cm@3/data/icd10.min.json",
80
+ );
81
+ const codes = await res.json();
82
+ codes["A000"]; // "Cholera due to Vibrio cholerae 01, biovar cholerae"
83
+ ```
84
+
85
+ Pin the major version in the URL so the code set only changes when you choose to upgrade.
86
+
87
+ ## Versioning
88
+
89
+ Each new ICD-10-CM release (the annual October 1 update, and any April 1 update) ships as a new major version. A release can delete or redefine codes, so a caret range like `^3.0.0` never silently changes the code set underneath an app. Upgrade the major version deliberately to pick up a new year.
90
+
91
+ Minor and patch versions contain code and tooling changes only; the data stays the same.
92
+
93
+ ## Data Source
49
94
 
50
- For regenerating `data/icd10.min.json` via `npm run parse-icd`, use Node.js v22+ (required for `--experimental-strip-types`).
95
+ ICD-10-CM is maintained by the CDC's National Center for Health Statistics (NCHS), which publishes the code files for free public use: [ICD-10-CM files](https://www.cdc.gov/nchs/icd/icd-10-cm/files.html). The MIT license covers this package's code.
51
96
 
52
- ### Updating the ICD-10-CM data
97
+ This package is not affiliated with or endorsed by the CDC, NCHS, or CMS.
53
98
 
54
- CDC/NCHS publishes a new code set annually (effective October 1) and occasionally a mid-year update (effective April 1). Check the [CDC files page](https://www.cdc.gov/nchs/icd/icd-10-cm/files.html) or the [CMS ICD-10 page](https://www.cms.gov/medicare/coding-billing/icd-10-codes) for the latest "Code Descriptions in Tabular Order" archive.
99
+ ## Contributing
55
100
 
56
- 1. Download the latest Code Descriptions in Tabular Order zip
57
- 2. Extract `icd10cm_codes_<year>.txt` and save it as `scripts/icd10cm.txt` (format: code, whitespace, description per line)
58
- 3. Run `npm run parse-icd` to regenerate `data/icd10.min.json`
59
- 4. Run `npm test` and verify the reported code count matches the addenda
60
- 5. Bump the package version and publish
101
+ See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for setup and the yearly data update steps.
61
102
 
62
103
  ## Versions
63
104
 
105
+ - v3.1.0 - `ICD10_CM_RELEASE` export with the bundled fiscal year, effective date, and code count. Node.js 22+ declared in `engines`, `package.json` exported, expanded npm keywords. API, CDN, and versioning docs, plus contributing and security guides
106
+ - v3.0.0 - Data updated to the October 1, 2026 ICD-10-CM release (74,879 codes, from the FY2027 set)
64
107
  - v2.0.0 - Data updated to the April 1, 2026 ICD-10-CM release (74,719 codes, from the FY2024 set). TypeScript 7 (native compiler) toolchain, ESLint replaced with oxlint + Prettier, dropped tsup for plain tsc (zero-bundler dual ESM/CJS), dataset shipped once and lazy-loaded (~50% smaller install, faster imports), fixed broken `require()` entry point
65
108
  - v1.1.5 - Dependency and toolchain maintenance
66
109
  - v1.1.0 - Migrated tests from Jest to Node's built-in test runner, TypeScript 6 toolchain