Modeling decision rule

Print Friendly, PDF & Email

◷ Reading Time: 2 minutes

Modeling decision rules is very similar to the Validation rule. The only difference in modeling is you need to use the <Decision> command instead of the <Validation> command.

Here is an example:

<Decision name="Diagnosis treatment">
  <Declaration>
    <Alias logic="DiagnosisContains" />
    <Alias logic="MandatoryContains" />
    <Alias logic="OptionalContains" />
    <Alias logic="InvalidatorContains" />
    <Alias logic="AddResult" />
    <Alias logic="RemoveResult" />
 
    <Define name="results" direction="in"/>
  </Declaration>
 
  <Logic name="Primary Diagnosis Criteria">
    <And>
      <DiagnosisContains value='"111.00"'/>
      <DiagnosisContains value='"111.01"'/>
      <DiagnosisContains value='"111.02"'/>
      <DiagnosisContains value='"111.03"'/>
      <DiagnosisContains value='"111.04"'/>
    </And>
  </Logic>
 
 
  <Logic name="row">
    <And>
      <Validate logic="row-selector"/>
      <Validate logic="row-invalidator"/>
    </And>
  </Logic>
 
  <Logic name="row-selector">
    <And>
      <Validate logic="Primary Diagnosis Criteria"/>
      <Validate logic="Treatment Lines Criteria"/>
      <Validate logic="Clinical Attribute Criteria"/>
    </And>
    <Then>
      <AddResult value='"Regimen 1"'/>
      <AddResult value='"Regimen 2"'/> 
    </Then>
  </Logic>
 
  <Logic name="row-invalidator">
    <And> 
      <Validate logic="Treatment Invalidators"/>
    </And>
    <Then>
      <RemoveResult value ='"Regimen 1"'/>
      <RemoveResult value ='"Regimen 2"'/>
    </Then>
  </Logic>
 
  <Logic name="Treatment Lines Criteria">
    <And>
      <And message="Mandatory treatments mismatched">
        <MandatoryContains value='"J1111"'/>
        <MandatoryContains value='"J1112"'/>
      </And>
      <Or>
        <OptionalContains value='"J1113"'/>
        <OptionalContains value='"J1114"'/>
        <True/>
      </Or>
    </And>
  </Logic>
 
  <Logic name="Treatment Invalidators">
    <Or>
      <InvalidatorContains value='"J1111"'/>
    </Or>
  </Logic>
 
  <Logic name="Clinical Attribute Criteria">
    <And>
      <And>
        <Check value="Attributes.ECOGS le 4"/>
        <Check value="Attributes.ECOGS ge 1"/>
      </And>
      <Or>
        <Check value="Attributes.Stage == 1"/>
        <Check value="Attributes.Stage == 2"/>
      </Or>
    </And>
  </Logic>
 
 
  <Include source="ruleset://rules/treatments/Common/AddResult"/>
  <Include source="ruleset://rules/treatments/Common/DiagnosisContains"/>
  <Include source="ruleset://rules/treatments/Common/InvalidatorContains"/>
  <Include source="ruleset://rules/treatments/Common/ListContains"/>
  <Include source="ruleset://rules/treatments/Common/MandatoryContains"/>
  <Include source="ruleset://rules/treatments/Common/OptionalContains"/>
  <Include source="ruleset://rules/treatments/Common/RemoveResult"/>
  <Include source="ruleset://rules/treatments/Common/TreatmentCodeContains"/>
</Decision>
Updated on July 12, 2019

Was this article helpful?

Related Articles