Implementing SMART Guideline Indicators and CDS in OpenMRS

Requirements: 

  • Be running Java 11. The CQL Engine requires Java 11. Fortunately, the OpenMRS FHIR2 Module already supports Java 11 in terms of run-time. 

  • OpenMRS FHIR2 Module. 

  • OpenMRS Platform version 2.4.0 or higher (since this is when support from Java 11)

  • OpenMRS CQL-API Module.

  • OpenMRS Patient Flags Module.

  • Access to the FHIR IG with the SMART Guideline content you want (e.g. here is the ANC one and Here is one for the the HIV-DAK )

  • If you want to execute SMART indicators using the FHIR IG & CQL Engine tooling's evaluate-measure operation, you will need a Separate DB for Analytics (an absolute must for production implementations; if you just want to experiment with a prototype, you could skip). 

    • Rationale:

      • We do not recommend that any production implementation runs reports/indicators using measure reports because these run against the entire patient dataset, store this temporarily in memory, which would cause your production system to slow down dramatically. 

      • Reports in the OpenMRS EMR have historically used SQL, which is optimized at the DB level and sent to different database process, whereas CQL is running strictly at the memory level in JVM, and dealing with very verbose FHIR resources. 

 

High Level Overview of How the CDS Rules are Processed in OpenMRS

WHO-SMART.jpg

Steps: 

  • Add the necesary FHIR Resources From the IG

    • Currently the CQL Module comes out-of-the-box with the decision support rules for ANCDT01 and ANCDT17, as you can see here

    • Go to the FHIR IG of the WHO SMART Guidelines you want 

    • Create the folowing directories on your System where the CQL module will load the FHIR Resources from ie

      • /openmrs/dak/content/libraries . Here add the Library resources

      • /openmrs/dak/content/plandefinitions Hereadd the PlanDefinition resources

      • /openmrs/dak/terminology/ Here add the ValuesSets needed

      • Note : Incase youre running OPenMRS in docker , Create any Folders on your host machine , add the necesary FHIR Resources and mount the directories on your host machine to the coresponding directories defined above in the OpenMRS container

    • In case the above directories are not found , the CQL module will by default load the default FHIR resources packaged with the omod ie

      • Add any plandefinitions you want to the /plandefinitions directory (e.g. by downloading the desired ones from the FHIR IG)

      • Then, add any required valuesets, libraries, or measure to the corresponding directory. 

      • Then, please re-compile the CQL Module (eventually someone could build into the module a UI that gives end user amins the ability to pick and choose the CDS rules and Indicators they want, without requiring re-compiling the module). 

      • Note re. Customization: If you need to change a decision support rule, please note you will need to change the affiliated CQL expression and  the plan definition, and ensure you have the necessary value sets. 

  • Prepare your Concepts & Mappings in OpenMRS or OCL

  • Prepare Your Forms

    • You will need to ensure that the concepts for any information you need to collect in order to run the rules as desired are being collected somewhere in the EMR. An easy way to do this is through a Form; for instance, an ANC Initial Visit Form. 

    • e.g. using the O3 Form Builder GUI

  • Set up Flags: Set up the Flags in the Patient Flags Admin → Manage Flags

    • Set to "Custom" 

    • Set FlagEvaluatorClass to: org.openmrs.module.patientflags.evaluator.CQLFlagEvaluator

      org.openmrs.module.patientflags.evaluator.CQLFlagEvaluator
    • Then, in the Criteria, put the ID of the planDefintion, e.g.: ANCDT17 This is how the engine knows which planDefinition to use for the Flag evaluation. So for instance: 

      • ANC-related Sample Example: 

See OpenMRS project setup that can be run out of the box
Here is demo video of How CDS rules are implemented in OpenMRS

https://www.youtube.com/watch?v=0uz6hcNAXWU