Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Introduction

Bahmni Line reports can be configured to Reports offer flexible configuration options to seamlessly integrate with a chain series of extensions that provide additional functionality, such as the ability to generate custom reports. One such extension , enhancing functionalities like custom report generation. Among these extensions is the ICD-10 extension. The SNOMED , a module designed for mapping SNOMED codes to ICD-10 mapping extension module for Bahmni Reports allows users to map SNOMED codes to ICD-10 codes within Bahmni Reports.codes within Bahmni Reports. This extension supports ICD-10 mapping in both Snowstorm and Snowstorm Lite environments. Snowstorm Lite is a compact FHIR terminology server tailored for low-resource settings.

SNOMED to ICD-10 Line Report Screenshot

Given below is an example of a SNOMED Diagnosis Line Report with SNOMED to ICD-10 mapping

...

Configuring Extensions

The following provided configuration sample shows example illustrates how to configure set up a SNOMED Diagnosis Line Report to use utilise the ICD-10 extension

Code Block
"diagnosisICDLineReportClinicalFindings": {
    "name": "SNOMED Diagnosis Line Report(ICD) for Clinical Findings",
    "type": "fhirTSLookupDiagnosisLine",
    "requiredPrivilege": "app:reports",
    "config": {
        "tsConceptSource": "SCT",
        "conceptNameDisplayFormat": "shortNamePreferred",
        "terminologyParentCode": "404684003",
        "displayTerminologyCode": "true",
        "terminologyColumnName": "SNOMED Code",
        "patientAttributes": [
        ],
        "patientAddresses": [
        ],
        "extensions": ["org.bahmni.reports.extensions.icd10.Icd10ResultSetExtension"]
    }
},

...

The extension JAR file is mounted in the Bahmni Reports Docker image container using a Docker volume in the docker-compose file. This ensures that the extension class is available to the image. The following line needs to be uncommented in the reports service for the extension to get activated.

Code Block
  reports:
    image: bahmni/reports:${REPORTS_IMAGE_TAG:?}
    ...
    volumes:
      - "${REPORTS_EXTENSIONS_CONFIG_PATH:?}../snomed-resources/icd10-extensions-1.0.0-SNAPSHOT.jar:/var/run/bahmni-reports/bahmni-reports/WEB-INF/lib/icd10-extensions-1.0.0-SNAPSHOT.jar:ro"

After uncommenting, update reports container by running docker compose up -d reports

ICD-10 Extension Repository

Source Code Repository for ICD-10 reports extension is as follows:

...

https://github.com/Bahmni/bahmni-reports-extension-icd10

Typically all the report extensions should implement the enrich method from the interface org.bahmni.reports.extensions.ResultSetExtension

...

Mapping ICD-10 in a Snowstorm Environment

ICD-10 Reports Extension extension for Snowstorm borrows the same mechanism of the ICD-10 mappings Demonstrator found belowhere:

...

https://ihtsdo.github.io/iid-icd-maps/

...

The screenshot shows that the SNOMED CT code 421671002 matches the ICD-10 codes B20.8 and J17.8 (see green check mark) for a given age and gender.

...

Native API

...

SNOMED codes are mapped to ICD-10 codes by filtering a reference rule set based on the SNOMED code, patient age, and gender

...

^[*] 447562003 |ICD-10 complex map reference set| {{ M referencedComponentId = 421671002 }}MED CT to ICD-10 extended mapSNOMED CT to ICD-10 extended map

...

The response comprise of a list of rules for mapping the given SNOMED code to ICD codes.

Code Block
{
  "items" : [ {
    "active" : true,
    "fsn" : { },
    "pt" : { },
    "fields" : [ "referencedComponentId", "correlationId", "mapAdvice", "mapCategoryId", "mapGroup", "mapPriority", "mapRule", "mapTarget" ],
    "referencedComponentId" : "421671002",
    "mapCategoryId" : "447637006",
    "mapRule" : "TRUE",
    "mapAdvice" : "ALWAYS B20.8",
    "mapPriority" : "1",
    "mapGroup" : "1",
    "correlationId" : "447561005",
    "mapTarget" : "B20.8"
  }, {
    "active" : true,
    "fsn" : { },
    "pt" : { },
    "fields" : [ "referencedComponentId", "correlationId", "mapAdvice", "mapCategoryId", "mapGroup", "mapPriority", "mapRule", "mapTarget" ],
    "referencedComponentId" : "421671002",
    "mapCategoryId" : "447637006",
    "mapRule" : "TRUE",
    "mapAdvice" : "ALWAYS J17.8 | THIS CODE MAY BE USED IN THE PRIMARY POSITION WHEN THE MANIFESTATION IS THE PRIMARY FOCUS OF CARE",
    "mapPriority" : "1",
    "mapGroup" : "2",
    "correlationId" : "447561005",
    "mapTarget" : "J17.8"
  } ],
  "total" : 2,
  "limit" : 100,
  "offset" : 0,
  "searchAfter" : "WyJjMTg0ZWQ1Zi1lOTQwLTUyZGEtOTU2MS0xZGViYjRhYWUzZjUiXQ==",
  "searchAfterArray" : [ "c184ed5f-e940-52da-9561-1debb4aae3f5" ]
}

...

MapTarget – the target ICD-10 code which will be mapped to SNOMED Code

Algorithm to extract ICD-10 code(s)

The algorithm for mapping SNOMED codes to ICD-10 codes using Snowstorm is as follows:

  1. For each row of data, identify the SNOMED code i.e. Excessive growth rate(440311000124109)

  2. Use the following API to get the unordered ICD-10 mapping rules for the given SNOMED code:

...

  1. Order the mapping rules by mapGroup and then by mapPriority.

  2. For each mapGroup, iterate over the rules in ascending order of priority and evaluate them until a matching mapTarget is found.

  3. To evaluate each rule, the system uses the javax.script.ScriptEngine evaluator to convert the rule into a JavaScript expression and then evaluates the expression. The evaluator can optionally take into account the patient's age and gender.

  4. If the JavaScript expression evaluates to true, then the corresponding mapTarget has the matching ICD-10 code for the given mapGroup. The system collects these codes into an ArrayList of matching ICD-10 codes.

  5. The ICD-10 codes that are generated by the mapping process will be displayed in the enriched column of the report.

Mapping ICD-10 in a Snowstorm Lite Environment

FHIR API

This API uses the following URL template configuration from the application.properties file:

Code Block
icd.lite.urlTemplate=http://snowstorm-lite:8080/fhir/ConceptMap/$translate?code=%s&system=http://snomed.info/sct&targetsystem=http://hl7.org/fhir/sid/icd-10

The response comprise of a list of rules for mapping the given SNOMED code to ICD codes.

Code Block
{
  "resourceType": "Parameters",
  "parameter": [
    {
      "name": "result",
      "valueBoolean": false
    },
    {
      "name": "message",
      "valueString": "Please observe the following map advice. Group:1, Priority:1, Rule:TRUE, Advice:'ALWAYS B20.8', Map Category:'447637006'."
    },
    {
      "name": "match",
      "part": [
        {
          "name": "equivalence",
          "valueCode": "unmatched"
        },
        {
          "name": "concept",
          "valueCoding": {
            "system": "http://hl7.org/fhir/sid/icd-10",
            "code": "B20.8"
          }
        },
        {
          "name": "source",
          "valueString": "http://snomed.info/sct/900000000000207008/version/20230731?fhir_cm=447562003"
        }
      ]
    },
    {
      "name": "message",
      "valueString": "Please observe the following map advice. Group:2, Priority:1, Rule:TRUE, Advice:'ALWAYS J17.8 | THIS CODE MAY BE USED IN THE PRIMARY POSITION WHEN THE MANIFESTATION IS THE PRIMARY FOCUS OF CARE', Map Category:'447637006'."
    },
    {
      "name": "match",
      "part": [
        {
          "name": "equivalence",
          "valueCode": "unmatched"
        },
        {
          "name": "concept",
          "valueCoding": {
            "system": "http://hl7.org/fhir/sid/icd-10",
            "code": "J17.8"
          }
        },
        {
          "name": "source",
          "valueString": "http://snomed.info/sct/900000000000207008/version/20230731?fhir_cm=447562003"
        }
      ]
    }
  ]
}

Algorithm to extract ICD-10 code(s)

The algorithm for mapping SNOMED codes to ICD-10 codes is as follows:

  1. Categorise the parameters from the response list into two separate lists, namely, message parameters and match parameters, based on their names.

  2. Create a list of mapping rules for each pair of message and match parameters. The MapGroup, MapPriority, MapRule attributes are extracted from message parameter using the regex below. Also the MapTarget is extracted from match parameter

Code Block
Please observe the following map advice\\. Group:([0-9]+), Priority:([0-9]+), Rule:([^,]+), Advice:'([^']*)', Map Category:'([^']*)'."
  1. Order the mapping rules by mapGroup and then by mapPriority.

  2. For each mapGroup, iterate over the rules in ascending order of priority and evaluate them until a matching mapTarget is found.

  3. To evaluate each rule, the system uses the javax.script.ScriptEngine evaluator to convert the rule into a JavaScript expression and then evaluates the expression. The evaluator can optionally take into account the patient's age and gender.

  4. If the JavaScript expression evaluates to true, then the corresponding mapTarget has the matching ICD-10 code for the given mapGroup. The system collects these codes into an ArrayList of matching ICD-10 codes.

  5. The ICD-10 codes that are generated by the mapping process will be displayed in the enriched column of the report.