For AI agents: the documentation index is at /docs/aidbox/llms.txt. A Markdown version of this page is available at /docs/aidbox/notebooks.md or by requesting it with the Accept: text/markdown header.
Aidbox Docs
All notebooks

FHIR ConceptMap Resource and translation

Learn how to translate concepts between CodeSystems

7 cells · updated Nov 15, 2021

This is a read-only view. Responses shown were saved when the notebook was published — open it in your own Aidbox to run the cells against live data.
REST Send Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
POST /fhir/ConceptMap
content-type: text/yaml
accept: text/yaml

resourceType: ConceptMap
id: "101"
url: http://hl7.org/fhir/ConceptMap/101
status: draft
sourceUri: http://hl7.org/fhir/ValueSet/address-use
targetUri: http://terminology.hl7.org/ValueSet/v3-AddressUse
group:
  - source: http://hl7.org/fhir/address-use
    target: http://terminology.hl7.org/CodeSystem/v3-AddressUse
    element:
      - code: home
        display: home
        target:
          - code: H
            display: home
            equivalence: equivalent
      - code: work
        display: work
        target:
          - code: WP
            display: work place
            equivalence: equivalent
      - code: temp
        display: temp
        target:
          - code: TMP
            display: temporary address
            equivalence: equivalent
      - code: old
        display: old
        target:
          - code: BAD
            display: bad address
            equivalence: disjoint
            comment: In the HL7 v3 AD, old is handled by the usablePeriod element, but you have to provide a time, there's no simple equivalent of flagging an address as old
Response: Body
Status: 201
url: http://hl7.org/fhir/ConceptMap/101
status: draft
id: '101'
resourceType: ConceptMap
meta:
  lastUpdated: '2021-11-12T09:45:21.347913Z'
  versionId: '70'
  extension:
  - {url: 'ex:createdAt', valueInstant: '2021-11-12T09:45:21.347913Z'}
sourceUri: http://hl7.org/fhir/ValueSet/address-use
targetUri: http://terminology.hl7.org/ValueSet/v3-AddressUse

$translate approach

You can use the FHIR $translate operation to translate codes between CodeSystems.

Let's translate home code:

REST Send Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
GET /fhir/ConceptMap/101/$translate?code=home&system=http://hl7.org/fhir/address-use&target=http://terminology.hl7.org/ValueSet/v3-AddressUse&source=http://hl7.org/fhir/ValueSet/address-use
Response: Body
Status: 200
{
  "resourceType": "Parameters",
  "parameter": [
    {
      "name": "result",
      "valueBoolean": true
    },
    {
      "name": "match",
      "part": [
        {
          "name": "equivalence",
          "valueCode": "equivalent"
        },
        {
          "name": "concept",
          "valueCoding": {
            "system": "http://terminology.hl7.org/CodeSystem/v3-AddressUse",
            "code": "H",
            "display": "home",
            "userSelected": false
          }
        },
        {
          "name": "source",
          "valueUri": "http://hl7.org/fhir/ConceptMap/101"
        }
      ]
    }
  ]
}
REST Send Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
GET /fhir/ConceptMapRule?.source=http://hl7.org/fhir/address-use&.target=http://terminology.hl7.org/CodeSystem/v3-AddressUse&.element.code=home&_elements=.element.target
Response: Body
Status: 200
{
  "resourceType": "Bundle",
  "type": "searchset",
  "meta": {
    "versionId": "70"
  },
  "total": 1,
  "link": [
    {
      "relation": "first",
      "url": "/fhir/ConceptMapRule?.source=http://hl7.org/fhir/address-use&.target=http://terminology.hl7.org/CodeSystem/v3-AddressUse&.element.code=home&_elements=.element.target&page=1"
    },
    {
      "relation": "self",
      "url": "/fhir/ConceptMapRule?.source=http://hl7.org/fhir/address-use&.target=http://terminology.hl7.org/CodeSystem/v3-AddressUse&.element.code=home&_elements=.element.target&page=1"
    }
  ],
  "entry": [
    {
      "resource": {
        "element": {
          "target": [
            {
              "code": "H",
              "display": "home",
              "equivalence": "equivalent"
            }
          ]
        },
        "id": "7378326f-d142-43d5-8ef4-97cdad65d159",
        "resourceType": "ConceptMapRule"
      },
      "fullUrl": "https://rbx1.edge.aidbox.app/ConceptMapRule/7378326f-d142-43d5-8ef4-97cdad65d159",
      "link": [
        {
          "relation": "self",
          "url": "https://rbx1.edge.aidbox.app/ConceptMapRule/7378326f-d142-43d5-8ef4-97cdad65d159"
        }
      ]
    }
  ]
}