Skip to content

Feature/ocl display language support, concept mapping, concept map rendering.#179

Open
italomacedo wants to merge 4 commits intomainfrom
feature/ocl-display-language-support
Open

Feature/ocl display language support, concept mapping, concept map rendering.#179
italomacedo wants to merge 4 commits intomainfrom
feature/ocl-display-language-support

Conversation

@italomacedo
Copy link
Collaborator

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:

  • Added thorough regression and integration tests for display language fallback logic in OCL-backed ValueSet expansion, ensuring that a display value is always returned even when the requested language is not available. This guards against previous bugs where display could be omitted. (tests/ocl/ocl-display-language.test.js)

Concept map matching bug fix:

  • Fixed ConceptMap matching logic to allow for cases where the target system is not specified, improving robustness in concept mapping queries. (tx/library/conceptmap.js)
  • Improved error handling in OCLConceptMapProvider by catching API errors and treating them as "not found" instead of propagating exceptions. (tx/ocl/cm-ocl.cjs) [1] [2]

Renderer table output refactor:

  • Refactored renderer table cell code to use 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.

italomacedo and others added 4 commits March 19, 2026 11:46
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>
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