The code that appears below is a complete Nasal Trauma Treatment Expert System, written to execute within the VP-EXPERT 3.1 programming environment.
The code contains:
treatment
, in this case)! System: Nasal Trauma Treatment Expert System ! Author: Kersten Fernandes (Student Number - 9511727) ! Date Written: 27/09/2001 ! Written For: Assignment 2 (INFO221), University of Newcastle ! Lecturer: Reg Fardell RUNTIME; BKCOLOR = 7; ! Actions Block ACTIONS COLOR = 1 CLS !Introduction Screen DISPLAY "******************************************************************************" DISPLAY " " DISPLAY " N A S A L T R A U M A" DISPLAY " " DISPLAY " " DISPLAY " T R E A T M E N T" DISPLAY " " DISPLAY " " DISPLAY " E X P E R T S Y S T E M" DISPLAY " " DISPLAY " " DISPLAY " " DISPLAY " Created by: Kersten Fernandes" DISPLAY " Student Number: 9511727" DISPLAY " " DISPLAY " " DISPLAY " Press any key to continue" DISPLAY " " DISPLAY "******************************************************************************~" CLS !Explanation Screen DISPLAY "******************************************************************************" DISPLAY "This system is designed to help casualty doctors to assess nasal trauma" DISPLAY "patients. The system uses the input information to determine the type" DISPLAY "classification of the nasal trauma (if necessary), and provides a" DISPLAY "recommendation for treatment of the trauma." DISPLAY " " DISPLAY "Please note that the system may be unable to provide a recommendation if any" DISPLAY "of the inputs are entered as unknown, or certainty factors are used." DISPLAY " " DISPLAY " " DISPLAY " " DISPLAY " " DISPLAY " " DISPLAY " " DISPLAY " " DISPLAY " Press any key to begin the consulation" DISPLAY " " DISPLAY "******************************************************************************~" COLOR = 0 CLS ! Results Screen DISPLAY "*************************************************************" DISPLAY " " FIND Treatment DISPLAY " " DISPLAY "The system has recommended treatment number {Treatment}." DISPLAY " " DISPLAY " " DISPLAY " " DISPLAY " Press any key to continue" DISPLAY " " DISPLAY "*************************************************************~"; ! Rules Block RULE 1 IF Physical = UNKNOWN THEN Treatment = 0 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "No recommendation can be made based on this information."; RULE 2 IF Physical = No THEN Treatment = 2 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Physical examination including nasal endoscopy."; RULE 3 IF Physical = Yes AND Fracture = UNKNOWN THEN Treatment = 0 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "No recommendation can be made based on this information."; RULE 4 IF Physical = Yes AND Fracture = No THEN Treatment = 1 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Patient should be discharged."; RULE 5 IF Physical = Yes AND Fracture = Yes AND Type = UNKNOWN THEN Treatment = 0 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "No recommendation can be made based on this information."; RULE 6 IF Physical = Yes AND Fracture = Yes AND Type = Type_5 THEN Treatment = 9 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY "Treatment is as follows:" DISPLAY " " DISPLAY "3 mm Axial/Coronal CT" DISPLAY "Early open reduction" DISPLAY "Internal fixation" DISPLAY "Nasoorbitoethmoid/nasal fracture reduction"; RULE 7 IF Physical = Yes AND Fracture = Yes AND Type = Type_4a AND Drain = UNKNOWN THEN Treatment = 0 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "No recommendation can be made based on this information."; RULE 8 IF Physical = Yes AND Fracture = Yes AND Type = Type_4a AND Drain = No THEN Treatment = 3 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY " " DISPLAY "Treatment is as follows:" DISPLAY " " DISPLAY "Drain/pack septal hematoma"; RULE 9 IF Physical = Yes AND Fracture = Yes AND Type = Type_4b AND Irrigation = UNKNOWN THEN Treatment = 0 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "No recommendation can be made based on this information."; RULE 10 IF Physical = Yes AND Fracture = Yes AND Type = Type_4b AND Irrigation = No THEN Treatment = 4 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY "" DISPLAY "Treatment is as follows:" DISPLAY " " DISPLAY "Irrigation/wound closure"; RULE 11 IF Physical = Yes AND Fracture = Yes AND Edema = UNKNOWN THEN Treatment = 0 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY " " DISPLAY "No treatment recommendation can be made based on the input" DISPLAY "information."; RULE 12 IF Physical = Yes AND Fracture = Yes AND Type = Type_4a AND Edema = No THEN Treatment = 10 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY "Treatment is as follows:" DISPLAY " " DISPLAY "* Fracture Reduction *" DISPLAY " - Anaesthesia (intravenous sedation versus general)" DISPLAY " - Meticulous septal examination (with or without endoscope)" DISPLAY " - Closed reduction nasal fracture" DISPLAY " - Reduce septal fractures/dislocations" DISPLAY " - Consider limited inferior septal reconstruction/resection" DISPLAY " for irreducible inferior septal fractures"; RULE 13 IF Physical = Yes AND Fracture = Yes AND Type = Type_4b AND Edema = No THEN Treatment = 10 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY "Treatment is as follows:" DISPLAY " " DISPLAY "* Fracture Reduction *" DISPLAY " - Anaesthesia (intravenous sedation versus general)" DISPLAY " - Meticulous septal examination (with or without endoscope)" DISPLAY " - Closed reduction nasal fracture" DISPLAY " - Reduce septal fractures/dislocations" DISPLAY " - Consider limited inferior septal reconstruction/resection" DISPLAY " for irreducible inferior septal fractures"; RULE 14 IF Physical = Yes AND Fracture = Yes AND Edema = No AND Allergies = UNKNOWN THEN Treatment = 8 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY "Treatment is as follows:" DISPLAY " " DISPLAY "* Fracture Reduction *" DISPLAY " - Anaesthesia (intravenous sedation versus general)" DISPLAY " - Meticulous septal examination (with or without endoscope)" DISPLAY " - Closed reduction nasal fracture (steroids, external and" DISPLAY " intranasal splints)"; RULE 15 IF Physical = Yes AND Fracture = Yes AND Edema = No AND Allergies = No THEN Treatment = 7 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY "Treatment is as follows:" DISPLAY " " DISPLAY "* Fracture Reduction *" DISPLAY " - Anaesthesia (intravenous sedation versus general)" DISPLAY " - Meticulous septal examination (with or without endoscope)" DISPLAY " - Closed reduction nasal fracture (antibiotics, steroids," DISPLAY " external and intranasal splints)"; RULE 16 IF Physical = Yes AND Fracture = Yes AND Edema = No AND Allergies = Yes THEN Treatment = 8 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY "Treatment is as follows:" DISPLAY " " DISPLAY "* Fracture Reduction *" DISPLAY " - Anaesthesia (intravenous sedation versus general)" DISPLAY " - Meticulous septal examination (with or without endoscope)" DISPLAY " - Closed reduction nasal fracture (steroids, external and" DISPLAY " intranasal splints)"; RULE 17 IF Physical = Yes AND Fracture = Yes AND Edema = Yes AND Elevated = UNKNOWN THEN Treatment = 0 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY " " DISPLAY "No treatment recommendation can be made based on the input" DISPLAY "information."; RULE 18 IF Physical = Yes AND Fracture = Yes AND Edema = Yes AND Elevated = No THEN Treatment = 5 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY "Treatment is as follows:" DISPLAY " " DISPLAY "Elevation/ice" DISPLAY "Injury should be reassessed 3 - 5 days after severe nasal" DISPLAY "swelling subsides."; RULE 19 IF Physical = Yes AND Fracture = Yes AND Edema = Yes AND Elevated = Yes AND Subsided = UNKNOWN THEN Treatment = 0 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY " " DISPLAY "No treatment recommendation can be made based on the input" DISPLAY "information."; RULE 20 IF Physical = Yes AND Fracture = Yes AND Edema = Yes AND Elevated = Yes AND Subsided = No THEN Treatment = 6 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY "Treatment is as follows:" DISPLAY " " DISPLAY "Wait until 3 - 5 days after the severe nasal swelling has" DISPLAY "subsided before conducting any further treatment."; RULE 21 IF Physical = Yes AND Fracture = Yes AND Edema = Yes AND Elevated = Yes AND Subsided = Yes AND Time_since = UNKNOWN THEN Treatment = 6 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY "Treatment is as follows:" DISPLAY " " DISPLAY "Wait another 3 - 5 days before conducting any further" DISPLAY "treatment."; RULE 22 IF Physical = Yes AND Fracture = Yes AND Edema = Yes AND Elevated = Yes AND Subsided = Yes AND Time_since = Less_than_3_days THEN Treatment = 6 CLS DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY "Treatment is as follows:" DISPLAY " " DISPLAY "Wait until 3 - 5 days after the severe nasal swelling has" DISPLAY "subsided before conducting any further treatment."; RULE 23 IF Physical = Yes AND Fracture = Yes AND Type = Type_4a AND Edema = Yes AND Elevated = Yes AND Subsided = Yes THEN Treatment = 10 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY "Treatment is as follows:" DISPLAY " " DISPLAY "* Fracture Reduction *" DISPLAY " - Anaesthesia (intravenous sedation versus general)" DISPLAY " - Meticulous septal examination (with or without endoscope)" DISPLAY " - Closed reduction nasal fracture" DISPLAY " - Reduce septal fractures/dislocations" DISPLAY " - Consider limited inferior septal reconstruction/resection" DISPLAY " for irreducible inferior septal fractures"; RULE 24 IF Physical = Yes AND Fracture = Yes AND Type = Type_4b AND Edema = Yes AND Elevated = Yes AND Subsided = Yes THEN Treatment = 10 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY "Treatment is as follows:" DISPLAY " " DISPLAY "* Fracture Reduction *" DISPLAY " - Anaesthesia (intravenous sedation versus general)" DISPLAY " - Meticulous septal examination (with or without endoscope)" DISPLAY " - Closed reduction nasal fracture" DISPLAY " - Reduce septal fractures/dislocations" DISPLAY " - Consider limited inferior septal reconstruction/resection" DISPLAY " for irreducible inferior septal fractures"; RULE 25 IF Physical = Yes AND Fracture = Yes AND Edema = Yes AND Elevated = Yes AND Subsided = Yes AND Allergies = UNKNOWN THEN Treatment = 8 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY "Treatment is as follows:" DISPLAY " " DISPLAY "* Fracture Reduction *" DISPLAY " - Anaesthesia (intravenous sedation versus general)" DISPLAY " - Meticulous septal examination (with or without endoscope)" DISPLAY " - Closed reduction nasal fracture (steroids, external and" DISPLAY " intranasal splints)"; RULE 26 IF Physical = Yes AND Fracture = Yes AND Edema = Yes AND Elevated = Yes AND Subsided = Yes AND Allergies = No THEN Treatment = 7 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY "Treatment is as follows:" DISPLAY " " DISPLAY "* Fracture Reduction *" DISPLAY " - Anaesthesia (intravenous sedation versus general)" DISPLAY " - Meticulous septal examination (with or without endoscope)" DISPLAY " - Closed reduction nasal fracture (antibiotics, steroids," DISPLAY " external and intranasal splints)"; RULE 27 IF Physical = Yes AND Fracture = Yes AND Edema = Yes AND Elevated = Yes AND Subsided = Yes AND Allergies = Yes THEN Treatment = 8 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "Trauma classification is {Type}." DISPLAY "Treatment is as follows:" DISPLAY " " DISPLAY "* Fracture Reduction *" DISPLAY " - Anaesthesia (intravenous sedation versus general)" DISPLAY " - Meticulous septal examination (with or without endoscope)" DISPLAY " - Closed reduction nasal fracture (steroids, external and" DISPLAY " intranasal splints)"; RULE 28 IF Physical = Yes AND Fracture = Yes THEN Treatment = 0 CLS DISPLAY "*************************************************************" DISPLAY " " DISPLAY "No recommendation can be made based on this information."; RULE 29 IF Type_known = Yes AND Input_type <> Type_0 THEN Type = (Input_type); RULE 30 IF Severity = Simple AND Sides = Unilateral THEN Type = Type_1; RULE 31 IF Severity = Simple AND Sides = Bilateral THEN Type = Type_2; RULE 32 IF Severity = Complex AND Nasoorbito = Yes THEN Type = Type_5; RULE 33 IF Severity = Complex AND Description = SeptalHematoma THEN Type = Type_4a; RULE 34 IF Severity = Complex AND Description = OpenNasalLaceration THEN Type = Type_4b; RULE 35 IF Severity = Complex AND Description = ComminutedUnilateral THEN Type = Type_3a; RULE 36 IF Severity = Complex AND Description = ComminutedBilateral THEN Type = Type_3b; RULE 37 IF Severity = Complex AND Description = ComminutedFrontal THEN Type = Type_3c; ! Query Statements Block ASK Physical: "Has a physical examination, including nasal endoscopy been performed on the patient?"; CHOICES Physical: Yes,No; ASK Fracture: "Has the patient suffered a nasal fracture?"; CHOICES Fracture: Yes,No; ASK Type_known: "Is the type classification of the trauma known?"; CHOICES Type_known: Yes,No; ASK Input_type: "Please enter the type classification of the trauma:"; CHOICES Input_type: Type_1,Type_2,Type_3a,Type_3b,Type_3c,Type_4a,Type_4b,Type_5; ASK Severity: "Is the facial trauma simple (a single fracture) or complex?"; CHOICES Severity: Simple,Complex; ASK Sides: "Is the facial trauma unilateral or bilateral?"; CHOICES Sides: Unilateral,Bilateral; ASK Nasoorbito: "Is the facial trauma a nasoorbitoethmoid fracture?"; CHOICES Nasoorbito: Yes,No; ASK Description: "Please select which of the following best describes the fracture:"; CHOICES Description: ComminutedUnilateral,ComminutedBilateral,ComminutedFrontal,SeptalHematoma,OpenNasalLaceration; ASK Drain: "Has the septal hematoma been drained and packed?"; CHOICES Drain: Yes,No; ASK Irrigation: "Has the wound been irrigated and closed?"; CHOICES Irrigation: Yes,No; ASK Edema: "Is there a significant edema?"; CHOICES Edema: Yes,No; ASK Elevated: "Has the injury been elevated and ice applied?"; CHOICES Elevated: Yes,No; ASK Subsided: "Has the severe nasal swelling subsided?"; CHOICES Subsided: Yes,No; ASK Time_since: "How much time has elapsed since the severe nasal swelling subsided?"; CHOICES Time_since: Less_than_3_days,3_to_5_days,Over_5_days; ASK Allergies: "Does the patient have any known allergies to antibiotics?"; CHOICES Allergies: Yes,No;
This page was designed by Kersten Fernandes (Student Number: 9511727), Matthew Bird (Student Number: 9812292), and Fedja Hadzic (Student Number: 9909256),
for the COMP3330: Machine Intelligence subject within the Bachelor of Computer Science degree at the
University of Newcastle.