Skip to content

fix(ocl): make OCL ConceptMaps work with $translate - #306

Open
italomacedo wants to merge 2 commits into
mainfrom
fix/ocl-map-type-relationships
Open

italomacedo wants to merge 2 commits into
mainfrom
fix/ocl-map-type-relationships

Conversation

@italomacedo

@italomacedo italomacedo commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Two bugs in the OCL ConceptMap provider made $translate fail for OCL mappings.

1. Non-FHIR relationship codes. OCL map_type values were mapped to narrower-than / broader-than, which are not ConceptMapRelationship codes, so $translate discarded those mappings: only SAME-AS mappings ever translated.

  • SAME-AS → equivalent
  • NARROWER-THAN → source-is-narrower-than-target
  • BROADER-THAN → source-is-broader-than-target
  • NOT-SAME-AS / NOT-EQUIVALENT → not-related-to
  • anything else → related-to

The map type is also normalised (case, spaces and underscores).

2. OCL repo paths declared as ConceptMap scopes. $translate resolves a ConceptMap's sourceScope as a ValueSet and fails the operation with not-found when it cannot. The provider set sourceScopeUri / targetScopeUri to OCL repo paths (from_source_url, from_collection_url) or, for aggregated maps, to CodeSystem canonicals, none of which is a ValueSet:

The value set '/orgs/MS/sources/BRCIAP2/', which is the source scope of the ConceptMap '/orgs/MS/sources/BRCIAP2/mappings/6888/', could not be found

The scopes are now left unset; the group's source/target carry the systems.

Unit tests cover both. Verified end to end against a live OCL instance: BRCIAP2 K86 → BRCID10 I10 (equivalence wider), and A99 → all 40 of its mappings.

🤖 Generated with Claude Code

italomacedo and others added 2 commits October 6, 2026 09:46
OCL NARROWER-THAN / BROADER-THAN were emitted as the non-FHIR codes
'narrower-than' / 'broader-than', so $translate discarded them. Map them
to the R5 ConceptMapRelationship codes (source-is-narrower-than-target,
source-is-broader-than-target), accept NOT-SAME-AS as not-related-to,
and normalise spacing/underscore variants of the map type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
$translate resolves a ConceptMap's sourceScope as a ValueSet and checks the
code against it, failing the whole operation with not-found when it cannot.
The OCL provider set sourceScopeUri/targetScopeUri to OCL repo paths
(from_source_url, from_collection_url) or, for aggregated maps, to CodeSystem
canonicals, none of which is a ValueSet, so every OCL translation failed:

  The value set '/orgs/MS/sources/BRCIAP2/', which is the source scope of the
  ConceptMap '/orgs/MS/sources/BRCIAP2/mappings/6888/', could not be found

Leave the scopes unset; the group's source/target carry the systems. Verified
against the live OCL instance: BRCIAP2 K86 -> BRCID10 I10, A99 -> 40 matches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@italomacedo italomacedo changed the title fix(ocl): translate OCL map types to FHIR R5 relationship codes fix(ocl): make OCL ConceptMaps work with $translate Oct 6, 2026
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