Published on: 2024-01-23. πŸ”— Permalink

How and why to use CodeSystem/$find-matches

The FHIR service $find-matches is used to search a CodeSystem on the basis of defined properties. The result is a set of codes that match the properties. The following CodeSystem has been defined to illustrate the FHIR service $find-matches:

{
  "resourceType": "CodeSystem",
  "id": "example-find-matches-codesystem",
  "url": "https://mii-termserv.de/fhir/CodeSystem/example-find-matches-codesystem",
  "name": "Uebersteigeschlussel - ICD10 - Mapping",
  "status": "active",
  "property": [
    { "code": "parent", "type": "code" }
  ],
  "content": "complete",
  "concept": [
    {
      "code": "E11",
      "display": "Diabetes mellitus, Typ 2"
    },
    {
      "code": "E11.9",
      "display": "Diabetes mellitus, Typ 2 : Ohne Komplikationen",
      "property": [{ "code": "parent", "valueCode": "E11" }]
    },
    {
      "code": "E11.90",
      "display": "Diabetes mellitus, Typ 2 : Ohne Komplikationen : Nicht als entgleist bezeichnet",
      "property": [{ "code": "parent", "valueCode": "E11.9" }]
    },
    {
      "code": "E11.91",
      "display": "Diabetes mellitus, Typ 2 : Ohne Komplikationen : Als entgleist bezeichnet",
      "property": [{ "code": "parent", "valueCode": "E11.9" }]
    }
  ]
}

This CodeSystem contains four ICD10 codes that describe diabetes, type 2. A property called parent was also defined, which can contain the direct ancestors of a code.

With the help of the FHIR service $find-matches, the defined CodeSystem is now to be searched using the property β€œparent”. For this purpose, a POST request is sent to {url_server}/CodeSystem/$find-matches:

{
    "resourceType": "Parameters",
    "id": "find-matches",
    "parameter": [
        {
            "name": "system",
            "valueUri": "https://mii-termserv.de/fhir/CodeSystem/example-find-matches-codesystem"
        },
        {
            "name": "exact",
            "valueBoolean": false
        },
        {
            "name": "property",
            "part": [
                {
                    "name": "code",
                    "valueCode": "parent"
                },
                {
                    "name": "value",
                    "valueCode": "E11.9"
                }
            ]
        }
    ]
}

The following parameters are relevant here:

  • system: URL of the CodeSystem
  • property: Properties that should contain the codes of the result set.

In this exemplary request, all codes are returned that have the ICD10 code E11.9 as an ancestor. For the example CodeSystem, these would be the ICD10 codes E11.91 and E11.90:

{
    "resourceType": "Parameters",
    "parameter": [
        {
            "name": "match",
            "part": [
                {
                    "name": "code",
                    "valueCoding": {
                        "system": "https://mii-termserv.de/fhir/CodeSystem/example-find-matches-codesystem",
                        "code": "E11.91",
                        "display": "Diabetes mellitus, Typ 2 : Ohne Komplikationen : Als entgleist bezeichnet"
                    }
                }
            ]
        },
        {
            "name": "match",
            "part": [
                {
                    "name": "code",
                    "valueCoding": {
                        "system": "https://mii-termserv.de/fhir/CodeSystem/example-find-matches-codesystem",
                        "code": "E11.90",
                        "display": "Diabetes mellitus, Typ 2 : Ohne Komplikationen : Nicht als entgleist bezeichnet"
                    }
                }
            ]
        }
    ]
}

Source: