Report of Introduction and methods Explination.docx

hti

Introduction
This code is an implementation of an expert system which is Applying Forward Chaining using the
experta library in Python. The system prompts the user with a series of questions regarding their
symptoms, and then uses rules to determine what disease the user might have based on their
responses.
The system is able to identify 14 diseases: Jaundice, Alzheimer's, Arthritis, Asthmas, Corona Virus,
Diabetes, Epilepsy, Glaucoma, Heart Disease, Head Stroke, Hyper Hypothyroidism, Hypothermia
Jaundice, Sinusitis and Tuberculosis, and discuss each disease after detect the disease of the user and
help them about the next step they should do. The rules for each disease are defined using a series of
Fact objects that represent the user's symptoms. If all of the facts for a given rule match the user's
symptoms, the system declares a Fact object representing the matched disease.
Overall, this Project appears to be a simple implementation of an expert system, but it only covers a very
limited range of diseases and symptoms.
Methods
The __init__ method of the Greetings class initializes the object with a symptom map, a function to call if
no disease is matched, a function to get treatments, and a function to get details about the matched
disease.
The system uses a series of Rule objects to match the user's symptoms to a disease. The @Rule
decorator is used to define each rule, and the Fact class is used to represent a user's response to a
symptom. The salience parameter is used to give priority to certain rules over others.
The DefFacts decorator is used to define initial facts and actions for the system. In this case, the system
introduces itself and prompts the user for input.
The preprocess() function reads in the disease information from the text files and creates several
dictionaries that map from symptoms to diseases, from diseases to descriptions, and from diseases to
treatments. These dictionaries are then used by the other functions to provide the diagnostic output.
The identify_disease() function takes in one or more symptoms as arguments, creates a list of those
symptoms, converts that list to a string, looks up the disease associated with that string in the symptom
map dictionary, and returns the name of the disease.
The get_details() and get_treatments() functions take in a disease name as an argument and return the
description and treatments for that disease, respectively.
The if_not_matched() function is called when the symptom input doesn't match any disease in the
system. It takes in a disease name (which is actually "None" in this case) and uses the get_details() and
get_treatments() functions to print information about the most probable disease based on the
symptoms that were input.
The if __name__ == "__main__": block initializes the program by calling preprocess() to load the disease
information and create the necessary dictionaries. It then creates an instance of the Greetings class
(which is defined in the greetings.py file) and enters a loop that allows the user to input symptoms and
receive diagnostic output. The loop continues until the user enters "no" when asked if they would like to
diagnose more symptoms.

Más contenido relacionado

Similar a Report of Introduction and methods Explination.docx

Health Analyzer SystemHealth Analyzer System
Health Analyzer SystemIRJET Journal
26 vistas6 diapositivas
I04735762I04735762
I04735762IOSR-JEN
266 vistas6 diapositivas
Expert systemsExpert systems
Expert systemsUnique_Alias
268 vistas5 diapositivas

Similar a Report of Introduction and methods Explination.docx(20)

Information extraction from EHRInformation extraction from EHR
Information extraction from EHR
Ashis Chanda83 vistas
Health Analyzer SystemHealth Analyzer System
Health Analyzer System
IRJET Journal26 vistas
I04735762I04735762
I04735762
IOSR-JEN266 vistas
Expert systemsExpert systems
Expert systems
Unique_Alias268 vistas
MycinMycin
Mycin
vini8931.7K vistas
Humira repositioning reportHumira repositioning report
Humira repositioning report
Anton Yuryev143 vistas
Multiple Disease Prediction SystemMultiple Disease Prediction System
Multiple Disease Prediction System
IRJET Journal845 vistas
Smart Health Prediction ReportSmart Health Prediction Report
Smart Health Prediction Report
Arhind Gautam5.6K vistas
Seminar report SMART HEALTH PREDICTIONSeminar report SMART HEALTH PREDICTION
Seminar report SMART HEALTH PREDICTION
Arhind Gautam289 vistas

Más de MohamedAyman183185

sheet 3-4.pdfsheet 3-4.pdf
sheet 3-4.pdfMohamedAyman183185
4 vistas1 diapositiva
sheet 1.docxsheet 1.docx
sheet 1.docxMohamedAyman183185
3 vistas4 diapositivas

Más de MohamedAyman183185(11)

Kareem Atif Mohamed 1851711195.pptxKareem Atif Mohamed 1851711195.pptx
Kareem Atif Mohamed 1851711195.pptx
MohamedAyman1831859 vistas
sheet 3 answers.docxsheet 3 answers.docx
sheet 3 answers.docx
MohamedAyman1831855 vistas
sheet 3-4.pdfsheet 3-4.pdf
sheet 3-4.pdf
MohamedAyman1831854 vistas
sheet 1.docxsheet 1.docx
sheet 1.docx
MohamedAyman1831853 vistas
file organization sheet 2 .pdffile organization sheet 2 .pdf
file organization sheet 2 .pdf
MohamedAyman18318512 vistas
Task mo7drt File Organization.docxTask mo7drt File Organization.docx
Task mo7drt File Organization.docx
MohamedAyman1831856 vistas
sheet 4.docxsheet 4.docx
sheet 4.docx
MohamedAyman1831855 vistas
sheet 5.docxsheet 5.docx
sheet 5.docx
MohamedAyman1831853 vistas
file organization sheet 2 .docxfile organization sheet 2 .docx
file organization sheet 2 .docx
MohamedAyman1831854 vistas
Mohamed Ayman Task3 RAID.docxMohamed Ayman Task3 RAID.docx
Mohamed Ayman Task3 RAID.docx
MohamedAyman1831854 vistas
Temp.  sheet 1& Modelnawer[1].docxTemp.  sheet 1& Modelnawer[1].docx
Temp. sheet 1& Modelnawer[1].docx
MohamedAyman1831857 vistas

Último(20)

The Research Portal of Catalonia: Growing more (information) & more (services)The Research Portal of Catalonia: Growing more (information) & more (services)
The Research Portal of Catalonia: Growing more (information) & more (services)
CSUC - Consorci de Serveis Universitaris de Catalunya59 vistas
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf
Eleanor McHugh36 vistas
Java Platform Approach 1.0 - Picnic MeetupJava Platform Approach 1.0 - Picnic Meetup
Java Platform Approach 1.0 - Picnic Meetup
Rick Ossendrijver24 vistas
Web Dev - 1 PPT.pdfWeb Dev - 1 PPT.pdf
Web Dev - 1 PPT.pdf
gdsczhcet49 vistas
Liqid: Composable CXL PreviewLiqid: Composable CXL Preview
Liqid: Composable CXL Preview
CXL Forum120 vistas

Report of Introduction and methods Explination.docx

  • 1. Introduction This code is an implementation of an expert system which is Applying Forward Chaining using the experta library in Python. The system prompts the user with a series of questions regarding their symptoms, and then uses rules to determine what disease the user might have based on their responses. The system is able to identify 14 diseases: Jaundice, Alzheimer's, Arthritis, Asthmas, Corona Virus, Diabetes, Epilepsy, Glaucoma, Heart Disease, Head Stroke, Hyper Hypothyroidism, Hypothermia Jaundice, Sinusitis and Tuberculosis, and discuss each disease after detect the disease of the user and help them about the next step they should do. The rules for each disease are defined using a series of Fact objects that represent the user's symptoms. If all of the facts for a given rule match the user's symptoms, the system declares a Fact object representing the matched disease. Overall, this Project appears to be a simple implementation of an expert system, but it only covers a very limited range of diseases and symptoms. Methods The __init__ method of the Greetings class initializes the object with a symptom map, a function to call if no disease is matched, a function to get treatments, and a function to get details about the matched disease. The system uses a series of Rule objects to match the user's symptoms to a disease. The @Rule decorator is used to define each rule, and the Fact class is used to represent a user's response to a symptom. The salience parameter is used to give priority to certain rules over others. The DefFacts decorator is used to define initial facts and actions for the system. In this case, the system introduces itself and prompts the user for input. The preprocess() function reads in the disease information from the text files and creates several dictionaries that map from symptoms to diseases, from diseases to descriptions, and from diseases to treatments. These dictionaries are then used by the other functions to provide the diagnostic output. The identify_disease() function takes in one or more symptoms as arguments, creates a list of those symptoms, converts that list to a string, looks up the disease associated with that string in the symptom map dictionary, and returns the name of the disease. The get_details() and get_treatments() functions take in a disease name as an argument and return the description and treatments for that disease, respectively. The if_not_matched() function is called when the symptom input doesn't match any disease in the system. It takes in a disease name (which is actually "None" in this case) and uses the get_details() and get_treatments() functions to print information about the most probable disease based on the symptoms that were input.
  • 2. The if __name__ == "__main__": block initializes the program by calling preprocess() to load the disease information and create the necessary dictionaries. It then creates an instance of the Greetings class (which is defined in the greetings.py file) and enters a loop that allows the user to input symptoms and receive diagnostic output. The loop continues until the user enters "no" when asked if they would like to diagnose more symptoms.