Following is a demo of the code.pl program.
?- hellodoctor. Welcome! Can we start with your name? |: jane. Hello, jane! Let's start you examination by asking a few questions about your symptoms. Are you experiencing any chest pain or chest discomfort? (y/n) |: y. Do you get less than 30 minutes of excercise everyday? (y/n) |: y. Are you currently a smoker? (y/n) |: n. Do you have a family history of coronary artery disease? (y/n) |: n. Ordering tests for more conclusive results. What is the patient's test result for bloodPressure? |: 120. What is the patient's test result for cholesterol? |: 6. What is the patient's test result for bloodSugar? |: 4. What is the patient's test result for bmi? |: 20. What is the patient's test result for waistHipRatio? |: 0.7. CAD risk present. true . ?- hellodoctor. Welcome! Can we start with your name? |: jane. Welcome back, jane! Would you like to enter new symptoms/order new tests? (new_symptoms/new_tests) |: new_symptoms. Here are your current symptoms:[chestPain,inactivity,cholesterol] What is your new symptom? |: familyHistory. Expressed CAD risk present. true . ?- hellodoctor. Welcome! Can we start with your name? |: edima. Hello, edima! Let's start you examination by asking a few questions about your symptoms. Are you experiencing any chest pain or chest discomfort? (y/n) |: n. Do you get less than 30 minutes of excercise everyday? (y/n) |: n. Are you currently a smoker? (y/n) |: n. Do you have a family history of coronary artery disease? (y/n) |: n. Not enough symptoms. You most likely do not have CAD. true . ?- hellodoctor. Welcome! Can we start with your name? |: edima. Welcome back, edima! Would you like to enter new symptoms/order new tests? (new_symptoms/new_tests) |: new_tests. Which test are you entering for the patient? |: bloodPressure. What is the patient's test result for bloodPressure? |: 150. CAD risk present. true . --- ERROR HANDLING --- -- Not a listed current patient -- ?- hellodoctor. Welcome! Can we start with your name? |: dan. I'm sorry. I only examine patients in my current patient records. true. -- Not a CAD symptom -- ?- hellodoctor. Welcome! Can we start with your name? |: jane. Welcome back, jane! Would you like to enter new symptoms/order new tests? (new_symptoms/new_tests) |: new_symptoms. Here are your current symptoms:[chestPain,inactivity,cholesterol] What is your new symptom? |: footPain. Entered symptom is not a CAD symptom. Please try again. (Possible symptoms are: [chestPain,inactivity,smoking,familyHistory] ). true . -- Not a CAD test -- ?- hellodoctor. Welcome! Can we start with your name? |: jane. Welcome back, jane! Would you like to enter new symptoms/order new tests? (new_symptoms/new_tests) |: new_tests. Which test are you entering for the patient? |: ultrasound. Not a CAD test. true .