Skip to content

$translate returns no results for non-equivalent mappings (wider, narrower, etc.) #61

@jmandel

Description

@jmandel

Summary

$translate silently returns "No translations found" for any ConceptMap mapping with a non-equivalent equivalence type (wider, narrower, subsumes, specializes, inexact, relatedto). Only equivalent mappings produce results.

Root cause

In tx/workers/translate.js line ~270, translateUsingGroups checks map.relationship against R4 equivalence names (wider, narrower, subsumes, etc.). But _convertEquivalenceToRelationship in tx/library/conceptmap.js has already converted these to R5 relationship names (source-is-broader-than-target, source-is-narrower-than-target, etc.). Only equivalent matches because it's the same string in both R4 and R5.

Repro

# POST with an inline ConceptMap having wider+narrower equivalences
curl -s -H 'Content-Type: application/fhir+json' -H 'Accept: application/fhir+json' \
  -X POST 'https://tx-dev.fhir.org/r4/ConceptMap/$translate' \
  -d '{"resourceType":"Parameters","parameter":[{"name":"sourceCode","valueCode":"x"},{"name":"sourceSystem","valueUri":"http://example.org/cs1"},{"name":"targetSystem","valueUri":"http://example.org/cs2"},{"name":"tx-resource","resource":{"resourceType":"ConceptMap","url":"http://example.org/cm-test","status":"active","group":[{"source":"http://example.org/cs1","target":"http://example.org/cs2","element":[{"code":"x","target":[{"code":"X1","equivalence":"wider"},{"code":"X2","equivalence":"narrower"}]}]}]}}]}'

Prod (tx.fhir.org): result: true with 2 matches — X1 (Wider) and X2 (Narrower)
Dev (tx-dev.fhir.org): result: false, "No translations found"

Impact

All ConceptMap translations with wider, narrower, subsumes, specializes, inexact, or relatedto equivalences silently produce no results. This affects most real-world clinical mappings (e.g., FHIR-to-v2 contact point use, data absent reason maps).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions