Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Introduction

Bahmni Line reports offer flexible configuration options to seamlessly integrate with a series of extensions, enhancing functionalities like custom report generation. Among these extensions is the ICD-10 extension, a module designed for mapping SNOMED codes to ICD-10 codes within Bahmni Reports. This extension supports ICD-10 mapping in both Snowstorm and Snowstorm Lite environments.

Configuring Extensions

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

"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 extensions attribute specifies the fully qualified extension class names that should be in the class path and used to extend the report's functionality.

Without extensions: The raw result set, which is a collection of rows of data, is passed directly to the Jasper Report Builder for rendering.
With extensions: The result set is transformed into a map collection, which is a more efficient way to enrich data. Each extension class uses reflection to access and enrich the data in the map collection. The extension class can then pass the enriched data to the next extension class in the chain. The processed result set is passed subsequently to the Jasper Report Builder for rendering.

The extension JAR file is mounted in the Bahmni Reports Docker image using a Docker volume in the docker-compose file. This ensures that the extension class is available to the image.

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

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 for Snowstorm borrows the same mechanism of the ICD-10 mappings Demonstrator found here: 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

  • For example, 447562003 is the SNOMED code for SNOMED CT to ICD-10 extended map is a map reference set for mapping SNOMED Code to ICD-10 code(s)

  • To use the reference set, you pass the SNOMED code as a parameter to the reference set in the form of an ECL query. ECL is a language used to query SNOMED CT concepts.

^[*] 447562003 |ICD-10 complex map reference set| {{ M referencedComponentId = "[SNOMED CODE]" }}

For example

^[*] 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.

{
  "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" ]
}

The following attributes from each rule are used to determine the target ICD-10 code(s):

MapGroup – This contains a set of rules that are grouped together. These rules determine which ICD-10 code will be chosen

MapPriority – Each rule in MapGroup is given a priority. This indicates the priority of the sequence of the rules to be executed in a MapGroup. Eg, if MapPriority is 1, then this rule will be executed first, followed by 2, 3 and so on

MapRule – This is the actual rule to determine which target map (ICD-10 code) will be chosen for the corresponding SNOMED Code

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:

https://browser.ihtsdotools.org/snowstorm/snomed-ct/MAIN/SNOMEDCT-ES/2022-10-31/concepts?offset=0&limit=100&termActive=true&ecl=^[*] 447562003 |ICD-10 complex map reference set| {{ M referencedComponentId = "440311000124109" }}

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

icd.baseUrl=https://browser.ihtsdotools.org/snowstorm/snomed-ct/MAIN/SNOMEDCT-ES/2022-10-31/concepts
icd.eclUrl=^[*] 447562003 |ICD-10 complex map reference set| {{ M referencedComponentId = %s }}
  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.

ICD-10 Mapping in Snowstorm Lite

FHIR API

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

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.

{
  "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

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.

  • No labels