Uh oh!
There was an error while loading. Please reload this page.
fix(ocl): auto-register factories for post-startup sources + expose concept extras in $lookup - #266
Conversation
…artup New OCL sources created after the server starts were silently falling back to FhirCodeSystemProvider, which reads the raw 'content' field and returns contentMode() = 'not-present', causing ValueSet expansions to fail with "The code system definition has no content". Root cause: the 60-second refresh cycle detected new sources via getCodeSystemChanges() and called addCodeSystem(), but never created an OCLSourceCodeSystemFactory — so getCodeSystemProvider() never found a factory and fell through to the raw CodeSystem. Fix (entirely within tx/ocl/): - OCLSourceCodeSystemFactory stores the first i18n instance in a static field (#sharedI18n) so discovery-time factory creation can reuse it without requiring library.js to pass i18n again - Added static createForDiscoveredSource(httpClient, meta) that creates and auto-registers a factory for a newly detected source; factories self-register in the static factoriesByKey map on construction - #scheduleRefresh now calls createForDiscoveredSource for each entry in changes.added that does not yet have a factory - patchProviderForOCLFactorySync (new patch in shared/patches.cjs) monkey-patches Provider.prototype.updateCodeSystemList to sync any factory in factoriesByKey that is not yet in provider.codeSystemFactories, following the same idiomatic pattern used for SearchWorker and ValueSetExpander patches No files outside tx/ocl/ were modified. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Carry OCL concept extras through toConceptContext (non-empty plain objects only) and implement extendLookup on OCLSourceCodeSystemProvider to emit each entry as a FHIR property parameter with typed value[x] (boolean/integer/decimal/string; arrays and objects JSON-stringified). Honors the $lookup property filter per key. Provider now extends BaseCSServices for the _hasProp helper and is exported for tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
grahamegrieve
commented
Aug 26, 2026
@italomacedo one general issue with this PR: console.log/console.error - please use the module logger instead |
italomacedo
commented
Aug 26, 2026
Working on it |
Replace all console.log/console.error calls across the OCL module with a
child logger from library/logger (Logger.getInstance().child({ module })),
per review feedback on PR #266.
- cs-ocl.cjs, background-queue.cjs, cache-utils.cjs -> module 'ocl'
- vs-ocl.cjs -> module 'ocl-vs' (preserves the former [OCL-ValueSet] split)
- drop the redundant [OCL]/[OCL-ValueSet] message prefixes (the child logger
now tags each line with {module})
- fetchAllPages in #fetchAllPages now receives the child logger with an empty
loggerPrefix instead of console
- getColdCacheAgeMs: drop the now-unused logPrefix parameter
No behavior change beyond log routing; all 80 OCL tests pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>italomacedo
commented
Aug 26, 2026
Good catch — done in cd8bb7b. I converted the whole OCL module to the module logger ( |
Uh oh!
There was an error while loading. Please reload this page.
Two OCL fixes, verified against the current
mainbase (9 OCL test suites / 80 tests passing). Scoped entirely totx/ocl/plus tests.1. Auto-register factories for OCL sources discovered post-startup
New OCL sources created after the server starts were silently falling back to
FhirCodeSystemProvider, which reads the rawcontentfield and returnscontentMode() = 'not-present', causing ValueSet expansions to fail with "The code system definition has no content".Root cause: the refresh cycle detected new sources via
getCodeSystemChanges()and calledaddCodeSystem(), but never created anOCLSourceCodeSystemFactory— sogetCodeSystemProvider()never found a factory and fell through to the raw CodeSystem.Fix (entirely within
tx/ocl/):OCLSourceCodeSystemFactorystores the first i18n instance in a static field so discovery-time factory creation can reuse it.createForDiscoveredSource(httpClient, meta)creates and auto-registers a factory for a newly detected source.#scheduleRefreshnow creates factories for entries inchanges.addedthat don't yet have one.patchProviderForOCLFactorySync(inshared/patches.cjs) syncs any factory not yet inprovider.codeSystemFactories, following the same pattern already used for the SearchWorker and ValueSetExpander patches.2. Expose concept extras as properties in
$lookupCarry OCL concept extras through
toConceptContext(non-empty plain objects only) and implementextendLookuponOCLSourceCodeSystemProviderto emit each entry as a FHIR property parameter with typedvalue[x](boolean/integer/decimal/string; arrays and objects JSON-stringified). Honors the$lookupproperty filter per key.🤖 Generated with Claude Code