@cosyte/terminology 0.0.2 → 0.0.5

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/CHANGELOG.md CHANGED
@@ -11,6 +11,76 @@ this file is maintained by hand (Changesets handles the version bump and publish
11
11
 
12
12
  ### Fixed
13
13
 
14
+ - **`LICENSE` was unqualified MIT over a tree that also distributes third-party material**
15
+ (`TERMINOLOGY-LICENSE-THIRD-PARTY`, residuals 1 and 2 of `TERMINOLOGY-RESIDUALS`). The README had
16
+ already grown a "What is bundled" carve-out; the licence file had not, so the two consumer-facing
17
+ licence statements disagreed. The MIT text is unchanged and still covers this package's own code.
18
+ A `THIRD-PARTY MATERIALS` section is appended, stating for each item what is distributed and under
19
+ whose copyright: the **UCUM unit table** (`ucum-essence.xml` v2.2, revision-date 2024-06-17,
20
+ copyright 1999-2024 Regenstrief Institute, Inc., verbatim under the UCUM Copyright Notice and
21
+ License, embedded byte-for-byte in the build) with its grant recorded as **revocable**, its
22
+ no-different-standard and no-derivative-works restrictions, its warranty disclaimer and a pointer
23
+ to `vendor/ucum/NOTICE.md`, which ships in the tarball and remains the notice of record; the
24
+ **UCUM functional-test suite** (EPL v1.0, repository-only, not distributed on npm);
25
+ **`SYSTEM_IDENTITIES`**; the **SNOMED CT identifiers the crosswalk resolver names**; and
26
+ **RxNorm's relationship and term-type names**. The notice itself is deliberately untouched: it was
27
+ verified against `ucum.org/license` on 2026-07-30 and already carries all four things the licence
28
+ requires of a distributor.
29
+ The last of those closes the second residual. "The engine ships no RxNorm **content**" was
30
+ unscoped in the way the UCUM claim once was, because `RELA` / `RELA_INVERSE` / `TERM_TYPES` do
31
+ ship RxNorm's relationship and term-type names; every site now reads "no RxNorm **release**", the
32
+ same narrowing already applied to the code-system claim, and the names that do ship are named.
33
+ `Ships no SNOMED content` on the complex-map loader is narrowed to "no SNOMED CT release or
34
+ refset" for the same reason. **No engine behaviour, API surface or bundled content changes.**
35
+ Both surfaces that carry the claim move together, as they must: `README.md` and the package JSDoc
36
+ compiled into `dist/index.d.ts` / `dist/index.d.cts`, plus four `docs-content/` pages, two of
37
+ which carried a grammatically **closed** bundled-list that the new `LICENSE` would otherwise have
38
+ contradicted. The enumerated items are derived from the build, not from prose, and every list
39
+ reads "includes the following" rather than closing the set. Beyond the named constants,
40
+ individual SNOMED CT, ICD-10-CM and **RxNorm** identifiers ship inside the API documentation
41
+ examples, with their real names and term types, and those examples reach a consumer in three
42
+ places rather than one: `README.md`, the compiled declaration files, and the build's sourcemaps,
43
+ whose `sourcesContent` carries every source comment verbatim. No absolute negative is written
44
+ over those files: a draft said "no RxNorm release, drug concept or NDC is distributed", which the
45
+ build falsifies (`RXCUI` `316151` ships as "lisinopril 10 MG"), so the claim is scoped to the
46
+ release rather than reworded around it.
47
+ Gated by `test/license-third-party.test.ts` (bytes read with `node:fs`, never a `grep` pipeline):
48
+ the MIT grant is intact; the third-party section names the UCUM copyright holder, licence URL,
49
+ revocability, no-derivative-works restriction, warranty disclaimer and `NOTICE.md` pointer;
50
+ `LICENSE`, `README.md`, the package JSDoc and the four `docs-content/` pages all name the same
51
+ distributed items, so one surface cannot be updated while another is left contradicting it; no
52
+ prose file in `LICENSE`, `README.md`, `docs-content/` or **all** of `src/` contains the phrase
53
+ "RxNorm content" or "SNOMED content"; and every checked-in path in `package.json`'s `files`
54
+ exists, which is the check `0.0.1` lacked when it pointed consumers at a `NOTICE.md` the tarball
55
+ did not contain. The anchor list is explicit rather than inferred, so a sixth bundled item still
56
+ needs the anchors updated by hand.
57
+ That guard bans the **phrase**, not a determiner pattern, and the reason is recorded because it
58
+ was got wrong first: a version matching `no\s+(\*\*)?RxNorm(\*\*)?\s+content` put the optional
59
+ bold markers after the space, so it matched `no **RxNorm content` and missed `**no** RxNorm
60
+ content` — the form every historical instance actually took — and read green over the whole
61
+ pre-fix tree, 0 of 6 real forms firing. A self-test now asserts the matcher fires on all eight
62
+ historical spellings and stays quiet on the correct wording. The file list also **walks** `src/`
63
+ rather than naming files, because a hand-written list omitted `src/rxnorm/rela.ts` and
64
+ `src/rxnorm/tty.ts`, whose doc comments compile into the declaration files.
65
+
66
+ - **Three published documentation pages carried a link form that MDX cannot compile, and it stopped
67
+ docs.cosyte.com building for every package** (`TERMINOLOGY-MDX-AUTOLINK`). `docs-content/intro.md`,
68
+ `troubleshooting.md` and `concepts-archetype.md` linked the UCUM licence as the CommonMark autolink
69
+ `<https://ucum.org/license>`. `cosyte/docs` compiles fetched content as **MDX**, which is stricter:
70
+ it reads the `<` as the start of an element, `https` as a tag name and `:` as a namespace separator,
71
+ then fails on the `/` with `Unexpected character '/' (U+002F) before local name`. Docusaurus SSG
72
+ failure is **global**, so three lines in this package's tarball did not degrade one page, they
73
+ stopped the whole documentation site deploying, for all nine packages it hosts. It went live when
74
+ `0.0.2` published (2026-07-29T19:20Z) and broke the next push to that repository's `main`.
75
+ Rewritten as `[https://ucum.org/license](https://ucum.org/license)`, which renders identically and
76
+ is the form MDX's own error message recommends. **No engine behaviour, API surface or bundled
77
+ content changes.**
78
+ `README.md`, `vendor/ucum/NOTICE.md` and `scripts/generate-ucum-essence-data.ts` use the same
79
+ autolink form and are **deliberately untouched**: verified against the published `0.0.2` assets,
80
+ `docs-content.tar.gz` ships only the narrative pages plus `sidebars.json` and `source.tar.gz` ships
81
+ only `package.json` + `src/`, so nothing outside `docs-content/` reaches MDX, and the form renders
82
+ correctly on GitHub and the registry where those files are actually read.
83
+
14
84
  - **The package claimed to bundle no copyrighted content while bundling the UCUM table, and its
15
85
  attribution never reached the tarball** (`TERMINOLOGY-LICENSING-ACCURACY`). Four statements shipped
16
86
  in `0.0.1`, live on the registry and on docs.cosyte.com, that the tree falsifies:
@@ -126,6 +196,32 @@ has_ingredient IN`). RxNorm authors no such relationship in any release: the ing
126
196
  below is left as written: it records what the docs said at the time, hours before the release
127
197
  landed.)
128
198
 
199
+ ### Added
200
+
201
+ - **A gate over `docs-content/` that fails on an MDX-hostile link form**
202
+ (`test/docs-content-mdx-safety.test.ts`). A published release is immutable and the documentation
203
+ site re-fetches it indefinitely, so a bad link in a tarball cannot be recalled: fixing this
204
+ repository's `main` does nothing for the version that shipped it. The gate reports the offending
205
+ file and line with the replacement form, runs inside the required `ci / verify` context (so it
206
+ cannot be silently un-required by being split into its own job), and carries a **self-test** proving
207
+ the matcher can see a real autolink, so a green result cannot come from a pattern that matches
208
+ nothing. It reads bytes directly rather than shelling out to `grep`, which this repository has
209
+ already been burned by. Scoped to `docs-content/` only, for the reason above.
210
+ - **The README opens with the Cosyte mark, which follows the reader's color scheme.** A `<picture>`
211
+ block above the H1 offers a dark-ground tile behind a `prefers-color-scheme: dark` media query and
212
+ carries the light-ground tile as the inner `<img>`, so on a renderer that honors the switch the
213
+ mark sits on a ground that matches the page it is read on. This README carried no image at all
214
+ before, so the block is purely additive: the `# @cosyte/terminology` heading, the blockquote
215
+ tagline and every section below are unchanged, and because the lockup reads "Cosyte" while the
216
+ heading reads `@cosyte/terminology`, nothing is duplicated. The failure mode is safe: a renderer
217
+ that strips `<source>` renders the inner `<img>`, so the worst case is a light-ground mark on a
218
+ dark page, never a missing image. On the npm package page the `<img>` is hoisted out of its
219
+ `<picture>` by the anchor wrapper, so the light cut renders there, which is the correct one
220
+ because npmjs.com has no dark mode. The alt text describes the artwork rather than the package,
221
+ since it is what a screen reader reads out and what a reader gets when the image fails. Both tile
222
+ URLs were rechecked before push and returned `200 image/png`. No behaviour, API surface or bundled
223
+ content changed.
224
+
129
225
  ### Changed
130
226
 
131
227
  - **Internal project bookkeeping is gone from every surface a consumer reads, and a gate now keeps
package/LICENSE CHANGED
@@ -19,3 +19,86 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
+
23
+
24
+ ================================================================================
25
+ THIRD-PARTY MATERIALS
26
+ ================================================================================
27
+
28
+ The MIT license above covers Cosyte's own code. This repository and the published
29
+ npm package also distribute third-party materials. Those materials stay under
30
+ their own copyright and license terms, and the MIT grant above does not extend to
31
+ them. What is distributed includes the following.
32
+
33
+ 1. The UCUM unit table (vendor/ucum/ucum-essence.xml)
34
+
35
+ The Unified Code for Units of Measure (UCUM), also known as the "UCUM
36
+ Specification," is copyright (c) 1999-2024, Regenstrief Institute, Inc. All
37
+ rights reserved.
38
+
39
+ Version 2.2, revision-date 2024-06-17, is reproduced verbatim under the UCUM
40
+ Copyright Notice and License, https://ucum.org/license, and is embedded
41
+ byte-for-byte in the published build. That License grants a worldwide,
42
+ non-exclusive, no-charge, royalty-free, revocable license to reproduce,
43
+ publicly display, publicly perform and distribute the Work, and it permits
44
+ developing and commercializing software that interoperates with UCUM. It does
45
+ not permit using the Work to develop or promulgate a different standard, and it
46
+ does not permit derivative works: the content may not be modified and its
47
+ meaning must remain unchanged. This copy is unmodified, and no derivative of it
48
+ is distributed.
49
+
50
+ Disclaimer of warranties: the UCUM Specification is provided "as is" without
51
+ warranty of any kind. See the License at the URL above for the full disclaimer.
52
+
53
+ The complete notice ships inside this package at vendor/ucum/NOTICE.md. That
54
+ file, not this summary, is the notice, and it is the copy to read.
55
+
56
+ 2. The UCUM functional-test suite (vendor/ucum/UcumFunctionalTests.xml)
57
+
58
+ Copyright (c) 2008-2009 Grahame Grieve and other contributors (Gunther Schadow,
59
+ Lloyd Mackenzie, Vladimir Alexiev), reproduced verbatim under the Eclipse
60
+ Public License v1.0, https://www.eclipse.org/legal/epl-v10.html. It is used
61
+ only as a test fixture in this repository: package.json's "files" does not name
62
+ it, so it is not distributed in the npm package.
63
+
64
+ 3. Code-system identity facts (SYSTEM_IDENTITIES)
65
+
66
+ The OID and canonical-URI pairings, names and mnemonics for the code systems
67
+ the resolver recognizes. These identify the systems; no system's code list is
68
+ distributed.
69
+
70
+ 4. SNOMED CT concept identifiers named by the crosswalk resolver
71
+
72
+ SNOMED CT identifiers are distributed with their descriptions: the complex-map
73
+ category concepts in MAP_CATEGORIES (447637006, 447638001, 447639009,
74
+ 447640006) that a map row's mapCategoryId refers to, and the gender findings
75
+ 248152002 (Female) and 248153007 (Male) that a gender IFA rule is written
76
+ against. Further SNOMED CT identifiers, and ICD-10-CM codes, appear in the API
77
+ documentation examples, which are distributed in the compiled declaration
78
+ files (dist/index.d.ts, dist/index.d.cts) and in the build's sourcemaps, whose
79
+ sourcesContent carries every source comment verbatim.
80
+ SNOMED CT is copyright (c) International Health Terminology Standards
81
+ Development Organisation. No SNOMED CT release or refset is distributed; you
82
+ supply the map rows under your own SNOMED CT licence.
83
+
84
+ 5. RxNorm relationship and term-type names (RELA, RELA_INVERSE, TERM_TYPES)
85
+
86
+ The drug-graph API is written against RxNorm's own vocabulary, and those names
87
+ are distributed: the relationship names in RELA and RELA_INVERSE
88
+ (has_ingredient, ingredient_of, tradename_of, and the rest), and the term-type
89
+ codes in TERM_TYPES, each with its name as published by the U.S. National
90
+ Library of Medicine ("SCD" reads "Semantic Clinical Drug"). Individual RxNorm
91
+ identifiers also appear in the API documentation examples, with their RxNorm
92
+ names and term types (for instance RXCUI 316151, "lisinopril 10 MG"), and in
93
+ README.md as well as the declaration files and sourcemaps named above. RxNorm
94
+ is produced by the National Library of Medicine. No RxNorm release is
95
+ distributed; you supply it.
96
+
97
+ Beyond what is named above, no code-system release is distributed with this
98
+ package. SNOMED CT, CPT, LOINC, UMLS and RxNorm releases, the CMS GEM files, the
99
+ NLM complex-map refset and VSAC value sets are all supplied by the caller, under
100
+ whatever terms their steward sets.
101
+
102
+ This section states what is distributed and under whose copyright. It is not legal
103
+ advice, and it makes no claim about whether any particular use of these materials
104
+ is permitted to you.
package/README.md CHANGED
@@ -1,3 +1,8 @@
1
+ <picture>
2
+ <source media="(prefers-color-scheme: dark)" srcset="https://cosyte.com/tile/cosyte-lockup-tile-on-dark-1200x300.png">
3
+ <img alt="Cosyte: a plus mark set in two overlapping rounded squares, one solid and one outlined, beside the Cosyte wordmark" src="https://cosyte.com/tile/cosyte-lockup-tile-on-light-1200x300.png">
4
+ </picture>
5
+
1
6
  # @cosyte/terminology
2
7
 
3
8
  > A **zero-dependency terminology engine** for US healthcare code systems — FHIR-shaped, BYO-data,
@@ -8,9 +13,9 @@
8
13
  resources. It is the sibling engine `@cosyte/transform` and, later, the parsers' code-system
9
14
  recognition consume. It ships the **engine, and no code-system release** — SNOMED CT, CPT, LOINC,
10
15
  UMLS/RxNorm, and VSAC value sets are strictly bring-your-own. It is not content-free, though: what it
11
- _does_ bundle — the UCUM unit table, the code-system _identities_ (OID ↔ canonical URI), and the
12
- SNOMED CT concepts the crosswalk resolver names — is listed with its copyright under
13
- [What is bundled](#what-is-bundled).
16
+ _does_ bundle, including the UCUM unit table, the code-system _identities_ (OID ↔ canonical URI), the
17
+ SNOMED CT concepts the crosswalk resolver names and RxNorm's relationship and term-type names, is
18
+ listed with its copyright under [What is bundled](#what-is-bundled).
14
19
 
15
20
  > **Status:** pre-alpha (`0.0.x`), **published on npm.** The **engine is complete** — every
16
21
  > operation below ships today. The surface:
@@ -178,8 +183,9 @@ resolveNdc(graph, "00000000001"); // { resolved: true, rxcui: "314076", status:
178
183
  ingredientsOf(graph, "99999999"); // { found: false, code: "TERM_RXNORM_UNKNOWN_RXCUI" } — never a guess
179
184
  ```
180
185
 
181
- The engine ships **no** RxNorm content — you supply the release (the public-domain Current Prescribable
182
- Content subset, or the full BYO release).
186
+ The engine ships **no** RxNorm release; you supply it (the public-domain Current Prescribable
187
+ Content subset, or the full BYO release). What it does ship is RxNorm's relationship and term-type
188
+ _names_, listed under [What is bundled](#what-is-bundled).
183
189
 
184
190
  ## The invariants this engine is built on
185
191
 
@@ -189,7 +195,7 @@ Content subset, or the full BYO release).
189
195
  - **Never invert.** A directional map is read in its authored direction only; reverse translation
190
196
  needs an explicit inverse map, never a mechanical inversion.
191
197
  - **BYO data, engine-only.** No code-system release is bundled (a licensing wall, not a gap); the
192
- engine operates over your own FHIR resources. The UCUM unit table and the two identity sets that
198
+ engine operates over your own FHIR resources. The UCUM unit table and the identity sets that
193
199
  **are** bundled are named, with their copyright, under [What is bundled](#what-is-bundled).
194
200
  - **Liberal load, conservative assertion.** Malformed input degrades to a typed diagnostic; a 1:many
195
201
  mapping returns the full candidate set, never collapsed to one.
@@ -215,9 +221,18 @@ with its copyright:
215
221
  - **The SNOMED CT concepts the crosswalk resolver names**, each with its description: the four
216
222
  map-category concepts in `MAP_CATEGORIES` (`447637006`, `447638001`, `447639009`, `447640006`) that
217
223
  a complex-map row's `mapCategoryId` refers to, and the two gender findings (`248152002` Female,
218
- `248153007` Male) that a gender `IFA` rule is written against. SNOMED CT is copyright
224
+ `248153007` Male) that a gender `IFA` rule is written against. Further SNOMED CT identifiers, and
225
+ ICD-10-CM codes, appear in the API documentation examples, which are distributed in the compiled
226
+ declaration files and in the build's sourcemaps. SNOMED CT is copyright
219
227
  © International Health Terminology Standards Development Organisation. **No SNOMED CT release or
220
228
  refset is bundled** — you supply the map rows under your own SNOMED CT licence.
229
+ - **The RxNorm relationship and term-type names** the drug-graph API is written against: the
230
+ relationship names in `RELA` / `RELA_INVERSE` (`has_ingredient`, `tradename_of`, …), and the
231
+ term-type codes in `TERM_TYPES`, each with its name as published by the U.S. National Library of
232
+ Medicine (`SCD` reads "Semantic Clinical Drug"). Individual RxNorm identifiers also appear in the
233
+ API documentation examples, with their RxNorm names and term types (for instance `RXCUI` `316151`,
234
+ "lisinopril 10 MG"), and in this README as well as the places named above. RxNorm is produced by the
235
+ National Library of Medicine. **No RxNorm release is bundled**; you supply it.
221
236
 
222
237
  This section states what is distributed and under whose copyright. It is not legal advice, and makes
223
238
  no claim about whether any particular use of these materials is permitted to you.
@@ -225,4 +240,5 @@ no claim about whether any particular use of these materials is permitted to you
225
240
  ## License
226
241
 
227
242
  MIT © Cosyte — this package's own code. The bundled third-party materials above stay under their own
228
- copyright and licences.
243
+ copyright and licences; the `LICENSE` file that ships with this package carries the MIT text and a
244
+ third-party notices section naming each of them.
package/dist/index.cjs CHANGED
@@ -4703,7 +4703,7 @@ function approximateMatch(graph, query, options = {}) {
4703
4703
  }
4704
4704
 
4705
4705
  // src/index.ts
4706
- var VERSION = "0.0.2";
4706
+ var VERSION = "0.0.5";
4707
4707
 
4708
4708
  exports.COMPLEX_MAP_SOURCE_SYSTEM = COMPLEX_MAP_SOURCE_SYSTEM;
4709
4709
  exports.DIAGNOSTIC_CODES = DIAGNOSTIC_CODES;