Feature/ocl display language support, concept mapping, concept map rendering.#179
Open
italomacedo wants to merge 4 commits intomainfrom
Open
Feature/ocl display language support, concept mapping, concept map rendering.#179italomacedo wants to merge 4 commits intomainfrom
italomacedo wants to merge 4 commits intomainfrom
Conversation
The \$translate operation was only accepting R5-style parameter names (sourceCode/sourceSystem/sourceCoding/sourceCodeableConcept). Now also accepts the R4 standard names (code/system/version/coding/codeableConcept) as aliases, so GET ?system=...&code=... works correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…erference OCL layer: - Support displayLanguage in CodeSystem lookups by extracting structured designations (locale-aware names) from OCL verbose concept responses - Fix designation field name (designations → designation) to match FHIR spec - Add language-neutral fallback so preferredDesignation() always resolves - Use source's configured language instead of hard-coding 'en' - Deduplicate designations where empty-language value duplicates a named one - Fetch detailed concept data during ValueSet expansion for proper localized names and definitions - Disable ConceptMap search in OCL provider (return []) since OCL exposes individual mappings, not ConceptMap resources — use $translate instead FHIRsmith core (justified fixes): - tx/provider.js: pass sourceCode to findConceptMapForTranslation so OCL can resolve concept-level mappings directly - tx/workers/translate.js: forward coding.code to provider for the above - tx/library/conceptmap.js: fix listTranslations to allow targetSystem to be optional (was incorrectly requiring both source and target to match) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nd harden provider
ConceptMap search (tx/ocl/cm-ocl.cjs):
- Implement searchConceptMaps for source-system/target-system parameters
by resolving the canonical URL to an OCL source, fetching all concepts
and their mappings, then aggregating into placeholder ConceptMaps
grouped by (source, target) pair with ID "{sourceId}-to-{targetId}"
- Return [] without filters to avoid expensive full-org mapping fetches
that caused 30s timeouts blocking the entire ConceptMap search page
Robustness (tx/ocl/cm-ocl.cjs):
- Wrap fetchConceptMap, fetchConceptMapById, and findConceptMapForTranslation
in try/catch so OCL HTTP errors never propagate to FHIRsmith core
- Extract #doFindConceptMapForTranslation with per-concept try/catch
FHIRsmith fixes (justified):
- tx/workers/search.js: add source-system and target-system to
ALLOWED_PARAMS — these are valid FHIR ConceptMap search parameters
that were silently discarded before reaching any provider
- tx/library/renderer.js: fix TypeError in renderComplexConceptMapGroup
— td().colspan() does not exist, replaced with td().setAttribute()
Tests:
- Rewrite tests/ocl/ocl-cm-provider.test.js with 24 tests covering
constructor, assignIds, fetchConceptMapById, fetchConceptMap,
searchConceptMaps (aggregation, error handling, validation),
findConceptMapForTranslation (concept lookup, dedup, error safety)
- Fix tests/ocl/ocl-display-language.test.js to load lang.dat for
proper language matching in preferredDesignation tests
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The test for missing system parameter was checking for 'sourceSystem' (a ConceptMap search parameter) instead of the actual error message returned by the $translate operation. Co-Authored-By: Claude Opus 4.6 (1M context) <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.
This pull request introduces improvements and bug fixes related to language handling in ValueSet expansion, concept mapping, and renderer table output. The most significant changes are the addition of comprehensive regression and integration tests for language fallback behavior, a bug fix in concept map matching logic, and refactoring of renderer table cell attribute setting for better HTML standards compliance.
Language handling and regression tests:
tests/ocl/ocl-display-language.test.js)Concept map matching bug fix:
ConceptMapmatching logic to allow for cases where the target system is not specified, improving robustness in concept mapping queries. (tx/library/conceptmap.js)OCLConceptMapProviderby catching API errors and treating them as "not found" instead of propagating exceptions. (tx/ocl/cm-ocl.cjs) [1] [2]Renderer table output refactor:
setAttribute('colspan', ...)instead of.colspan(...), ensuring proper HTML output and compatibility. (tx/library/renderer.js) (Fbe1929eR1800, Fbe1929eR1858, Fbe1929eR1944, Fbe1929eR2072)These changes collectively improve the reliability and standards compliance of language display, concept mapping, and HTML rendering in the codebase.