Repository navigation
LOINC: say once at load when the database has no idx_codes_description - #392
Merged
grahamegrieve merged 1 commit intoNov 14, 2026
Merged
Conversation
HealthIntersections#384) On a copy of LOINC 2.83 imported before HealthIntersections#384: one warning, with the command; after running that command (1.1 s), none. LoincServicesFactory.load looks for the index in sqlite_master and, when it's missing, logs once per file: LOINC: <file> has no index on Codes.Description, so a filter that names a part (SCALE_TYP = Doc) reads every code the first time. Add it once, while the server isn't using the file: sqlite3 <file> "CREATE INDEX IF NOT EXISTS idx_codes_description ON Codes(Description COLLATE NOCASE)" A tx-worker (readOnly) doesn't check: the master loads the same file. 4 tests: warns once without the index (path quoted for the shell), silent with it, silent in a worker, and the logged command silences it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #384, as you asked there: the server now notices an existing LOINC database without
idx_codes_descriptionand says so once at startup.On a copy of LOINC 2.83 (imported before #384), it logs one warning with the command. After that command runs (1.1 s), it logs nothing.
The change
LoincServicesFactory.loadlooks for the index insqlite_master. If it isn't there, the factory logs one warning (moduletx-loinc) with thesqlite3command, quoting the path for the shell when it needs it.readOnly) doesn't check, because the master loads the same file and gives the warning. So a cluster logs it once, not once per worker.--check (#390)
#390 is still open, so this only does the startup warning. Its
checkLibraryreads the library yml and checks the sources' types, prefixes and local files. It doesn't open any databases, and there's no per-provider hook. Once #390 is merged, aloinc:source whose file is already in the terminology cache could get the samesqlite_mastercheck there. That would mean opening each LOINC database during--check.Tests
tests/cs/cs-loinc-index-hint.test.js(4 tests) loads a database that has the importer's tables but no rows and no indexes, the way a database imported before the index looks. The whole suite runs in 1.8 s, while a full test import alone takes about 4.5 s. In one fulltests/cs+tests/txrun, a full import placed late in the run stalled for over 100 s. The tests check that:If loads aren't de-duplicated, the first test fails.
Runs (on 38d3ffe)
tests/cs/cs-loinc-index-hint.test.js: 4 of 4 passed.tests/cs+tests/tx, except the test cases: 3,165 passed, 87 skipped, 116 failed. Main (the $batch-validate-code: one prefetchCodes per code system version for the whole batch #378 follow-up branch, which only adds a test) gives 116 failures in the same 5 suites in the same harness:cs-loinc,cs-loinc-classtype,cs-worker-readonlyandcs-ndcfind no fixture database whenFHIRSMITH_DATA_DIRis set. The LOINC fix is in the companion PR for the test database race.cs-rxnorm-archive-indexexpects a chmod'ed file to be read-only, which it isn't under the harness'sunshare -ruser namespace.tests/tx/test-cases.test.js: 5,251 of 5,251 passed, with validator 7.0.5.🤖 Generated with Claude Code