Skip to content

sqlite-v2: data-driven tx-terminology/1 files for all served terminologies - #489

Draft
jmandel wants to merge 94 commits into
HealthIntersections:mainfrom
jmandel:sqlite-v2-format-round2
Draft

jmandel wants to merge 94 commits into
HealthIntersections:mainfrom
jmandel:sqlite-v2-format-round2

Conversation

@jmandel

@jmandel jmandel commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Draft, for review. One branch: the sqlite-v2 providers and importers move to a revised tx-terminology/1 file layout in which what differs between terminologies is data in the file, not code in the reader.

Format document: tx/sqlite-v2/README.md.

What changes

  • A file holds one code system version's content plus a small "FHIR reading": which status values mean inactive or deprecated, how each property is reported by $lookup, which filters exist (a filter table shaped like CodeSystem.filter), and how text search, ordering, versions and implicit value sets work. Example:
    // LOINC
    "conceptStatus": [{"property": "STATUS", "values": {"DISCOURAGED": ["inactive"], "DEPRECATED": ["inactive", "deprecated"]}}]
  • The reader has no table or branch keyed on a code system URL. dialects.js and the three per-system $lookup adapters are deleted. CPT modifier expressions, ICD-11 postcoordination and SNOMED CT expressions remain as three named grammars.
  • A library line sqlite-v2:<file> loads a file of any code system. Served: SNOMED CT, LOINC, RxNorm, UNII, NDC, OMOP, CPT, ICD-11 (MMS, ICF, Foundation).
  • RxNorm REL/RELA = AUI:<rxaui> filters (files built with --atom-relationships) are a second filter row with value_prefix AUI: reading the atom-level identifier rows; 129 of 131 requests over all 56 names equal main's rxnorm-v2 (the 2 are the white-space item under Open).
  • codeLink is a meta key (URL template with {code}) written by the LOINC and RxNorm importers, instead of a branch on system URL.
  • literal gains a nullable seq column (source order of a concept's values of one property), used for NDC upc order.
  • The format label is unchanged. Files written by the earlier sqlite-v2 importers are refused at load with a message to re-import.
  • Separate commit 704cbcad, classic SNOMED CT importer only: SnomedReferences.post() appends into a growing buffer instead of Buffer.concat on every call. Output cache is byte-identical on the test edition (5 paired runs); 0.7 s → 0.5 s and peak memory 284–372 MB → 182–186 MB there. Not timed on a full edition.

Answers compared with main

Two servers, same requests: unmodified main 223d6ee2 with its own providers and importers, and this branch with sqlite-v2 files imported from the same sources.

terminology requests same different
LOINC 2.83 46 46 0
RxNorm 03022026 31 31 0
SNOMED CT test edition 20250909 49 49 0
SNOMED CT International 20260701 49 49 0
UNII 2024-06-22 17 17 0
OMOP 20240716 (189-concept database) 41 41 0
ICD-11 2026-01 (MMS, ICF, Foundation) 54 54 0
NDC 20261117 44 42 2
CPT 2023 55 54 1

The three that differ are filed as issues against main, with the request and both answers; this branch gives the answer those issues expect:

Two more defects in main found outside those requests: #487 (UNII whole-system $expand: main gives no total for count=0, this branch total 0; neither lists codes) and #488 ($expand total when a urn:ietf:bcp:47 include is combined with another include; this branch answers the same as main, total 1).

In that comparison main served SNOMED CT, LOINC and RxNorm through its own sqlite-v2 providers. Against main's classic snomed provider there are five more differences on the test edition (an error status, concept in a reference set of descriptions, which this branch refuses as ECL ^ is refused, a filter=0 total, the order of concept in a,b, expressions = true); main's sqlite-v2 provider already answers those as this branch does. All are listed with both answers in the README, "Known differences from main".

Also replayed 3,740 recorded requests (3,534 R4, 206 R5) across 27 editions against both servers: all equal except 25 metadata answers, which differ only in CapabilityStatement.software.releaseDate. Four editions in that recording (LOINC 2.81, SNOMED CT US 20240301 / 20250301 / 20260901) were left out because their source files weren't available to import with main; they account for 27 of the calls.

ICD-11 text searches match when main's text index has been built on its database (import-icd11.js --text-index-only).

Tests

npx jest sqlite-v2 (Node 24): 31 suites, 761 passed, 0 skipped. SNOMED CT classic suites: 445 passed, 33 skipped.

Open

  • RxNorm = filter values with white space around them (" CUI:161", "AUI:828 ", padded TTY/STY): main trims the value first, this reader takes it as written. Listed in the README.
  • UNII, CPT, NDC and OMOP have no text search, as on main.

🤖 Generated with Claude Code

jmandel and others added 30 commits December 3, 2026 16:21
A file's meta follows one rule: requires names the features a reader
must understand (an unknown one refuses the file); a known key with a
malformed value is refused; any other key is ignored. The builder checks
every key it writes against its own list, so a misspelt key fails the
build instead of being ignored by readers. The checks live in one place
(tx/sqlite-v2/meta.js), used by the reader and the builder.

Co-Authored-By: Claude <noreply@anthropic.com>
With the column declared TEXT, SQLite stores every identifier value as
text whatever the writer binds. The builder writes requires
["identifier-text"]; in such a file the reader binds identifier probes
as text, lists passed through json_each included (an integer there does
not match a text value). A file without the feature keeps the older
typing.

Co-Authored-By: Claude <noreply@anthropic.com>
…age, little-endian counts

meta ix.ix_word.names says which names the word index holds, and so
which names text search reads: concept displays under a language, and
items filtered by active, designation, excluded uses, concepts with a
property, and an optional language. The importers state it (SNOMED CT,
LOINC, RxNorm); the index builder builds from it and the reader's search
names (stored or in-memory index, ranking reads) run from it, with no
switch on the system. A file without the key uses the selection the
format had for its system, from one table (LEGACY_NAMES); on the
installed SNOMED CT, LOINC and RxNorm files it selects exactly the rows
the earlier code did.

meta ix.ix_word.stemmers names each language's stemmer
(natural:<class> or none). A language whose stemmer this reader does not
have is searched with an index built in memory; the other languages
keep the stored one. The counts row is written and read little-endian.

Co-Authored-By: Claude <noreply@anthropic.com>
Each key has one meaning and a default, and the reader obeys the file's
value with no rule of its own for a system on top:

- designationUses and preferredForLanguage apply to every designation
  path (SNOMED CT, LOINC, RxNorm and the generic one), not only RxNorm's.
- lookupName and description choose code_system.name or .title (a title
  of the requested language from meta titles first) for every file; the
  SNOMED CT provider no longer overrides them, nor versionAlgorithm,
  which the SNOMED CT importer now writes ("url").
- meta linkOrder orders a concept's links in the generic $lookup
  (property, seq, property-seq, target-int); meta searchTieBreak "rank"
  orders text-search ties by the stored rank. Both are checked strictly.
- aliasProperty, aliasExtension and aliasLiterals (identifier-aliased
  codes) are not implemented by this reader: a file that sets one is
  refused rather than answered wrongly.

Co-Authored-By: Claude <noreply@anthropic.com>
… applied

behaviour.grammar is any name (or null). The reader holds the grammars
it implements by name (snomed: the SNOMED CT provider) and refuses a file
whose grammar it does not implement, with no fallback by system URI; a
provider loaded directly refuses a file of another grammar too.

behaviour.filters is applied: where a file lists the only filters the
system understands, a filter, operator or value (each item of an in
list) not in the list is FILTER_NOT_UNDERSTOOD. The file itself is
served. A listed inactive filter is FHIR's concept status.

Co-Authored-By: Claude <noreply@anthropic.com>
…rows and target_kind

The format document lists the contracts every file keeps (id ranges,
the hierarchy and list properties, index key conventions, ix_in and
ix_by_subject contents, ix_order block layout, counts rows, a stemmer
for every word-index language, a stored order where expansionOrder
needs one, the schema's indexes, statistics). The builder checks them
before it finishes a file, and so does indexes.js after a rebuild.

property.n_rows and property.target_kind are dropped: derived and read
by nothing. code_system.case_sensitive, hierarchy_meaning and
release_date stay (CodeSystem facts; isCaseSensitive reads
case_sensitive). The reader checks the id ranges it relies on at open
(three rowid probes).

Co-Authored-By: Claude <noreply@anthropic.com>
The builder writes meta integrity when it finishes a file: the item
count and SHA-256 digests of the schema and of the catalog tables
(defined in the format document). Readers do not check them.

node tx/importers/sqlite-v2/verify.js <file> checks a file on request,
read-only: the format, the meta values, every contract the builder
checks (id ranges included) and the integrity facts where the file has
them (file length, both digests, the item count). It prints each check
and exits 1 on a failure, 2 when the file cannot be read.

Co-Authored-By: Claude <noreply@anthropic.com>
Catalog property.report gains 'never': the property is not reported by
$lookup (asked for or not), nor on expansions, nor declared; with
filterable = 1 it is a filter only. The reader now obeys report in every
$lookup path (named: only when the request names it; always: on every
expansion row, mandatoryExpansionProperties), where before it checked
the value and ignored it. The builder refuses a report value it does not
know.

behaviour.expansionLimit (an integer, default 0: no limit) is the most
codes of the system an expansion lists or walks: the provider's
expandLimitation(). A file that sets it is expanded through expand.js's
usual path, which counts codes against the limit.

Co-Authored-By: Claude <noreply@anthropic.com>
The old readBehaviour body was left below the new one and, being
declared later, replaced it: the exported function referred to a table
that no longer exists. A test now calls the export.

Co-Authored-By: Claude <noreply@anthropic.com>
Through the real $expand: the codes up to the cap, the total all of the
system's codes, and the expansion-issue VALUESET_EXPANSION_CODESYSTEM_LIMITED
when the page asked for was cut short, as expand.js does for any provider
whose expandLimitation() is set.

Co-Authored-By: Claude <noreply@anthropic.com>
The RxNorm importer writes property.report: never on SUPPRESS and on the
storage codes (@rel, RELA@REL), named on the relationships. The RxNorm
adapter reads the catalog; the code rule it replaces applies only to a
file whose catalog has no report value there (built before), and gives
the same answers (tested on one fixture both ways). report 'named' now
means: by name or *, not by default, which is what the RxNorm
relationships and SNOMED CT's named-only properties need.

The format document states the absent ix.ix_word.names rule as a
compatibility rule for files built before the key; a test checks that
node indexes.js on such a file writes the key from the legacy table.

Co-Authored-By: Claude <noreply@anthropic.com>
No answer reads a provider's description(): the key chose a value
nothing consumed. It leaves the reader's list of keys, the LOINC
importer and the format document; a file that still carries it has an
unknown key, ignored. description() returns code_system.description,
else the title.

Co-Authored-By: Claude <noreply@anthropic.com>
A property code (default null): $lookup lists each designation that has
a literal of that item property again, coded by the literal's value,
with its text and language. A few lines in the generic $lookup.

Co-Authored-By: Claude <noreply@anthropic.com>
… names

behaviour.lookupCopyright (default false): $lookup lists
code_system.resource.copyright as a copyright property; a file that sets
it without a copyright is refused. The builder's contracts now also
require meta requires (not for node indexes.js on a file built before
it) and ix.ix_word.names wherever there is a word index. A builder
accepts ix.ix_key.<name>.stats for any index name. These bring the JS
side in line with the other reader of the format.

Co-Authored-By: Claude <noreply@anthropic.com>
null means no algorithm is stated: the version string decides how a
requested version matches, with no rule of the reader's own for a
system; the SNOMED CT importer writes "url".

Co-Authored-By: Claude <noreply@anthropic.com>
searchTieBreak other than rank refused; a file without
ix.ix_word.stemmers read with this reader's stemmers (the stored index
used). Unknown fields in ix.ix_word.names, linkOrder values and report
named (by name or *) were covered already.

Co-Authored-By: Claude <noreply@anthropic.com>
The LOINC importer writes meta linkOrder seq (a concept's links in
source order): the other reader orders a LOINC $lookup by it, so a file
built here means the same there. A lookupDesignationCode that is not a
literal property of the catalog refuses the file (it listed nothing).

Co-Authored-By: Claude <noreply@anthropic.com>
…1 and NDC

verify.js exits 1 when any check fails, a file it cannot read included.
The format document says ICD-11 residual and NDC kind are 'never'
(filter-only), as their importers now write, and notes the one
difference between readers on a file without versionAlgorithm.

Co-Authored-By: Claude <noreply@anthropic.com>
A requested version matches by the file's versionAlgorithm, else by
what its stored CodeSystem resource declares, else only exactly: no
guess from the version string. The worker's version check asks the
provider (versionMatches) where it has a rule of its own. Every
importer writes the key (SNOMED CT url, LOINC natural, RxNorm date).

Co-Authored-By: Claude <noreply@anthropic.com>
The reader keeps no rule whose only purpose is a file written before a
key existed:
- no legacy word-index selection: a file without ix.ix_word.names has
  no names to search, and a stored index without ix.ix_word.stemmers is
  not used;
- identifier values are always probed as text; a file that does not
  require identifier-text (its identifier column may hold INTEGERs) is
  refused, to be rebuilt or upgraded;
- no default display reference set for a SNOMED CT file without
  displayContexts;
- the RxNorm $lookup reads property.report only;
- node indexes.js checks every contract, requires included.
Supplement layers state requires like any file. Existing tests pass
with their expectations unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
property gains reported_as (the name it is reported and asked for
under), also_asked_as (further names a request may ask by) and
true_value (reported as a boolean, true for that value). The SNOMED CT
importer writes them for is-a (parent), moduleId (also module) and
definitionStatusId (sufficientlyDefined, true for fully defined, named);
the SNOMED CT $lookup reads them instead of its own names.

property.role 'status' marks the literal that holds a concept's status
(at most one, a builder contract); the LOINC importer sets it on
STATUS, and the reader finds the status property by role, not by
system or code.

Co-Authored-By: Claude <noreply@anthropic.com>
behaviour.textSearch names the text-search algorithm (an open name with
a registry, like grammar: snomed, loinc, rxnorm; null the generic one);
the provider picks the search from the file, not from the system. Which
names a search reads was already ix.ix_word.names. Ties are meta
searchTieBreak: rank, display (then rank), code; absent: concept id.
The importers write SNOMED CT snomed/rank, LOINC loinc/display, RxNorm
rxnorm/code, which give the answers the per-system rules gave (the
parity tests against the built-in providers pass unchanged).

Co-Authored-By: Claude <noreply@anthropic.com>
One key for identifier-aliased codes: behaviour.aliases = null or
{parameter?, extension?, literals?} (any other field malformed), each
field meaning what aliasProperty, aliasExtension and aliasLiterals
meant; those three are removed (now unknown keys, ignored). This reader
does not implement identifier aliases and refuses a file that sets it.

Co-Authored-By: Claude <noreply@anthropic.com>
A catalog fact per property instead of a file-wide flag: named_links = 1
means the property's links are read only where it is named (a $lookup
asking for it, a filter, an ECL refinement); its literals follow report
as usual. The SNOMED CT importer sets it on every shape both attribute
(what the file key meant). The links left out where no property is
named are the closure sources and the named_links properties. The file
key is removed.

Co-Authored-By: Claude <noreply@anthropic.com>
…eporting columns

searchTieBreak gains code-length: the code's length, then the code as
binary text (numeric order for numeric codes). The SNOMED CT importer
writes it: it is the order of the stored rank SNOMED CT files carry, so
answers are unchanged (the parity tests pass as written), and it does
not depend on the expansion order.

A file whose property table lacks reported_as, also_asked_as,
true_value or named_links was built before them and is refused with a
message to rebuild or upgrade it. A text search the reader does not
implement (icd11 included) refuses the file, as before; tested.

Co-Authored-By: Claude <noreply@anthropic.com>
A property code (default null: every concept): answers select only the
concepts with a row of it; the file's other concepts are kept but never
selected by a filter, an expansion, a count or the whole-system walk.
The RxNorm importer writes SUPPRESS (the concepts in RXNCONSO), which
replaces the RxNorm adapter's live-domain rule and five checks of the
system in the provider. The engine test's RxNorm fixture now states its
domain (expectations unchanged).

Co-Authored-By: Claude <noreply@anthropic.com>
A server serves a file's system as CodeSystem/x-<id>. The id is now
code_system.resource.id, which each importer writes as the built-in
provider for its system forms it (SNOMED CT SCT-<edition>-<date>, LOINC
loinc<version>, RxNorm RxNorm-<version>), instead of three rules by
system in the reader. The id tests compare the importers' functions with
the built-in providers' ids over the same table of versions (the ids
are unchanged).

Co-Authored-By: Claude <noreply@anthropic.com>
…tate designations

ix.ix_word.names.items.includeUses lists the item uses whose items are
names (null: an item without a use); absent: every use; combined with
the other item fields. The LOINC and RxNorm importers now state
designations: true, the rule their searches already applied (the
answers on the fixtures are unchanged). Text search reads the names
from the selection only, as before.

Co-Authored-By: Claude <noreply@anthropic.com>
The items of a use with reported_as are not designations: $lookup lists
the active ones as values of a property of that name (with their
language). At most one such use per file (builder contract, reader
check); a file without the column is refused. The LOINC importer sets
it on RELATEDNAMES2, which replaces the LOINC rules by code in the
designation reads and the LOINC $lookup. Listed by default, by name or
*, as the built-in LOINC provider lists RELATEDNAMES2 (cs-loinc.js).

Co-Authored-By: Claude <noreply@anthropic.com>
The SNOMED CT importer stores each concept's semantic tag as a literal
semanticTag (named, not filterable), computed once from the final rows
(builder deriveFacts): among the active FSN items in rank then id order,
the first whose text ends with ')' and contains '(', the text between
the last '(' and that ')'. The SNOMED CT $lookup lists it like any
literal; the reader derives nothing. On the test fixtures the answers
are unchanged; on concepts with nested brackets or trailing spaces the
stored rule differs from the earlier regular expression.

Co-Authored-By: Claude <noreply@anthropic.com>
jmandel and others added 28 commits December 5, 2026 00:39
… as upstream

The NDC file of 20261117 stores literal.seq with order.literals stored
(upc of 58151-155-77 in the release's row order) and the OMOP file of
20240716 stores order.expansion stored with ix_order rank and ids in the
concept table's row order, so the two known differences go: the NDC and
OMOP batteries answer as upstream's providers but for the two NDC
expansions where upstream finds nothing (category with 11-digit forms; the
whole system with count > 0).

Co-Authored-By: Claude <noreply@anthropic.com>
…xed database

Co-Authored-By: Claude <noreply@anthropic.com>
…k with wholeSystemIncludeActiveOnly too

compile.js makes an include of the whole system an `and` of all and
active (a node marked whole) when the file says
compatibility.wholeSystemIncludeActiveOnly; the engine took the stored
walk only for a node of type `all`, so such an include was listed in
rank order (SNOMED CT: by code number, 101009 first) instead of from the
roots (138875005 first), and its count=0 total was the active concepts,
not every concept. The engine now walks any node marked whole (all, the
listed concepts, or the active ones), as upstream's provider answers.
A fixture test pages a whole-system expansion with and without the key.

Co-Authored-By: Claude <noreply@anthropic.com>
… and UNII

LOINC: main counts the Answer row with code '' that databases built
before the importer skipped blank AnswerStringId rows still have.
UNII: main adds totalCount's -1 (not known) to the total and so reports
none, where the walk of the same include reports 0.

Co-Authored-By: Claude <noreply@anthropic.com>
Brings in upstream's roaring-js and node:sqlite library changes, the
removal of the old RxNorm provider, the B1-B17 sweep, stored expansions
and code links for the v2 providers.

Conflicts and conversions:
- store.js, text-index.js, provider.js: the branch's imports with
  roaring-js; better-sqlite3 now library/sql/better-sqlite3 (node:sqlite).
  The branch's other files that still named the old modules (builder.js
  sets, verify.js, import-rxnorm-v2, three tests) converted the same way.
- snomed.js: the branch's factory (identity, names and versions from the
  file) with upstream's SNOMED CT codeLink as the snomed grammar's.
- provider.js codeLink: upstream's branch on the LOINC and RxNorm URIs is
  left out (the reader has no branch on a system URI); links for those
  systems come from the file in the next commit.
- format-cases test: upstream's recorded cs-rxnorm.js answers replace the
  removed classic provider; the AUI cases stay skipped as on the branch.
- sqlite-v2-format test: node:sqlite's SQLite has no STAT4, so the
  sqlite_stat4 contract case makes the table itself instead of ANALYZE.
- READMEs: both texts, with upstream's note on the RxNorm removal.

Co-Authored-By: Claude <noreply@anthropic.com>
Upstream's v2 codeLink gave LOINC and RxNorm links by branching on the
system URI, which the reader does not do. The link is now a file fact:
meta codeLink, a URL with {code} (the code URI-encoded); absent, no link.
The LOINC importers write https://loinc.org/{code}/, the RxNorm importer
the RxNav search; the snomed grammar keeps its own links (snomed.js).

Tests: code-links.test.js reads the templates the importers write; the
format test checks the key (template, none, malformed); the LOINC test
checks the importer's value and the link against cs-loinc.js.

Co-Authored-By: Claude <noreply@anthropic.com>
Upstream's providers gained hierarchyMeaning() ($subsumes refuses a
hierarchy that is not is-a, triage B16). The file already holds the
value; the provider reports it, null where the file does not say.

Co-Authored-By: Claude <noreply@anthropic.com>
$validate-code of any SNOMED CT expression the reader keeps as an expression
(a refined expression, or a single concept written <<< X) answered 500
"Invalid context": validate.js asks the provider for reportedClassificationCode,
which snomed.js did not answer for an expression context, so the generic
reader's _ensure got the NativeExprContext. classificationCode and
reportedClassificationCode are now answered natively (none, as cs-snomed.js).

A single concept written <<< X is the concept X for everything but its code
(<<<X), as cs-snomed.js answers it: display, designations, status and
properties are X's (the display was the rendered expression, <<<X|term|).

Tests compare $validate-code and $lookup of these codes with main's provider
over the test edition.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
SnomedReferences.post() rebuilt the master buffer with Buffer.concat on
every call, and the closure build calls it once per concept, so the copy
grew with the edition (quadratic in the size of the reference lists).
post() now appends into a buffer with spare capacity, grown by doubling;
doneBuild() releases the spare buffer.

Only the RF2 -> classic .cache import (import-sct.module.js) builds
references; readers of a cache, and snomed-v2-from-cache, read them with
no builder. The test edition's cache is byte-identical before and after.

Co-Authored-By: Claude <noreply@anthropic.com>
Every row was re-run against main's providers on files of the same release.
Rows whose answers are now the same are removed (ECL description ids; the
AU refset / code 0 / term attached / RxNorm PSN cases; generalizes order;
NDC 11-digit order; LOINC count=0; ICD-11 text search; CPT modifier 95; CPT
kind order; OMOP $lookup). The rest state the request and both answers; the
description-refset and ICD-11 expression rows are corrected to what each
side answers.

Co-Authored-By: Claude <noreply@anthropic.com>
…ts text

An ICD-11 expression's designation was labelled with the first requested
language the file has names in, whatever language its parts' displays
were in: a $lookup of 1A00&XN8P1 with displayLanguage=es answered the
English display labelled es, and so without the warning that there is no
display in es. The generic reader now says which language a concept's
display is in (_displayOf: the supplement's, the language-ranked item's,
or the display designation's), and the expression is labelled with its
parts' language where they share one, else the display designation's.
The answer is now upstream main's, warning included.

Co-Authored-By: Claude <noreply@anthropic.com>
…ECL ^ is

`concept in R` took R's members only when R's member set was non-empty,
and otherwise R itself, as for a concept that is no reference set. A
language reference set has no member set (its members are descriptions),
so `concept in 1000601000003105` on the test edition answered the refset's
own id. The member count was standing in for "is a reference set": now a
concept that defines a record relation contributes its members, none when
it has no active ones, and a language relation is refused with ECL ^'s
reason (400 invalid), from one shared message.

Co-Authored-By: Claude <noreply@anthropic.com>
…l rows

A file built with --atom-relationships now answers relationship filters whose
values are atom ids, as main's rxnorm-v2 does. The importer writes, for each
relationship filter, a second filter row of the same name with value prefix
AUI: that reads the name's AUI:<name> rows (the existing union of the
(REL, RELA) identifier rows; an identifier row with no statements for a name
without atom-level rows). The generic reader gains three general rules, no
RxNorm case:

- rows of one filter name may share operators when their value prefixes tell
  them apart; each value is read by the row whose prefix it has (in: the
  union, not-in: its complement)
- an identifier property, or a union of identifier properties, read by = / in:
  the subjects of the identifiers with the value
- a filter row may read an internal property (an internal row is still never
  a filter's name, reported or declared)

Files without atom-level rows are unchanged and still refuse AUI: values.
README: filter and property sections, RxNorm per-system content; the known
difference and the open point are removed.

Co-Authored-By: Claude <noreply@anthropic.com>
…around them

Main's RxNorm provider trims every = value before it removes CUI: / AUI:;
this reader takes the value as written (a leading space before the prefix is
not understood, TTY / STY values are matched as written). Found while
comparing the AUI: filters; it applies to CUI:, TTY and STY values alike, and
no file fact says a system's values are trimmed.

Co-Authored-By: Claude <noreply@anthropic.com>
…ts, and implicit ValueSets

- SNOMED concrete-domain SCG $lookup (snomed.js): emit typed concrete
  refinement values (valueInteger/valueDecimal/valueString) via
  concreteValueOf + MRCM range instead of calling getDisplayName on
  NO_REFERENCE (0xFFFFFFFF), avoiding HTTP 500.
- Captured filter unknown property with exists false (engine/compile.js):
  return { t: 'all' } instead of { t: 'empty' } when a captured property
  (e.g. mapped:447562003) is absent from the catalog and op is exists false.
- Implicit ValueSet templates (provider.js): omit compose.include[0].version
  unless set by the template so caller system-version default overrides apply
  (matching cs-loinc.js).
- ECL {{ D moduleId / effectiveTime }} (engine/compile.js, sct-main-ecl.js):
  reject with 400 UNSUPPORTED_ECL instead of falling back to sct-main-ecl.js
  with hardcoded module: 0 / date: 0 and returning empty 200.
- SNOMED ?fhir_vs=refset (store.js, snomed.js): include populated language
  reference sets (role='language' in record) and the module dependency refset
  (900000000000534007 when meta moduleDependencies is non-empty).
- ECL {{ + HISTORY-* }} ordering (engine/compile.js, engine/engine.js):
  preserve base focus-first ordering before added inactive history concepts.
…in, supplement filter order, ECL parents, link dedup)

- LOINC answers-for in (engine/compile.js): restrict list-sequence ordering to
  op === '=' so answers-for in uses stored rank order (matching cs-loinc.js).
- SNOMED concept in (engine/compile.js, engine/engine.js): preserve written
  order on plain-concept in under isAListsFocusFirst (matching cs-snomed.js).
- Supplement-only filter order (layers.js, engine/compile.js): record
  conceptOrder in fillLayer and preserve supplement declaration order on
  supplement-only includes (matching expand.js #supplementFilterConcepts).
- SNOMED ECL >>! and >! parents (engine/engine.js): handle 'parents' in
  orderedBy() and _eclOrdered() so focus comes first followed by direct parents
  in release order (fixing offset pagination on >>!).
- Multi-group lookup link dedup (provider.js): sort candidate links by
  order.links (seq) before deduplicating by (property, target) so the earliest
  link wins (matching cs-snomed.js).
- tx/sqlite-v2/provider.js (_reportsDef): recognize <name>.details requests for
  mapping properties (such as ICD-11 'source').
- tx/workers/lookup.js (doLookup): when <name>.details is requested and the
  emitted Coding property carries no embedded subproperty/designation parts,
  enrich it with the target concept's definition, parent subproperties, and
  designations (matching classic cs-icd11.js #sourcePart).
- evaluate.js: call _group directly from _mat instead of filterG to avoid
  infinite recursion (RangeError: Maximum call stack size exceeded) when
  a role-group cardinality base exceeds PROBE_MAX; chunk linksFrom in _group
- sct-main-ecl.js + snomed.js: map V2View concept indices via the file's
  stored numeric-SCTID rank order and preserve sv._eclToIndexArray order on
  eclFallback so focus-first (<< X : ...) and descendant order match cs-snomed.js
- sct-native.js: include concrete-value refinements (#num / "str") in
  exprRels() so exprSatisfies() evaluates concrete ECL constraints on SCGs
- snomed.js: override doesFilter() to accept constraint = <ecl> so invalid
  ECL in $validate-code reports 400 INVALID_ECL (matching cs-snomed.js)
- snomed.js: guard decodeURIComponent and reject empty ?fhir_vs=ecl/
  implicit ValueSet URLs (matching cs-snomed.js, avoiding URIError 500s)
…ystems (LOINC)

When expand.js walks a multi-include ValueSet via iterator(null) (e.g.
v3-DocumentSectionType importing v3-QualityMeasureSectionType + whole LOINC),
_roots() returned raw concept-id order (LP100001-9 first) instead of the
stored walk order (100000-9 first, matching classic cs-loinc.js). Use
engine._order.walk and Array.from() in nextContext() so Uint32Array slices
map cleanly to V2Concept instances.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant