rule_name rules
Examples of Rules
limitdef UWBC2 UWBC > 20 rangedef UWBC1 UWBC (5 20]
clausedef UWBC6 UWBC2 || UWBC4 ruledef UWBCABNH UWBC1 &&
URBCN && !URBC4
Reasoning Engine
• Forward chaining reasoning
– Data-driven reasoning
• Procedural approach part of this implementation
– Initiation of variables used in rules
• Processing rules
• Generating result codes
Examples of Encoding Domain Knowledge into Rules
• Some Hepatitis B Markers
– Hepatitis B surface antigen (HBsAg)
• Outer surface coat
– Hepatitis B surface antibody (HBsAb)
• Antibody to HBsAg
– Hepatitis B core antibody (HBcAb)
• Antibody to inner nucleocapsid core
Interpretation of Hepatitis B Markers
limitdef HBSAG_pos HBSAG == "+“
** HBsAg is positive
limitdef HBSAG_neg HBSAG == "-“
** HBsAg is negative
limitdef HBSAB_pos HBSAB == "+“
** HBsAb is positive
limitdef HBSAB_neg HBSAB == "-“
** HBsAb is negative
Interpretation of Hepatitis B Markers
limitdef HBCAB_pos HBCAB == "+“
** HBcAb is positive
limitdef HBCAB_neg HBCAB == "-“
** HBcAb is negative
Interpretation of Hepatitis B Markers
limitdef OLD_HBSAG_pos OLD_HBSAG == "+“
** any of the previous HBsAg tests is positive limitdef OLD_HBSAG_neg OLD_HBSAG == "-“
** all of the previous HBsAg tests are negative limitdef OLD_HBSAB_pos OLD_HBSAB == "+“
** any of the previous HBsAb tests is positive limitdef OLD_HBSAB_neg OLD_HBSAB == "-“
** all of the previous HBsAb tests are negative
Interpretation of Hepatitis B Markers
limitdef OLD_HBCAB_pos OLD_HBCAB
== "+“
** any of the previous HBcAb tests is positive
limitdef OLD_HBCAB_neg OLD_HBCAB
== "-“
** all of the previous HBcAb tests are negative
Interpretation of Hepatitis B Markers
ruledef HBSAG_nil !HBSAG_pos && !HBSAG_neg
** If HBsAg is not tested
ruledef HBSAB_nil !HBSAB_pos && !HBSAB_neg
** If HBsAb is not tested
ruledef HBCAB_nil !HBCAB_pos && !HBCAB_neg
** If HBcAb is not tested
ruledef HBCAB_diff HBCAB_neg && OLD_HBCAB_pos
** If HBcAb is negative now and any of the previous HBcAb tests is positive
Interpretation of Hepatitis B Markers
ruledef HBV_nnn HBSAG_neg && HBSAB_neg &&
HBCAB_neg && !AGE_50
** If HBsAg is negative, HBsAb is negative, HBcAb is negative, and age is less than 50
Interpretation of Hepatitis B Markers
ruledef HBV_nnn HBSAG_neg && HBSAB_neg &&
HBCAB_neg && !AGE_50
HBsAg: negative; Anti-HBs: negative; Anti-HBc: negative
˙You have never got hepatitis B infection, thus it is recommended that you receive vaccine injections.
˙Please visit the Outpatient Clinic of Family Medicine Division for a follow-up diagnosis and treatment.
Interpretation of Hepatitis B Markers
ruledef HBV_pnp HBSAG_pos &&
HBSAB_neg && HBCAB_pos
** If HBsAg is positive, HBsAb is negative, and HBcAb is positive
Interpretation of Hepatitis B Markers
ruledef HBV_pnp HBSAG_pos && HBSAB_neg &&
HBCAB_pos
HBsAg: positive; Anti-HBs: negative; Anti-HBc: positive
˙Don't take medication without a
physician's instructions, so as to avoid augmenting the workload of liver.
˙Take a rest, as appropriate; avoid being physically and mentally exhausted.
˙You are a hepatitis B carrier. Please have a follow-up consultation in the Outpatient
Clinic every half a year.
Interpretation of Hepatitis B Markers
ruledef HBV_nn HBSAG_neg && HBSAB_neg
&& HBCAB_nil && !AGE_50
** If HBsAg is negative, HBsAb is negative, HBcAb is not tested, and age is less than 50
Interpretation of Hepatitis B Markers
ruledef HBV_nn HBSAG_neg && HBSAB_neg &&
HBCAB_nil && !AGE_50
HBsAg: negative; Anti-HBs: negative
˙Your antibody test is negative.
It is recommended that you go to the
OPD and pay for a test for core antibody.
If the subsequent test is negative again,
you may consider receiving vaccine injections.
˙Please visit the Outpatient Clinic of
Family Medicine Division for a follow-up diagnosis and treatment.
Interpretation of Hepatitis B Markers
ruledef HBV_nnp1 HBSAG_neg && HBSAB_neg
&& HBCAB_pos && OLD_HBSAG_pos
** If HBsAg is negative, HBsAb is negative, HBcAb is negative, and any of the previous HBsAb tests is positive
Interpretation of Hepatitis B Markers
ruledef HBV_nnp1 HBSAG_neg && HBSAB_neg &&
HBCAB_pos && OLD_HBSAG_pos
HBsAg: negative; Anti-HBs: negative; Anti-HBc: positive;
Previous HBsAg: positive
˙Do not take medication without physician's instructions, to avoid augmenting the workload of liver.
˙Take a rest, as appropriate; avoid being physically and mentally exhausted.
˙You are a hepatitis B carrier. Please have a
follow-up consultation in the Outpatient Clinic every half a year.
Examples of Encoding Domain Knowledge into Rules
• Anemia
– RBC (Red Blood Cell)
– MCV (Mean Corpuscle Volume) – Hb (Hemoglobin)
Anemia
rangedef MCV_Low78 MCV [78 80) rangedef MCV_Low MCV (0 80) rangedef HB_N HB [12 19]
rangedef HB_Low HB (0 12) rangedef HB_mildLow HB [10 12) rangedef HB_severeLow HB (0 10) limitdef HB_High HB > 19
limitdef RBC_High RBC > 7 limitdef RBC_mildHigh RBC > 5
Anemia
rangedef MCV_DIV_RBC_Low MCV_DIV_RBC (0 13)
** MCV/RBC > 0, and < 13
limitdef AGE_YOUNG AGE < 21
** age less than 21
ruledef MCVABNL21 AGE_YOUNG && MCV_Low78 &&
HB_N
** If age less than 21, MCV>=78 and <80, and Hb is normal
Anemia
ruledef MCVLHBN2 !MCVABNL21 && MCV_Low && HB_N
&& MCV_DIV_RBC_Low
** If MCVABNL21 is false, MCV<80, Hb is normal, and MCV/RBC<13 (r/o Thalassemia carrier)
Anemia
ruledef MCVLHBN2 !MCVABNL21 && MCV_Low && HB_N
&& MCV_DIV_RBC_Low
RBC: 6.00*106/ul, Hb: 12.8g/dL, MCV: 63fl r/o Thalassemia carrier
˙To be under observation. Please visit the Outpatient Clinic of
Family Medicine Division
for a follow-up diagnosis and treatment, in the event of doubts or discomfort.
Anemia
ruledef MCVLHBL1 !MCVABNL21 && MCV_Low && HB_Low
&& !MCV_DIV_RBC_Low
** If MCVABNL21 is false, MCV<80, Hb<12, and MCV/RBC>=13 (microcytic anemia)
Anemia
ruledef MCVLHBL1 !MCVABNL21 && MCV_Low && HB_Low
&& !MCV_DIV_RBC_Low
RBC: 3.00*106/ul, Hb: 8.0g/dL, MCV: 70fl Microcytic anemia
˙Please visit the Outpatient Clinic of Division of Family Medicine
for a follow-up diagnosis and treatment.
Anemia
ruledef MCVLHBL2 !MCVABNL21 && MCV_Low && HB_Low
&& MCV_DIV_RBC_Low
** If MCVABNL21 is false, MCV<80, Hb<12, and MCV/RBC<13 (Thalassemia)
Anemia
ruledef MCVLHBL2 !MCVABNL21 && MCV_Low && HB_Low &&
MCV_DIV_RBC_Low
RBC: 6.00*106/ul, Hb: 10.0g/dL, MCV: 62fl r/o Thalassemia
˙Please visit the Outpatient Clinic of Division of Family Medicine
for a follow-up diagnosis and treatment.
Anemia
ruledef MCVNHBL2 !MCV_Low && HB_severeLow
** If MCV>=80 and Hb<10
Anemia
ruledef MCVNHBL2 !MCV_Low && HB_severeLow RBC: 3.00*106/ul, Hb: 8.0g/dL, MCV: 82fl
Anemia
˙Have a balanced diet, taking in all sorts of nutrients, avoid partiality for a particular kind of food; take sufficient amount of vitamins.
˙Refrain from blood donation.
˙Please visit the Outpatient Clinic of Division of Family Medicine
for follow-up diagnoses and treatments.