Bahmni Line reports can be configured to integrate with a chain of extensions that provide additional functionality, such as the ability to generate custom reports. One such extension is the ICD-10 extension. The SNOMED to ICD-10 mapping extension module for Bahmni Reports allows users to map SNOMED codes to ICD-10 codes within Bahmni Reports.
Configuring Extensions
The following configuration sample shows how to configure a SNOMED Diagnosis Line Report to use 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
About ICD Mappings Demonstrator
ICD-10 Reports Extension borrows the same mechanism of the ICD-10 mappings Demonstrator found below:
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.
ICD Maps API under the hood
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 forSNOMED 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
API response: 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 is as follows:
For each row of data, identify the SNOMED code i.e. Excessive growth rate(440311000124109)
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 }}
Order the mapping rules by mapGroup and then by mapPriority.
For each mapGroup, iterate over the rules in ascending order of priority and evaluate them until a matching mapTarget is found.
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.
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.