fix(ocl): auto-register factories for post-startup sources + expose concept extras in $lookup#266
Open
italomacedo wants to merge 2 commits into
Open
fix(ocl): auto-register factories for post-startup sources + expose concept extras in $lookup#266italomacedo wants to merge 2 commits into
italomacedo wants to merge 2 commits into
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>
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.
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