Implementing SMART Guideline Indicators in OpenMRS Reports

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)
  • 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. 

Steps: 

  • Add the parts you want to the CQL Module
    • 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 
    • 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: