Published on: 2024-01-23. 🔗 Permalink

How and why to use ConceptMap/$closure

The FHIR services $expand, $lookup, $validate-code, $subsumes, $translate already cover many use cases. However, they cannot integrate terminology-based logic in their queries or enable logical conclusions. This is relevant in some cases and is provided by the FHIR service $closure. The approach of the FHIR service $closure enables the generation of a table (ConceptMap) based on a transitive closure, which contains all transitive subsumption relationships. Thus, the transitive closure contains the relations between each concept and all superordinate concepts or ancestors. As an example, the following relations of ICD-10 codes are given:

  • E11 is a super concept of E11.9
  • E11.9 is a super concept of E11.91.

The transitive closure also contains the relations with indirect super concepts. In the example, this would be

  • E11 is a superordinate concept of E11.91.

To summarize, the approach of the transative closure and thus the use of the FHIR service $closure is a very efficient method to check the subsumption between concepts. This can significantly improve the performance of systems compared to issuing iterative $subsumes queries, especially when analyzing data from large terminologies.

To execute a $closure query, the table (ConceptMap) for the transitive closure must first be initialized by defining a name for it.

{
  "resourceType" : "Parameters",
   "parameter" : [{
     "name" : "name",
     "valueString" : "closure-TermServ"
  }]
}

The concepts of a CodeSystem to which $closure is to be applied must then be specified. In the example shown here, the following three ICD-10-GM codes are used (with German displays):

  • E11 (Diabetes mellitus, Typ 2)
  • E11.91 (Diabetes mellitus, Typ 2 : Ohne Komplikationen : Als entgleist bezeichnet)
  • K29.7 (Gastritis, nicht näher bezeichnet)

However, entire CodeSystems are also possible. The POST request to {url_server}/$closure looks like this:

{
  "resourceType" : "Parameters",
  "parameter" : [{
    "name" : "name",
    "valueString" : "closure-test-termServX"
  }, {
    "name" : "concept",
    "valueCoding" : {
       "system" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm",
       "code" : "E11.91",
       "display" : "Diabetes mellitus, Typ 2 : Ohne Komplikationen : Als entgleist bezeichnet"
    }
  }, {
    "name" : "concept",
    "valueCoding" : {
       "system" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm",
       "code" : "E11",
       "display" : "Diabetes mellitus, Typ 2"
    }
  }, {
    "name" : "concept",
    "valueCoding" : {
       "system" : "http://fhir.de/CodeSystem/bfarm/icd-10-gm",
       "code" : "K29.7",
       "display" : "Gastritis, nicht näher bezeichnet"
    }
  }
  ]
}

The request returns the following ConceptMap:

{
    "resourceType": "ConceptMap",
    "version": "2",
    "name": "closure-termServ",
    "status": "active",
    "experimental": false,
    "date": "2024-01-22T13:41:10+00:00",
    "group": [
        {
            "source": "http://fhir.de/CodeSystem/bfarm/icd-10-gm",
            "sourceVersion": "2023",
            "target": "http://fhir.de/CodeSystem/bfarm/icd-10-gm",
            "targetVersion": "2023",
            "element": [
                {
                    "code": "E11.91",
                    "target": [
                        {
                            "code": "E11",
                            "equivalence": "subsumes"
                        }
                    ]
                }
            ]
        }
    ]
}

This shows that a subsumption relationship was determined between the two ICD-10 codes E11.91 and E11. The ICD-10 code K27.9, on the other hand, does not have any relation to the other two codes. For this reason, ICD-10 code K27.9 is also not included in the ConceptMap.

It should be noted that a ConceptMap is only returned if the terminology conditions have changed. Examples of this are the addition of new codes or a different version for the codes. If no changes have occured, the result looks like this:

{
    "resourceType": "ConceptMap",
    "version": "3",
    "name": "closure-termServ",
    "status": "active",
    "experimental": false,
    "date": "2024-01-22T13:50:17+00:00"
}

Sources: