Skip to content

Improve multilingual support and caching for non-OCL expansions#181

Open
italomacedo wants to merge 3 commits intomainfrom
feature/ocl-non-ocl-caching
Open

Improve multilingual support and caching for non-OCL expansions#181
italomacedo wants to merge 3 commits intomainfrom
feature/ocl-non-ocl-caching

Conversation

@italomacedo
Copy link
Collaborator

This pull request focuses on improving performance and reducing log verbosity in the OCL terminology service codebase. It introduces caching for organization ID lookups, optimizes ValueSet fetching with negative caching, and removes many info-level log statements to make logs less noisy. Additionally, it ensures that stale ValueSet expansions are still served while background refreshes are pending.

Key changes include:

Performance and Caching Improvements

  • Added in-memory caching and deduplication for organization ID lookups in both OCLCodeSystemProvider and OCLValueSetProvider, preventing redundant network requests. [1] [2] [3] [4]
  • Implemented a negative URL cache in OCLValueSetProvider to avoid repeated failed lookups for ValueSets not present in OCL, improving fetch efficiency. [1] [2] [3]

Background Expansion and Cache Handling

  • Modified ValueSet expansion cache invalidation to retain and continue serving stale expansions until a fresh background expansion is available, ensuring uninterrupted service. [1] [2]

Logging and Verbosity Reduction

  • Removed or reduced many info-level log statements throughout OCLSourceCodeSystemFactory, OCLBackgroundJobQueue, and OCLValueSetProvider to declutter logs, especially for routine cache loads, background job scheduling, and expansion events. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]

API Improvements

  • Ensured that HTTP requests for concept details in OCLSourceCodeSystemProvider now include a verbose: true parameter for more detailed responses.

Code Cleanups

  • Removed unnecessary calls to #clearInlineExpansion in ValueSet fetch methods, as stale expansions are now preserved until replaced. [1] [2] [3] [4] [5]

These changes collectively improve system efficiency, reduce unnecessary network and CPU usage, and make operational logs more actionable.

italomacedo and others added 3 commits March 20, 2026 15:45
…pport

The expansion cache was returning the same cached result regardless of
displayLanguage because hashSource() never included language in the key.
The root cause was hasDisplayLanguages/hasHTTPLanguages checking a
non-existent .source property on the Languages class, always returning
false.

Additionally, OCL ValueSets with pre-built multilingual expansions from
cold cache were having their expansion data deleted before reaching the
expand worker, forcing a rebuild from the FHIR package CodeSystem which
only has English designations.

Key fixes:
- Fix hasDisplayLanguages/hasHTTPLanguages to use .length instead of .source
- Apply language selection to pre-built expansions via selectDisplayForLanguage
- Stop clearing inline expansion from OCL ValueSets in fetchValueSet
- Preserve expansion data when background cache validation fails
- Guard scanValueSet against undefined compose
- Add verbose=true to OCL concept fetches for designation data
- Cache #fetchOrganizationIds to avoid repeated HTTP calls
- Add negative URL cache for non-OCL ValueSet lookups
- Remove expansion cache minimum duration threshold
- Reduce verbose background job logging

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
OCL ValueSets now cache extensional compose.include (code lists) instead
of full expansions, delegating expansion to the FHIR engine. This removes
stale inline expansions and enables proper parameter handling by the
expand worker pipeline.

Note: displayLanguage for OCL-sourced translations still needs work since
translations live in the OCL API, not in the core FHIR CodeSystems.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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