Decision Model “Patient Therapy”

Building Decision Model in Excel
Testing Decision Model

Business Logic

This decision model specifies decision logic for helping a doctor to determine a patient therapy after the doctor determined that the patient has Acute Sinusitis. Here are the medical guidelines for this case.

Medication Rules:
If Patient is 18 years old or older, then a therapy choice is Amoxicillin.
If Patient is younger than 18, a therapy choice is Cefuroxime.
If Patient Penicillin allergic, the therapy of choice is Levofloxacin.

Dosing Rules:
For patients between 15 and 60, the dose is 500mg every 24 hours for 14 days.
If Patient’s creatinine level (PCr) > 1.4, commence creatinine clearance (CCr) calculations according to the formula: If Patient’s creatinine clearance < 50 ml/min, then the dose is 250 mg every 24 hours for 14 days.

Drug Interaction Rules:
Check if a patient on active medication. Coumadin and Levofloxacin can result in reduced effectiveness of Coumadin. Produce the proper warning.

Building Decision Model in Excel

    1. The ultimate goal “Patient Therapy” can be presented in the decision table “DeterminePatientTherapy”:

The condition in the first allows us to limit our decision model to the Encounter Diagnosis “Acute Sinusitis” only. From the definition of the Patient Therapy we may conclude that we need to specify 3 sub-goals:

    • Recommended Medication
    • Recommended Dose
    • Drug Interaction Warning

2. To specify the sub-goal “Recommended Medication” we can use the following decision table:

 

This is a multi-hit decision table to allow us to override a recommended medication if the patient is allergic to Penicillin. 

3. To specify the sub-goal “Recommended Dose” we can use the following decision table:

While Patient Age and Patient Creatinine Level should be known, to define Recommended Dose we need first to calculate Patient Creatinine Clearance using the above formula.  It can be done using the following unconditional table:

4. And finally we can define “Drug Interaction Warning” using the following decision table:

To complete our decision model we need to put all decision variables (goals and input variables used in the above tables) in one Glossary:

We placed all these 4 decision tables in the file “rules/Rules.xls”.

Testing Decision Model

To test this model,  we create test-cases in Excel using the following tables:

    1. Datatype tables that specifies our business concepts Patient and DoctorVisit:

             

    2. Data tables that specifies test-patients and test-visits:



    3. Test cases with expected results defined in this table:

We placed all these tables in the file “rules/Test.xls”. We also created the file “rules/DecisionModel.xls” that contains only one table that tells OpenRules where all related files are located:
To execute these test-cases, we should adjust the standard file “settings.bat“:

To execute these test-cases, we may simply double-click on the standard bat-files:

    • build.bat that will automatically determine all dependencies within the decision model and transforms the model in the executable code
    • run.bat that will execute the model producing the following results for the first test-case:

We received one MISMATCH: the calculated Patient Creatinine Clearance is 44.416667 while we expected a rounded number 44.42. To avoid this mismatch we can replace the table “CalculateCreatinineClearance” with this one:

This table is using a Java snippet with macros to access our decision variables. The method “format(..)” rounds the result to 2 digits after the decimal point. After build.bat and run.bat we receive the following results:

They are the same but the Patient Creatinine Clearance was calculated as expected without a mismatch.

Here is the automatically generated HTML report that explains which rules were actually executed and why: