You are on page 1of 122

An Online Expert Diagnosis System A Case Study on Online Medical Diagnosis System

A Thesis Submitted By Siddique Md Sohel Uddin Mohammed Rakib Fazla Rabbi Chowdhury Sarker Mithun ID: 06-06961-2 ID: 06-06787-2 ID: 06-06665-2 ID: 07-08663-2

Under the Supervision of Md. Anwarul Kabir Assistant Professor Department Of Computer Science Faculty of Science and Information Technology American International University - Bangladesh Spring, May 2010

An Online Expert Diagnosis System A Case Study on Online Medical Diagnosis System A thesis submitted to the Department of Computer Science, American International University Bangladesh (AIUB) in partial fulfillment of the requirement for the degree of Bachelor of Science in Computer Science and Engineering.

Siddique Md Sohel Uddin Mohammed Rakib Rabbi Fazla Chowdhury Sarker Mithun

ID: 06-06961-2 ID: 06-06787-2 ID: 06-06665-2 ID: 07-08663-2

Declaration This is to certify that this is our original work. No part of this work has been submitted elsewhere partially or fully for the award of the other degree or diploma. Any material reproduced in this thesis has been properly acknowledged.

Students Names & Signatures

Siddique Md Sohel ID: 06-06961-2

Uddin Mohammed Rakib ID: 06-06787-2

.. Rabbi Fazla Chowdhury ID: 06-06665-2

Sarker Mithun ID: 07-08663-2

Approval The thesis titled An Online Expert Diagnosis System: A Case Study on Online Medical Diagnosis System has been submitted to the following respected member of the Board of Examiners of Faculty of Computer Science in partial fulfillment of the degree for the Bachelor of Science in Computer Science and Engineering on 24th May 2010 by the following Students and has been accepted as satisfactory. Siddique Md Sohel Uddin Mohammed Rakib Rabbi Fazla Chowdhury Sarker Mithun ID: 06-06961-2 ID: 06-06787-2 ID: 06-06665-2 ID: 07-08663-2

..

Mr. Md Anwarul Kabir


Thesis Supervisor & Assistant Professor Department of Computer Science & Information Technology AIUB

Mr. Md Manirul Islam


External & Assistant Professor Department of Computer Science & Information Technology AIUB

Prof. Dr. Tafazzal Hossain


Dean Department of Computer Science & Information Technology AIUB
4

Dr. Carmen Z. Lamagna


Vice Chancellor AIUB

Acknowledgements It is obvious that carrying out a research on this scope needs the support of many people. In our work, we have received supports in various forms from many people from home and abroad. First of all we would like to thank our supervisor Mr. Anwarul Kabir for his suggestion and valuable information over the period of this thesis work. His suggestion helped us to find out an efficient solution. Without his supervision the thesis would not be completed. We also like to thank the Head of Computer Science & Information Technology Department Mr. Mashiour Rahman for his suggestion to fulfill every official activity regarding our research. Thanks given to Mr. Md Manirul Islam Lecturer, Department of Computer Science & Information Technology for his encouragement and suggestions. We want to give thanks to Prof. Dr. Tafazzal Hossain, Dean, and Department of Computer Science for his valuable advice throughout our research project. His suggestions and encouragement in developing a well structured thesis is a road to complete our venture. We would also like to express our heartfelt thanks to our honorable Vice Chancellor Dr. Carmen Z. Lamagna for giving the opportunity to work in a thesis in the undergraduate study. We must point that over the period of our undergraduate program we have received tremendous moral and academic supports from her.

We also like to express our thanks to the ICDDRB authority and research who always helped by giving important information. Especially, they help us to understand Expert Diagnosis System providing relevant information. At last but not least we would like to thanks our parents. Without their moral and financial support we wouldnt able to complete our research.

Contents

Page No. Declaration Approval Acknowledgement Contents Abstract Chapter 1 Introduction 1.1 Introduction

Chapter 2 Literature View Chapter 3 Software Technology Used In Our System Chapter 4 System Planning & Design Chapter 5 Implementation & Description Chapter 6 Limitation & Conclusion

Abstract Online Expert Diagnosis System (OEDS) is knowledge based expert system. The major objective of OEDS is to diagnosis Acute Appendicitis, Acute Cholecystitis and Acute Pancreatitis diseases. The system is also capable of saving data in its database and updating the Knowledge Base (KB) in accordance with information received from different patients. In implementing OEDS, we have followed online expert system technology and so, we have acquired knowledge from a relevant specialist doctor. This knowledge has been represented in the systems KB. For diagnosis, we have implemented an Inference Engine (IE) which has the ability of inference by using the stored knowledge in the KB. This IE carries the relevant data about patient (supplied from each patient session) and following logical approach it interacts with the KB and comes to a conclusion about disease. This system has also tried to capture the heuristic knowledge of the doctor. For this, the IE has followed the statistical method to reach to a conclusion.

Chapter 1 Introduction 1.1 Introduction This Chapter represents the overall view of our thesis projects. This chapter mainly focuses on the importance of implementing An Online Expert Diagnosis System on Online medical diagnosis System. The title of proposed project has been mentioned here. Objective and scopes section has pointed out the overall objective and scopes of the project. For implementing the system we have proposed a knowledge based (KB) system. In this chapter we have also tried to present the structure of our proposed system.

1.2 Title of the Thesis An Online Expert Diagnosis System

1.3 Objective and scopes The major objective of the thesis is to design and a quick, simple and efficient method for diagnosis Expert system using state of the art technology. For this, we are considering to follow the structure of the expert system paradigm Artificial Intelligence. The sub-objectives of this thesis are stated below:

Acquiring Knowledge from a relevant physician.

Creating a knowledge Base (KB). Representing the acquire knowledge into KB using appropriate algorithm. Providing friendly user interface.

1.4 Rationale In Bangladesh, at present, most of the doctors mainly use manual way through their observation, experience along with various reports (e.g. X-rays, ECG) for diagnosing disease. But if they use our proposed system then they can easily be able to diagnose different varieties of diseases efficiently and accurately without consuming much time. So, if the doctors use this system then they can easily trace the disease. The proposed system will not only manage a new patient's information but also it will able to extract an old patient's information. As a result when a patient visits a doctors chamber after two or three years the doctor can find out his/her history easily. So it will be very helpful for the doctors. Moreover it also increases the efficiency of diagnosing the diseases. By using this system doctors can predict information about diseases.

10

1.5 An Overview of proposed system The proposed Online Expert Diagnosis System (OEDS) will be knowledge based expert system for diagnosing diseases. Our system will also save the data for future purpose. For this we have analyzed many reports on Acute Appendicitis, Acute Cholecystitis and Peptic Ulcer and took interview to explore how doctors take history of a patient and what criteria they follow to diagnosing a disease. We have also tried to understand what the first stage of diagnosing is and what the final stage of it is. We have analyzed and built a database based on doctors diagnosing techniques of real time. Then we have learned to enrich the database which relevant knowledge. This database will act as knowledge base future system. We gave knowledge to our system according to those criteria. At first the doctor needs to be registered himself as user and approved by an admin. If the patient is completely new then the system does the clinical test for the patient in that session. It will ask some questions and after testing the system will take decision whether there is any problem or not. If problem found then we give some pathological Test. We gave our system enough knowledge on different types of disease. The system will have a flexible interactive interface. The system will act the relevant questions about his/her diseases and will store the answers in its working memory. Based on the patients answer, interface ensure of the system will communicate with the knowledge base and subsequently will diagnosing the diseases.

11

1.6 Structure of the Thesis A brief description of the chapters included in this report is given below: In second chapter entitled Literature view focuses on different issues of relevant disease. It will also discuss on Expert systems and how its usage in medical science. The Third chapter entitled Software tools and Technology used in Expert diagnosis system. In this chapter will discuss the tools used for implements this system and will try to justify the selected of those tools. The fourth chapter entitled Planning and designing mainly consists of software planning, flow of data, software context and different software designing diagrams. The Fifth chapter Implementation and Description describes the

implementing method of the system. It also discusses on some critical parts of the system and its implementation. Finally, the sixth chapter is the concluding chapter. This chapter discusses the achievement of this thesis. It also includes some possible future enhancement of the system.

12

Chapter 2 Literature View

2.1 Introduction This chapter contains the literature review of our project and thesis. A brief analysis of expert system using different technologies is mainly described in this chapter. In this literature review chapter we actually focused on the Expert system which is a computer based program that simulates the judgments and behavior of a human. We not only describe about expert system but also discuss about various aspects that are related to our project and thesis such as knowledge base, inference engine, working procedure of inference engine.

2.2 Expert System An expert system is a computer application that solves complicated problems that would otherwise require extensive human expertise. To do so, it simulates the human reasoning process by applying specific knowledge and interfaces. It is known to all that books and manual guides have a tremendous amount of knowledge but a human has to read and interpret the knowledge for it to be used. For this reason expert systems also use human knowledge to solve problems that normally would require human intelligence. Actually expert systems represent the expertise knowledge as data or rules within the computer as a result when we need any kind of assist to solve any type of problems we can easily find out from the knowledge base. References of source and book:

13

2.3 Knowledge Base In general, a knowledge base is a centralized repository for information where public libraries, a database of related information about a particular subject all are considered to be examples of knowledge base. In relation to information technology, a knowledge base is a machine readable resource for the dissemination of information, generally on online or with the capacity to be put on online. Moreover an integral component of knowledge management systems indicates that a knowledge base is generally used to optimize information collection, association, and retrieve data for various purposes. On the other hand computer User High-Tech Dictionary defines the knowledge-based system as a computer system which is usually programmed to imitate human problemsolving by means of artificial intelligence and reference to a database of knowledge on a particular subject. Moreover Knowledge-based (KB) systems are type of systems that base on the methods and techniques of Artificial Intelligence where the core components are the knowledge base and the inference mechanisms. [2] If we consider some authors expert system opinion then we can see that knowledge-based systems are the combination of case-based reasoning systems and neural networks, on the contrary a few author's expert systems define that neural networks are different, and for this reason they exclude it from this category.

14

2.4 Inference Engine In the language of computer science, specifically the undergrowth of knowledge engineering and artificial intelligence, an inference engine is a computer program that tries to derive answers from a knowledge base. It is actually work as a "brain" which is used by our EDS to motive information in the knowledge base (KB) for the ultimate purpose of formulating new conclusions. In addition Inference engines are considered to be a special case of reasoning engines, which can use more general methods of interpretation. How the inference engine works? In simple rule-based systems, there are two kinds of inference, forward chaining and backward chaining.

Figure: Block Diagram for an Expert System

15

2.4.1 Forward chaining In forward chaining data generally put into the working memory. This triggers rules whose first condition is to match the new data. After matching the data these rules then perform their actions. The actions may add new data to memory, thus triggering more rules. And so on. This is also called data-directed inference, because inference is triggered by the arrival of: the data in working memory. [3]

2.4.2 Backward chaining In backward chaining, the system needs to know the value of a piece of data. It searches for rules whose conclusions mention this data. Before it can use the rules, it must test their conditions. This may entail discovering the value of more pieces of data, and so on. This is also called goal-directed inference, or hypothesis driven, because inferences are not performed until the system is made to prove a particular goal. [3]

2.5 Description on Disease Acute is the abrupt onset, in reference to a disease. Acute often also connotes an illness that is of short duration, rapidly progressive, and in need of urgent care. "Acute" is a measure of the time scale of a disease and is in contrast to "sub Acute" and "Chronic." "Sub Acute" indicates longer duration or less rapid change. "Chronic" indicates indefinite duration or virtually no change.

16

In this system we work with the three Acute diseases such as:
1. Acute Appendicitis, 2. Acute Cholecystitis, 3. Acute Pancreatitis.

2.5.1 Appendicitis The appendix is a closed-ended, narrow tube up to several inches in length that attaches to the cecum (the first part of the colon) like a worm. (The anatomical name for the appendix, vermiform appendix, means worm-like appendage.) The inner lining of the appendix produces a small amount of mucus that flows through the open center of the appendix and into the cecum. The wall of the appendix contains lymphatic tissue that is part of the immune system for making antibodies. Like the rest of the colon, the wall of the appendix also contains a layer of muscle, but the layer of muscle is poorly developed. Appendicitis means inflammation of the appendix. It is thought that appendicitis begins when the opening from the appendix into the cecum becomes blocked. The blockage may be due to a build-up of thick mucus within the appendix or to stool that enters the appendix from the cecum. The mucus or stool hardens, becomes rock-like, and blocks the opening. This rock is called a fecalith (literally, a rock of stool). At other times, the lymphatic tissue in the appendix might swell and block the appendix. After the blockage occurs, bacteria which normally are found within the appendix begin to invade (infect) the wall of the appendix. The body responds to the invasion by mounting an attack on the bacteria, an attack called inflammation.

17

2.5.1.1 Acute Appendicitis As Acute appendicitis is an inflammation of the appendix, a 3 1/2-inch-long tube of tissue that extends from the large intestine. No one is absolutely certain what the function of the appendix is. One thing we do know: We can live without it, without apparent consequences. Appendicitis is a medical emergency that requires prompt surgery to remove the appendix. Left untreated, an inflamed appendix will eventually burst, or perforate, spilling infectious materials into the abdominal cavity. This can lead to peritonitis, a serious inflammation of the abdominal cavity's lining (the peritoneum) that can be fatal unless it is treated quickly with strong antibiotics.

2.5.1.2 Acute Appendicitis Causes Appendicitis is one of the most common causes of emergency abdominal surgery in the United States. It usually occurs when the appendix becomes blocked by feces, a foreign object, or rarely, a tumor .

2.5.1.2 Acute Appendicitis Symptoms

The symptoms of appendicitis vary. It can be hard to diagnose appendicitis in young children, the elderly, and women of childbearing age. Typically, the first symptom is pain around your belly button. (See: Abdominal pain) The pain may be vague at first, but becomes increasingly sharp

18

and severe. You may have reduced appetite, nausea, vomiting, and a low-grade fever. As the inflammation in the appendix increases, the pain tends to move into your right lower abdomen and focuses directly above the appendix at a place called McBurney's point. If your appendix ruptures, the pain may lessen briefly and you may feel better. However, once the lining of your abdominal cavity becomes inflamed and infected (a condition called peritonitis), the pain gets worse and you become sicker. Your abdominal pain may be worse when walking or coughing. You may prefer to lie still because sudden movement causes pain. Later symptoms include: Chills Constipation Diarrhea Fever Loss of appetite Nausea Shaking Vomiting

2.5.2 Cholecystitis

19

Cholecystitis is inflammation of the gallbladder, usually resulting from a gallstone blocking the cystic duct. Gallbladder inflammation usually results from a gallstone blocking the flow of bile. Typically, people have abdominal pain that lasts more than 6 hours, fever, and nausea. Ultrasonography can usually detect signs of gallbladder inflammation. The gallbladder is removed, often using a laparoscope. Cholecystitis is the most common problem resulting from gallbladder stones. It occurs when a stone blocks the cystic duct, which carries bile from the gallbladder.

2.5.2.1 Acute Cholecystitis Acute Cholecystitis begins suddenly, resulting in severe, steady pain in the upper abdomen. At least 95% of people with Acute Cholecystitis have gallstones. The inflammation almost always begins without infection, although infection may follow later. Inflammation may cause the gallbladder to fill with fluid and its walls to thicken. Rarely, a form of Acute Cholecystitis without gallstones (Acalculous Cholecystitis) occurs. Acalculous Cholecystitis is more serious than other types of Cholecystitis. It tends to occur after the following: Major surgery Critical illnesses such as serious injuries, major burns and body wide infections (sepsis) Intravenous feedings for a long time

20

Fasting for a prolonged time A deficiency in the immune system It can occur in young children, perhaps developing from a viral or another infection.

QuickTime and a decompressor are needed to see this picture.

Figure 4.2: Acute Cholecystitis

2.5.2.1 Acute Cholecystitis Symptoms A gallbladder attack, whether in Acute or Chronic Cholecystitis, begins as pain. The pain of Cholecystitis is similar to that caused by gallstones (biliary colic) but is more severe and lasts longermore than 6 hours and often more than 12 hours. The pain peaks after 15 to 60 minutes and remains constant. It usually occurs in the upper right part of the abdomen. The pain may become excruciating. Most people feel a sharp pain when a doctor presses on the upper right part of the abdomen. Breathing deeply may worsen the pain. The pain often extends to the lower part of the right shoulder blade or to the back. Nausea and vomiting are common.
21

Within a few hours, the abdominal muscles on the right side may become rigid. Fever occurs in about one third of people with Acute Cholecystitis. The fever tends to rise gradually to above 100.4 F (38 C) and may be accompanied by chills. Fever rarely occurs in people with Chronic Cholecystitis. In older people, the first or only symptoms of Cholecystitis may be rather general. For example, older people may lose their appetite, feel tired or weak, or vomit. They may not develop a fever. Typically, an attack subsides in 2 to 3 days and completely resolves in a week. If the Acute episode persists, it may signal a serious complication. A high fever, chills, a marked increase in the white blood cell count, and cessation of the normal rhythmic contractions of the intestine (ileussee Gastrointestinal Emergencies: Appendicitis) suggest pockets of pus (abscesses) in the abdomen near the gallbladder from gangrene (which develops when tissue dies) or a perforated gallbladder. If people develop jaundice (see Manifestations of Liver Disease: Jaundice) or pass dark urine and light-colored stools, the common bile duct is probably blocked by a stone, causing a backup of bile in the liver (Cholecystitis). Inflammation of the pancreas (Pancreatitis) can develop. It is caused by a stone blocking the Ampulla of water, near the exit of the pancreatic duct. Acalculous Cholecystitis typically causes sudden, excruciating pain in the upper abdomen in people with no previous symptoms or other evidence of a gallbladder disorder. The inflammation is often very severe and can lead to gangrene or rupture of the gallbladder. In people with other severe problems (including people in the intensive care unit for another reason), acalculous Cholecystitis may be overlooked at first. The only symptoms may be a swollen
22

(distended), tender abdomen or a fever with no known cause. If untreated, Acalculous Cholecystitis results in death for 65% of people.

23

2.5.3 Pancreatitis Pancreatitis is inflammation of the pancreas. The pancreas is a large gland behind the stomach and close to the duodenum the first part of the small intestine. The pancreas secretes digestive juices, or enzymes, into the duodenum through a tube called the pancreatic duct. Pancreatic enzymes join with bile a liquid produced in the liver and stored in the gallbladder to digest food. The pancreas also releases the hormones insulin and glucagon into the bloodstream. These hormones help the body regulate the glucose it takes from food for energy. Normally, digestive enzymes secreted by the pancreas do not become active until they reach the small intestine. But when the pancreas is inflamed, the enzymes inside it attack and damage the tissues that produce them. Pancreatitis can be Acute or Chronic. Either form is serious and can lead to complications. In severe cases, bleeding, infection, and permanent tissue damage may occur.

2.5.3.1 Acute Pancreatitis Acute pancreatitis is inflammation of the pancreas that occurs suddenly and usually resolves in a few days with treatment. Acute pancreatitis can be a lifethreatening illness with severe complications. Each year, about 210,000 people in the United States are admitted to the hospital with Acute pancreatitis. The most common cause of Acute pancreatitis is the presence of gallstonessmall, pebble-like substances made of hardened bilethat cause inflammation in the pancreas as they pass through the common bile duct. Chronic, heavy alcohol use
24

is also a common cause. Acute pancreatitis can occur within hours or as long as 2 days after consuming alcohol. Other causes of Acute pancreatitis include abdominal trauma, medications, infections, tumors, and genetic abnormalities of the pancreas.

QuickTime and a dec ompressor are needed to see this picture.

Figure 4.3: Acute Pancreatitis

2.5.3.2 Acute Pancreatitis Causes

The pancreas is an organ located behind the stomach that produces chemicals called enzymes, as well as the hormones insulin and glucagon. Most of the time, the enzymes are only active after they reach the small intestine, where they are needed to digest food. When these enzymes somehow become active inside the pancreas, they eat (and digest) the tissue of the pancreas. This causes swelling, bleeding (hemorrhage), and damage to the pancreas and its blood vessels.
25

Acute pancreatitis affects men more often than women. Certain diseases, surgeries, and habits make you more likely to develop this condition. The condition is most often caused by alcoholism and alcohol abuse (70% of cases in the U.S.). Genetics may be a factor in some cases. Sometimes the cause is not known, however. Other conditions that have been linked to pancreatitis are: Autoimmune problems (when the immune system attacks the body) Blockage of the pancreatic duct or common bile duct, the tubes that drain enzymes from the pancreas Damage to the ducts or pancreas during surgery High blood levels of a fat called triglycerides (hypertriglyceridemia) Injury to the pancreas from an accident Other causes include: Complications of cystic fibrosis Hemolytic uremic syndrome Hyperparathyroidism Kawasaki disease Reye syndrome Use of certain medications (especially estrogens, corticosteroids, thiazide diuretics, and azathioprine) Viral infections, including mumps, coxsackie B, mycoplasma pneumonia, and campylobacter.

26

2.5.3.3 Acute Pancreatitis Symptoms The most common symptom of Acute pancreatitis is pain. Almost everybody with Acute pancreatitis experiences pain. The pain may come on suddenly or build up gradually. If the pain begins suddenly, it is typically very severe. If the pain builds up gradually, it starts out mild but may become severe. The pain is usually centered in the upper middle or upper left part of the belly (abdomen). The pain may feel as if it radiates through to the back. The pain often begins or worsens after eating. The pain typically lasts a few days. The pain may feel worse when a person lies flat on his or her back. People with Acute pancreatitis usually feel very sick. Besides pain, people may have other symptoms. Nausea (Some people do vomit, but vomiting does not relieve the symptoms.) Fever, chills, or both Swollen abdomen which is tender to the touch

27

Rapid heartbeat (A rapid heartbeat may be due to the pain and fever, or it may be a compensation if a person is bleeding internally.) In very severe cases with infection or bleeding, a person may become dehydrated and have low blood pressure, in addition to the following symptoms: Weakness or feeling tired (fatigue) Feeling lightheaded or faint Lethargy Irritability Confusion or difficulty concentrating Headache If the blood pressure becomes extremely low, the organs of the body do not get enough blood to carry out their normal functions. This very dangerous condition is called circulatory shock or is referred to simply as shock.

28

Chapter 3 Software Technology Used In Our System 3.1 Introduction In this thesis various types of components and equipments have been used. We have used some software tools and hardware tools to complete this project and thesis successfully. This chapter provides a brief description of some important components which are used in this project and thesis and as a result this system becomes much more user Friendly especially for the doctor.

3.2 DOT NET FRAMEWORK

The Microsoft .NET Framework is a software technology that is available with several Microsoft Windows operating systems. It includes a large library of precoded solutions to common programming problems, a runtime or virtual machine that manages the execution of programs written specifically for the framework, and a set of tools for configuring and building applications. The .NET Framework is a key Microsoft offering and is intended to be used by most new applications created for the Windows platform. Programs written for the .NET Framework execute in a software environment that manages the program's runtime requirements. Also part of the .NET Framework, this runtime environment is known as the Common Language Runtime (CLR). The CLR provides the appearance of an application virtual machine so that programmers need not consider the capabilities of the specific
29

CPU that will execute the program. The CLR also provides other important services such as security, memory management, and exception handling. The class library and the CLR together compose the .NET Framework.

The .NET Framework is included with Windows Server 2008 and Windows Vista. The current version of the framework can also be installed on Windows XP and the Windows Server 2003 family of operating systems. A reduced "Compact" version of the .NET Framework also available on Windows Mobile platforms, including Smart phones. Some characteristics of .NET Framework are as follows: Interoperability Common Runtime Engine Language Independence Base Class Library Simplified Deployment Security Portability

The ability to make the entire range of computing devices work together and to have user information automatically updated and synchronized on all of them

Increased interactive capability for Web sites, enabled by greater use of XML (Extensible Markup Language) rather than HTML

30

A premium online subscription service, that will feature customized access and delivery of products and services to the user from a central starting point for the management of various applications, such as email, for example, or software, such as Office NET

Centralized data storage, which will increase efficiency and case of access to information, as well as synchronization of information among users and devices

The ability to integrate various communications media, such as e-mail, faxes, and telephones

For developers, the ability to create reusable modules, which should increase productivity and reduce the number of programming errors.

3.3 ASP .NET ASP.NET is a web application framework developed and marketed by Microsoft that programmers can use to build dynamic web sites, web applications and web services. It was first released in January 2002 with version 1.0 of the NET Framework, and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime, allowing programmers to write ASP.NET code using any supported _NET language.

31

3.3.1 Pages ASP.NET pages, known officially as "web forms", are the main building block for application development. Web forms are contained in files with an ASPX extension; in programming jargon, these files typically contain static HTML or XHTML markup, as well as markup defining server-side Web Controls and User Controls where the developers place all the required static and dynamic content for the web page. Additionally, dynamic code which runs on the server can be placed in a page within a block <% ---dynamic code ---%> which is similar to other web development technologies such as PHP, JSP, and ASP, but this practice is generally discouraged except for the purposes of data binding since it requires more calls when rendering the page.

3.3.2 Code behind Model It is recommended by Microsoft for dealing with dynamic program code to use the code-behind model, which places this code in a separate file or in a specially designated script tag. Code-behind files typically have names like diagnosis.aspx.cs or diagnosis.aspx based on the ASPX file name (this practice is automatic in Microsoft Visual Studio and other IDLs). When using this style of programming, the developer writes code to respond to different events, like the page being loaded, or a control being clicked, rather than a procedural walk through the document.

32

3.3.3 User Controls ASP.NET supports creating reusable components through the creation of User Controls. A user Control follows the same structure as a Web Form, except that such controls are derived from the system.Web.UI.UserControl class, and are stored in ASCX files. Like ASPX files, an ASCX contains static HTML or XHTML markup, as well as markup defining web controls and other User Controls. The code-behind model can be used. Programmers can add their own properties, methods, and event handlers. An event bubbling mechanism provides the ability to pass an event fired by a user control up to its containing page. 3.3.4 Session state Session state is a collection of user-defined session variables, which are persisted during a user session. These variables are unique to different instances of a user session, and are accessed using the session collection. Session variables can be set to be automatically destroyed after a defined time of inactivity, even if the session does not end. At the client end a user session is identified either by a cookie or by encoding the session ID in the URL itself.

3.3.5 Directory Structure In general, the ASP.NET directory structure can be determined by the developer's preferences. Apart from a few reserved directory names, the site can span any number of directories. The structure is typically reflected directly in the URLs. Although ASP.NET provides means for intercepting the request at
33

any point during processing, the developer is not forced to funnel requests through a central application or front controller. The special directory names (from ASP.NET 2.0 on) are: App_Browsers: Holds site specific browser definition files.

App_Code: This is the "raw code" directory. The ASP.NET server will automatically compile files (and subdirectories) in this folder into an assembly which is accessible in the code of every page of the site. App Code will typically be used for data access abstraction code, model code and business code. Also any sitespecific http handlers and modules and web service implementation go in this directory. As an alternative to using App Code the developer may opt to provide a separate assembly with precompiled code.

App_Data It is a default directory for databases, such as Access .mdb files and SQL Server .mdf files. This directory is usually the only one with write access for the application. App LocalResources Contains localized resource files for individual pages of the site. E.g. a file called Checlc0ut.aspx.fr-FR.resx holds localized resources for the French version of the CheckOut.aspx page. When the

34

UI culture is set to French, ASP.NET will automatically find and use this file for localization. App_GlobalResources This folder holds .rcsx files with localized resources available to every page of the site. This is where the ASP.NIJT developer will typically store localized messages etc. which are used on more than one page. App_WebReferences In this folder discovery files and WSDL files for references to web services to be consumed in the site. Bin: It contains compiled code (All files) for controls, components, or other code that you want to reference in our application. Any classes represented by code in the Bin folder are automatically referenced in our application.

3.3.6 Performance ASP.NET aims for performance benefits over other script-based technologies (including Classic ASP) by compiling the server-side code to one or more DLL files on the web server. This compilation happens automatically the first time a page is requested (which means the developer need not perform a separate compilation step for pages). This feature provides the ease of development offered by scripting languages with the performance benefits of a compiled
35

binary. However, the compilation might cause a noticeable delay to the web user when the newly-edited page is first requested from the web server. The ASPX and other resource files are placed in a virtual host on an Internet Information Services server (or other compatible ASP.NET servers; see Other Implementations, below). The first time a client requests a page, the NET framework parses and compiles the file(s) into a.NCT assembly and sends the response; subsequent requests are served from the DLL tiles. By default ASP.NET will compile the entire site in batches of 1000 files upon first request. If the compilation delay is causing problems, the batch size or the compilation strategy may be tweaked. Developers can also choose to pre-compile their code before deployment, eliminating the need for just-in-time compilation in a production environment.

3.4 SQL SERVER Microsoft SQL Server is a relational database management system (RDBMS) produced by Microsoft. Its primary query language is Transact-SQL, an implementation of the ANSI/ISO Standard Structured Query Language (SQL) used by both Microsoft and Sybase. [12]

3.4.1 Architecture The architecture of Microsoft SQL Server is broadly divided into three components: SQLOS which implements the basic services required by SQL Server, including thread scheduling,
36

memory

management

and

I/O

management; the Relational Engine, which implements tile relational database components including support for databases, tables, queries and stored procedures as well as implementing the type system; and the Protocol Layer which exposes the SQL Server functionality.

3.4.2 Relational Engine The Relational engine implements the relational data store using the capabilities provided by SQLOS, which is exposed to this layer via the private SQLOS API. It implements the type system, to define the types of the data that can be stored in the tables, as well as the different 1~ypes of data items (such as tables, indexes, logs etc) that can be stored. It includes the Storage Engine, which handles the way data is stored on persistent storage devices and provides methods for fast access to the data. The storage engine implements log-based transaction to ensure that any changes to the data are ACID compliant. It also includes the query processor, which is the component that retrieves data. SQL queries specify what data to retrieve, and the query processor optimizes and translates the query into the sequence of operations needed to retrieve the data. The operations are then performed by worker threads, which are scheduled for execution by SQLOS.

3.4.3 Data Storage The main unit of data storage is a database, which is a collection of tables with typed columns. SQL Server supports different data types, including primary types such as Integer, Float, Decimal, Char (including character strings), Varchar (variable length character sn-ings), binary (for unstructured blobs of
37

data), Text (for textual data) among others. It also allows user-defined composite types (UDTs) to be defined and used. SQL Server also makes server statistics available as virtual tables and views (called Dynamic Management Views or DMVs). A database can also contain other objects including views, stored procedures, indexes and constraints, in addition to tables, along with a transaction log. An SQL Server, database can contain a maximum of 231 objects, and can span multiple OS-level files with a maximum file size of 220 TB. The data in the database are stored in primary data files with an extension .mdf. Secondary data files, identified with an .ndf extension, are used to store optional metadata. Log files are identified with the .ldf extension.

3.4.4 Data Retrieval The main mode of retrieving data from an SQL Server database is querying for it. The query is expressed using a variant of SQL called T-SQL, a dialect Microsoft SQL Server shares with Sybase SQL Server due to its legacy. The query declaratively specifics what is to be retrieved. It is processed by the query processor, which figures out the sequence of steps that will be necessary to retrieve the requested data. The sequence of actions necessary to execute a query is called a query plan. There might be multiple ways to process the same query. For example, for a query that contains a joint statement and a select statement, executing join on both the tables and then executing select on the results would give the same result as selecting from each table and then executing the join, but result in different execution plans. In such case, SQL Server chooses the plan that is supposed to yield the results in the shortest possible time. This is called query optimization and is performed by the query processor itself.

38

3.5 Reason for using ASP C# and SQL Server Database C# is an object oriented language. In our system we have used different classes and their objects. We used Visual studio2008 as IDE. It's an excellent IDE for rapid application development. It has a very user friendly environment for software development. This IDE provide built in SQL server database service. More over from the above discussion of this chapter we can realize that ASP technology with C# programming language and SQL server database is the best choice as software technology of our system.

39

Chapter 4 System Planning & Design 4.1 Introduction This chapter represents the basic description of the proposed Expert System. In this chapter we actually focus on the planning and designing part which is divided into four stages. They are: 1. System Architecture. 2. Use Case Diagram. 3. Entity Relationship Diagram 4. Knowledge Base Structure. Finally in this chapter we discuss about the artificial intelligence which indicates inference Engine that represents forward chaining and backward chaining of this system.

4.2 Systems Architecture Our system has followed the structure of a standard Expert System as shown in the figure 4. 1. So, for our system we have planned to build a knowledge base (KB), Inference Engine (IE) and Input-Output Interfaces.

40

Figure 4.1: Structure of Expert System

41

The Following Diagram depict our overall system plan

42

43

Figure 4.2: System Structure

4.3 Components of this System

44

Components of this expert system are given below: 1. Administrators Site 2. Doctors 3. Knowledge Base 4. Database for SE 5. Diagnosis a. Basic Diagnosis b. Clinical Diagnosis 1. Relevant Symptoms Selection 2. Generate Questionnaire 3. Add new Symptom c. Recommendation for Test 1. White Blood Cell Count
2. City Scan gallbladder size

3. Endoscope bile duct stone 4. Red Blood Cell count etc. d. Pathological Test 1. Blood test 1. White Blood Cell Count 2. Red Blood Cell Count 3. Serum Analysis 4. Serum Lipase 5. Urine 2. Imaging 1. Gallbladder Size 2. Gall Stone 3. Bile Duct Stone 3. Hematocrit 4. Hemoglobin
45

5. Bilirubin e. Confirm Diseases percentages f. Write Prescription 1. Suggested medicine 2. Add new medicine 3. Remove Medicine 4. Medicine dose each day 5. Medicine duration to use
g. Print Result.

4.4 Major Constraints Any Software based constraints will impact the manner in which the software is to be specified, designed, implemented or tested. The software is specified for An Online Expert Diagnosis System on Disease. Developing tools: Software Technology: 1. 2. 3. 4. Microsoft visual studio 2008 ASP.NET Language: C# Microsoft SQL Server 2005.

Hardware:

46

1. 2. 3.

Computer Printer Server

4.5 Functional Element 4.5.1 Use case List Create Doctor Admin/Doctor Login Verification Add new Patient/Search existing Patient See Patient Old Result Check Basic Test

Show Basic Test Result

Check Clinical Test with Dynamic Symptom and Questionnaire Suggest For Test Check Pathological Test Check Blood Check Urine Check Imaging Suggest medicine Display Final Result Print Result

4.6 User Groups (Admin + Doctor)

47

4.6.1 Role of Administrator Create new Administrator user account Create new Doctor Account View User Data Monitor User Activity Activate User Deactivate user Block User 4.6.2 Role of Doctor Main User of our System Add new patient Search Existing patient Check Patient Basic Test Check Patient Clinical Test Check Patient Pathological Test Finally decide the diseases with system and doctor decision Prescribe Medicine Print Result

48

4.7 Use Case Diagram The Use Case diagram consists of five very simple graphics that represent the System, Actors, Use Cases, Associations, and dependencies of the project. The goal of the diagram is to provide a high-level explanation of the relationship between the system and the outside world. System: Sets the boundary of the system in relation to the actors who use it (outside the system) and the features it must provide (inside the system). Actor: A role played by a person or system that has a stake in the successful operation of the system. Example: administrator, counter manager, user etc. Use Case: Identities a key feature of the system. Without these features, the system will not fulfill the user/actor requirements. Each Use Case expresses a goal that the system must achieve.

49

Figure 4.3: Use Case Diagram for Online Expert Diagnosis System

50

4.8 Entity Relationship Diagram

51

52

Figure 4.4: Entity Relationship(ER) Diagram of Online Expert Diagnosis System

4.9 Knowledge Base Structure

53

Figure 4.5: knowledge base structure

4.10 Description of Tables


54

4.10.1 tblDoctor Profile

This is doctors table. An admin can create a doctor. It contains doctor name, address, contact, chamber, sex, specialty, Degree, Hospital, email, Username. Using username a doctor can login in our system. And specialty means a patient can choose his right doctor for his disease problem; As a result he cant run more doctors.

4.10.2 tblPatientProfile

55

This is patient table. This table will be created by doctors. It contains name, address, id, contact, dob, age, sex, email, doctor, image. Patient age will be calculated by entry data-date of birth. 4.10.3 tblLogin

This is login table. This table uses by both Doctor and admin. It contains username, password, type, status, lastaccess, code, create time, passreset. Here type means which user login now admin or doctor. Status means user is active or deactive if doctor are not use our expert diagnosis system. Code is when a doctor applies for use our system then we sends an email with generates a secret
56

code. When he put this value in our code field then doctor account is active in our system and this is Create time.

4.10.4 tblTest

This is test table. It contains test id, test name, test description and test for. This table keeps test history for different disease. As a result, new doctor learn which test is suitable for different disease.

4.10.5 tbltocken

This is knowledge base table. In this table we keep symptom keyword. If new disease is come than we match keyword for find desired disease. 4.10.6 tblSymptom

57

This is symptom table. It is uses for clinical diagnosis. It contains symptom id, symptom category, symptom sequence, symptom Caption, symptom value, Question id, id. We know every disease has different symptom. So, we use symptom id for catch the specific disease. For supporting tools we use also symptom category, sequence. Caption use for resulting the correct disease because same symptom has different disease so distinguish them we use caption. Value is a specific symptom rate. Using this value we find the desired disease by calculating probability Rate. If highest probability is found then we sure that this patient has this disease.

58

4.10.7 tblPathology

This is

pathology table. This table generate after clinical disease result. It contains patient internal information like blood, urine, serum, wbc, rbc, hematocrit, hemoglobin, bilirubin, ct scan, ultrasound, endoscopy result. It also keeps previous internal information. After given all input than it calculates the input value that is r_val and from r_val it shows the probability of all disease. And result is show the correct disease that disease has highest probability value.

4.10.8 tblDisease

59

This is basic disease table. It contains the different disease so we use disease id. For this disease id we use also disease name, type, description and category.

4.10.9 tblDiagnosisRecord

This table saves all previous disease record with symptom. As a result, a doctor can decide which disease can occur now.

60

4.10.10 tblMedicine

This is Medicine table. Use this table a doctor can easily decide which medicine is better for specific disease. This table contains Medicine id, name, type, value, hit, manufacture, for, effect, extract. Hit use for medicine rating. If expert doctor use specific medicine than hit counter will increase than a new doctor can easily decide that this medicine is useful for this disease.

4.10.11 tblMedication

61

This table used for prescription. A Doctor can suggest medicine with quantity of medicine, doses. This information saves in this table.

4.10.12 tblQuestion

This is question table. It is contain all symptom of different disease. This table create dynamic generated question after the Clinical symptom table.

4.10.13 tblPhysicalInfo

This table uses for basic diagnosis. When a patient come to the doctor than doctor check her pulse, Blood pressure, Body temperature, pain, anemia and skin color. 4.10.14 tblUser
62

This is user management table. 4.11 Inference Engine Inference Engine discusses the criteria of queries for the system which give emphasis on some critical queries. We have used both forward and backward chaining in our system. When the system gets a new data from the doctor it check the data from the knowledge base and if it matches with a rule which was generated from the knowledge base and take decision accordingly. After that the data is saved for future purpose. For example all the data for different Clinical Tests have saved in the database. If any value for the given test type is Greater than the normal range than it will take decision from the knowledge which has stored in the database. A doctor can also give his/her own comment for the Test. All the data is stored in the database for future purpose.

63

Chapter 5 Implementation & Description

5.1 Introduction This Project contains all the necessary information about the Expert diagnosis system on various diseases. This is very much helpful for a user to find out about disease. This chapter describes the different parts and pages of the implementation of the software.

5.2 Basic steps of working This is the chapter which implements the entire software of this project and also tries to find out how this software works in all stages. Here is some description of this steps are available on EDS.

64

5.2.1 Home Page

Figure 5.1 Home page of Expert Diagnosis System

This is the figure of our home page. Since our project name is Expert Diagnosis System on Acute Pancreatitis, Appendicitis and Cholesitis. Our system differentiates these three diseases when doctor confused to indicate which diseases exactly. Automatically we have to provide a Login page where users
65

that can be an Administrator or a doctor have to give his/her user name and password. After verifying the user name and password our system will give the permission to go further.

5.2.2 Doctor/Admin Log In

Figure 5.2 Admin Log In

This is a figure of Admin/Doctor login page. From the login page doctor can add/search patient and then can diagnosis that patient. After login doctor can manage or create user. Admin can also activate, deactivate or block e user. 5.2.3 Password Reset or Forget

Figure 5.3 Password forgets or reset.

66

Password can reset by proving old password. Forget Password can be reset by providing security code that is sending to mail account. 5.2.4 Doctor Create

Figure 5.3 User Create

In our system admin can create a doctor or a doctor can join as doctor by providing his/her information. Then admin review and verify his/her account. If account contains correct data then admin activate his/her account. On registration a security code also send to his/her account to verify his mail id. On registration doctor info saves on tblDoctorprofile n this table has e relation with tblLogin.

67

5.2.4 Account Activation by automatic system generated security code via mail.

Figure 5.5 Account activation via mail

When a doctor account is created then our system send an automatic mail to his mail id with an activation link. After putting that security numbers on our system interface (that given below) his/her account will activated for use.

Figure 5.6 Enter security code from mail for activation

68

Figure 5.6 welcome message after activation

After activating account by entering security code from mail a confirmation message is send to his/her account as welcome message. The user can use his/her account for farther processing.

69

5.2.5 Adding New Patient

Figure 5.7 Patient Adding by doctor

Doctor can add new patient by providing patient info. And a patient needs to add to diagnosis his physical condition. Patient data will be saving on tblPatientprofile table.

5.2.7 Search Patient:


70

Figure 5.8 Search Existing Patient

Doctor can search existing patient by using patient Name, ID or Doctors Name and result will published on figure below.

Figure 5.8 Search Existing Patient

71

After clicking on find patient our system will show detail info of that patient for farther processing like-name, id, address, contact, email, sex, age, doctor etc.

5.2. Doctors Information

Figure 5.9 Doctor Profile

72

Doctor can view or edit his/her information by clicking on My Profile Link from right side of main interface. Doctor info include image, name, address, contact date of birth, chamber, hospital, specialty, user name and email address etc. 5.2.8 Patient Information

Figure 5.9 Patient information

73

After clicking on view patient system will show his/her detail and previous diseases information. Like diseases name, basic test result, clinical test result, pathological result and percentages of diseases. 5.2.9 Basic Information

Figure 5.10 Patient Basic Tests

74

From the interface top a doctor can check a patient basic test by putting pulse, blood pressure range, body temperature, anemia, skin color etc.

5.2.10 Basic Result

Figure 5.10 patient basic tests

After submitting patient basic information our system will provide a general test result based on patient basic info. Basic include pulse, blood pressure, temperature, pain, anemia, jondish etc.

75

5.2.11 Clinical Diagnosis

Figure 5.10 Dynamic symptom

On clinical test our system will generate some relevant symptom on pancreatitis, appendicitis and Cholecystitis. System also have an option to add new symptom that may be able to arise on doctor mind, we add that symptom on our database by matching with token. After math with a token that symptom will listed finally for next time use with weight value.

76

5.2.10 Clinical test Dynamic Questions

Figure 5.11 Dynamic Questions

This is automatically generated question based on patient clinical test symptom selection. After submitting this questions system will provide a clinical test result for farther processing.

77

5.2.11 Clinical Result with suggested pathological test

Figure 5.11 Clinical test results with suggested pathological test

After submitting dynamic questions system will redirect to result with suggested pathological test. Results include diseases name and total probability of diseases. Suggestion include some pathological test like- White blood cell count, CT scan Gallbladder Size, Endoscope Bile duct Stone, Red Blood Cell Count etc.

78

5.2.12Pathological Test

Figure 5.11 pathological test

In pathological test doctor will check patient report by using interface above. Pathological Test include Serum analyze, Serum Lipase,24 Urine, White blood Cell count, Red Blood Cell count, Imaging, Gallbladder size, Gall stone, Bile Duct Stone, Hematocrit, Hemoglobin, Bilrubin etc.

79

5.2.13Pathological Test Result

Figure 5.11 pathological tests Result

In Pathological Test Result our system provides a final result of diseases percentage that is based on pathological test and clinical test. If the percentage is between (45-49) then our system suggest to re test. If Result is more than 50 percent then our system suggests that diseases may be able to occur. Or if the result is less than 45 percent then our system suggests You should contact with the other specialist.

80

5.2.14Prescribe Medicine

Figure 5.12 Prescribe Medicine

This is last interface of our system that provides an option to doctor to write/suggest prescription of require medicine. If the required medicine not available for suggest then doctor can add new medicine that will store for future use and also for current patient. When doctor will add new medicine then he/she can provide medicine name, medicine power, dose, days etc.

81

5.2.15 Patient Old Records

Figure 5.13 Patient Old Records

In Patient old records include patient previous diagnosis results that help doctor to decide farther processing. It also help patient. When patient forget to carry his previous prescription then he/she can see his/her previous result from our system by help of doctor.

82

5.3

Knowledge Base Implementation

5.3.1 For Basic Test In basic system take patient basic info like pulse rate, blood pressure range, body temperature, any pain in body, anemia, skin color. After provide these info our system provide a result that help doctor to see about patient initial physical condition. The sample code is given below:
public partial class patient_basicresult : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { EntityUser user = (EntityUser)Session["user"]; if (Session["user"] != null) { lblPulse.Text = Pulse(); lblBp.Text = BP(); lblTemparature.Text = Temparature(); lblpain.Text = ((EntityPatient)Session["patient"]).Pain; lblAnemia.Text = Anemia(); lblSkin.Text = Skin(); } else { Response.Redirect("~/application/login/loginuser.a spx");

83

} } private String Pulse() { String result =""; if (((EntityPatient)Session["patient"]).Pulse == "Below 60") { result = "Tachycardia"; } else if (((EntityPatient)Session["patient"]).Pulse == "60-90") { result = "Normal"; } else if (((EntityPatient)Session["patient"]).Pulse == "Above 90") { result = "dradycardia"; } return result; } private String BP() { String result = ""; if (((EntityPatient)Session["patient"]).Bp == "Systolic(>140)& Diastolic(>100)") { result = "High Pressure"; }

84

else if (((EntityPatient)Session["patient"]).Bp == "Systolic(100-140)& Diastolic(60-100)") { result = "Normal"; } else if (((EntityPatient)Session["patient"]).Bp == "Systolic(<100)& Diastolic(<60)") { result = "Low Pressure"; } return result; } private String Temparature() { String result = ""; if (((EntityPatient)Session["patient"]).Temperature == "Below 98.6") { result = "Hypthermia"; } else if (((EntityPatient)Session["patient"]).Temperature == "98.6") { result = "Normal"; } else if (((EntityPatient)Session["patient"]).Temperature == "Above 98.6") { result = "Hyterthermia";

85

} return result; } private String Anemia() { String result = ""; if (((EntityPatient)Session["patient"]).Anemia == "White at lower Congunetiva" || ((EntityPatient)Session["patient"]).Anemia == "White at the finger end" || ((EntityPatient)Session["patient"]).Anemia == "Both of them") { result = "May be.Have to test glucose"; } else if (((EntityPatient)Session["patient"]).Anemia == "None of them") { result = "No"; } return result; } private String Skin() { String result = ""; if (((EntityPatient)Session["patient"]).Skin == "Blue") { result = "May be.Have to test blood"; }

86

else if (((EntityPatient)Session["patient"]).Skin == "Normal") { result = "No"; } return result; } protected void btnGo_Click(object sender, EventArgs e) { Response.Redirect("../patient/diagnosis_new.aspx"); } }

5.3.2 For Clinical Test Dynamic Questionnaires In clinical test our system generate come dynamic question that is based on pancreatitis, appendicitis, cholesitis. If doctor found some other symptoms from patient that is not available on our system then doctor can add that symptom by clicking on add other. And that symptom will be added in our database by matching token. This symptom can be used in future. The sample code is given below:
public partial class diagnosis_new : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { EntityUser user = (EntityUser) Session["user"]; EntityPatient patient = (EntityPatient) Session["patient"];

87

if (Session["user"] != null) { if (!Page.IsPostBack) { Load_all_sym(); if (Session["patient"] != null) { lblPatientName.Text = "<b>Patient :</b>" + ((EntityPatient) Session["patient"]).Name; } } } else { Response.Redirect("~/application/login/loginuser.a spx"); } } private bool checkentry() { foreach (ListItem lst in CheckBoxList1.Items) if (lst.Selected) return true; foreach (ListItem lst in CheckBoxList2.Items) if (lst.Selected) return true; foreach (ListItem lst in CheckBoxList3.Items) if (lst.Selected) return true;

return false;

88

} protected void Button1_Click(object sender, EventArgs e) { if (!checkentry()) return; clsDataRet pan; clsDataRet app; clsDataRet col; clsDataRet com; string max = ""; com = getforcommon(ref CheckBoxList4, "COM"); pan = getselitem(ref CheckBoxList1, "PAN", com.SelVal); app = getselitem(ref CheckBoxList2, "APP", com.SelVal); col = getselitem(ref CheckBoxList3, "COL", com.SelVal);

if (pan.SelVal > app.SelVal) { if (pan.SelVal > col.SelVal) { max = "pan"; } else { max = "col"; } }

89

else { if (app.SelVal > col.SelVal) { max = "app"; } else { max = "col"; } } Session["pan"] = pan; Session["app"] = app; Session["col"] = col; Session["com"] = com; Session["max"] = max; if (Response != null) Response.Redirect("~/application/patient/default2.aspx"); }

private void Load_all_sym() { load_by_cat(ref CheckBoxList1, "PAN"); load_by_cat(ref CheckBoxList2, "APP"); load_by_cat(ref CheckBoxList3, "COL"); load_by_cat(ref CheckBoxList4, "COM"); }

90

private clsDataRet getforcommon(ref CheckBoxList chk, string category) { tblSymptomTableAdapter sym = new tblSymptomTableAdapter(); string[] tmp; clsDataRet ret = new clsDataRet(); double cnt = 0; ret.SelItm = "";

foreach (ListItem lst in chk.Items) { if (lst.Selected) { tmp = lst.Value.Split(':'); cnt += Convert.ToDouble(tmp[1]); ret.SelItm += tmp[0] + ","; } }

return ret; } private clsDataRet getselitem(ref CheckBoxList chk, string category, double comval) { tblSymptomTableAdapter sym = new tblSymptomTableAdapter(); string[] tmp;

91

clsDataRet ret = new clsDataRet(); double tot = Convert.ToDouble(sym.GetTolVal(category)); double cnt = 0; ret.SelItm = "";

foreach (ListItem lst in chk.Items) { if (lst.Selected) { tmp = lst.Value.Split(':'); cnt += Convert.ToDouble(tmp[1]); ret.SelItm += tmp[0] + ","; } } ret.SelVal += comval; ret.SelVal = 100*cnt/tot; return ret; } private void load_by_cat(ref CheckBoxList chk, string category) { tblSymptomTableAdapter sym = new tblSymptomTableAdapter(); dtsMedical.tblSymptomDataTable dt = new dtsMedical.tblSymptomDataTable(); ListItem lst; dt = sym.GetDataByCat(category); chk.Items.Clear();

92

foreach (dtsMedical.tblSymptomRow dr in dt.Rows) { lst = new ListItem(); lst.Text = dr.sym_caption; lst.Value = dr.sym_id.ToString() + ":" + dr.sym_value.ToString(); chk.Items.Add(lst); } } protected void CheckBox1_CheckedChanged(object sender, EventArgs e) { if (CheckBox1.Checked) { TextBox1.Text = ""; TextBox1.Visible = true; Button2.Visible = true; } else { TextBox1.Visible = false; Button2.Visible = false; } } protected void Button2_Click(object sender, EventArgs e) { int maxsl, maxcatsl; int iapp, icol, ipan, maxint; string max = ""; tblTokenTableAdapter tok = new tblTokenTableAdapter();

93

dtsMedical.tblTokenDataTable dt = new dtsMedical.tblTokenDataTable(); tblQuestionsTableAdapter ques = new tblQuestionsTableAdapter(); tblSymptomTableAdapter sym = new tblSymptomTableAdapter();

dt = tok.GetData(); iapp = getcnt(dt[0].tokapp); icol = getcnt(dt[0].tokcol); ipan = getcnt(dt[0].tokpan); if (ipan > iapp) { if (ipan > icol) { max = "PAN"; maxint = ipan; } else { max = "COL"; maxint = icol; } } else { if (iapp > icol) { max = "APP"; maxint = iapp; }

94

else { max = "COL"; maxint = icol; } } maxsl = (int) sym.GetMaxSl() + 1; maxcatsl = (int) sym.GatMaxCatSl(max) + 1; sym.InsertQuery(maxsl.ToString(), max, maxcatsl, TextBox1.Text, (maxint*5).ToString()); ques.Insert(maxsl.ToString(), 1, "High"); ques.Insert(maxsl.ToString(), 2, "Medium"); ques.Insert(maxsl.ToString(), 3, "Low"); TextBox1.Visible = false; Button2.Visible = false; CheckBox1.Checked = false; Load_all_sym(); } private int getcnt(string str) { string[] tmp, tmp2; int i = 0; tmp = str.Split(','); tmp2 = TextBox1.Text.Split(' '); foreach (string s1 in tmp) { foreach (string s2 in tmp2)

95

{ if ((s1.Trim() == s2.Trim()) && (s1.Trim() != "")) { i++; goto next; } } next: ; } return i; } }

5.3.3 For clinical Test

In case of clinical test the system take blood pressure, pulse rate and some physical symptom and it check with the knowledge given to it. After checking it determine whither is there any problem or not and display comment according to the problem. After providing the result the system saves the data in the database. The user interface already given in the previous part. The sample code is given below:
public partial class application_Default2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { 96

load_q(); } private void load_q() { string max,val1,val2; clsDataRet pan, app, col, com; pan = (clsDataRet)Session["pan"]; app = (clsDataRet)Session["app"]; col = (clsDataRet)Session["col"]; com = (clsDataRet)Session["com"];

max = Session["max"].ToString() ;

getfromstr(pan.SelItm); getfromstr(app.SelItm); getfromstr(col.SelItm); getfromstr(com.SelItm); txtPathology.Visible = false; Label2.Visible = false; } private void getfromstr(string str) { string[] tmp; tmp = str.Split(','); foreach (string itm in tmp) { if (itm != "")getq(itm); } }

97

private void getq(string sid) { tblSymptomTableAdapter sym = new tblSymptomTableAdapter(); dtsMedical.tblSymptomDataTable dtsym = new dtsMedical.tblSymptomDataTable(); tblQuestionsTableAdapter ques = new tblQuestionsTableAdapter(); dtsMedical.tblQuestionsDataTable dt = new dtsMedical.tblQuestionsDataTable(); RadioButtonList rdo = new RadioButtonList(); // ListItem lst; Label lb; dtsym = sym.GetDataByid(sid); if (dtsym.Rows.Count == 0) return; dt = ques.GetDataBySym(dtsym[0].ques_id); rdo.Items.Clear();

foreach(dtsMedical.tblQuestionsRow dr in dt.Rows) { rdo.Items.Add(dr.questions); } if (rdo.Items.Count > 0) { lb = new Label();

98

lb.Text="*" + dtsym[0].sym_caption; lb.ID = dtsym[0].ques_id.ToString(); PlaceHolder1.Controls.Add(lb); PlaceHolder1.Controls.Add(rdo); } } protected void Button1_Click(object sender, EventArgs e) { tblDiagonosisRecordTableAdapter dia = new tblDiagonosisRecordTableAdapter(); Button2.Visible = true; Button1.Visible = false; txtPathology.Visible = true; Label2.Visible = true; clsDataRet pan, app, col, com; pan = (clsDataRet)Session["pan"]; app = (clsDataRet)Session["app"]; col = (clsDataRet)Session["col"]; com = (clsDataRet)Session["com"]; string maxpoint; PlaceHolder1.Visible = false; Label1.Visible = true; Label2.Visible = true; Label3.Visible = true; if (Session["max"].ToString().ToUpper() == "APP")

99

{ String res = "Disease Probability = "; String res2 = "Disease Probability = "; String res3 = "Disease Probability = "; String dis = "Acute Appendicitis"; Label1.Text = res + app.SelVal.ToString("N2"); EntityMedicine med = new BLLPrescription().SuggestPathology(dis); for (int i = 0; i < med.Tests.Length;i++) { txtPathology.Text = med.Tests[i] + "\n"; } Session.Add("result2","Acute Choleysities"); Session.Add("r_val2", col.SelVal.ToString("N2")); Session.Add("result", dis); Session.Add("r_val", app.SelVal.ToString("N2")); Session.Add("result3", "Acute Pancreatitis"); Session.Add("r_val3", pan.SelVal.ToString("N2")); Button2.PostBackUrl = "Test_Pan.aspx"; maxpoint=app.SelVal.ToString("N2"); } else if (Session["max"].ToString().ToUpper() == "COL") { String res = "Disease Probability ="; Acute Choleysities, Total txtPathology.Text + Acute Pancreatitis, Total Acute Choleysities, Total Acute Appendicitis, Total

100

String res2 = "Disease Probability = "; String res3 = "Disease Probability = ";

Acute Appendicitis, Total Acute Pancreatitis, Total

String dis = "Acute Choleysities"; Label1.Text = res + col.SelVal.ToString("N2"); EntityMedicine med = new BLLPrescription().SuggestPathology(dis); for (int i = 0; i < med.Tests.Length; i++) { txtPathology.Text = txtPathology.Text + med.Tests[i] + "\n"; } Session.Add("result", dis); Session.Add("r_val", col.SelVal.ToString("N2")); Session.Add("result2", "Acute Appendicitis"); Session.Add("r_val2", app.SelVal.ToString("N2")); Session.Add("result3", "Acute Pancreatitis"); Session.Add("r_val3", pan.SelVal.ToString("N2")); Button2.PostBackUrl = "Test_Pan.aspx"; maxpoint=col.SelVal.ToString("N2"); } else { String res = "Disease Probability ="; String res2 = "Disease Probability ="; String res3 = "Disease Probability = "; Acute Appendicitis, Total Acute Choleysities, Total Acute Pancreatitis, Total

101

String dis = "Acute Pancreatitis"; Label1.Text = res + pan.SelVal.ToString("N2"); EntityMedicine med = new BLLPrescription().SuggestPathology(dis); for (int i = 0; i < med.Tests.Length; i++) { txtPathology.Text = txtPathology.Text + med.Tests[i] + "\n"; } Session.Add("result", dis); Session.Add("r_val", pan.SelVal.ToString("N2")); Session.Add("result2", "Acute Appendicitis"); Session.Add("r_val2", app.SelVal.ToString("N2")); Session.Add("result3", "Acute Choleysities"); Session.Add("r_val3", col.SelVal.ToString("N2")); Button2.PostBackUrl = "Test_Pan.aspx"; maxpoint=pan.SelVal.ToString("N2"); } int pid = ((EntityPatient) Session["patient"]).Id; if (dia.GetDataBy1(pid).Rows.Count == 0) { dia.InsertQuery(pid, pan.SelItm, app.SelItm, col.SelItm, com.SelItm, Session["max"].ToString().ToUpper(), maxpoint, DateTime.Now, ((EntityUser)Session["user"]).Username, ((EntityUser)Session["user"]).Name); } else

102

{ dia.InsertQuery(pid, pan.SelItm, app.SelItm, col.SelItm, com.SelItm, Session["max"].ToString().ToUpper(), maxpoint, DateTime.Now, ((EntityUser)Session["user"]).Username, ((EntityUser)Session["user"]).Name); } //save entry } }

103

5.3.3 Pathological Test Pathological test is the final face of patient diagnosis. Pathological test confirm that which disease may have patient. Pathological test exually percentage based result. Pathological Test include Serum analyze, Serum Lipase,24 Urine, White blood Cell count, Red Blood Cell count, Imaging, Gallbladder size, Gall stone, Bile Duct Stone, Hematocrit, Hemoglobin, Bilrubin etc. If the percentage is between (45-49) then our system suggest to re test. If Result is more than 50 percent then our system suggests that diseases may be able to occur. Or if the result is less than 45 percent then our system suggests You should contact with the other specialist. The sample code is given below:
public partial class application_Default2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { pnlResult.Visible = false; if (Session["user"] == null) { Response.Redirect("~/application/login/loginuser.a spx"); } else if (Session["patient"] == null) { Response.Redirect("~/application/patient/findpatie nt.aspx"); } } protected void btnSave_Click(object sender, EventArgs e)

104

{ EntityPathology pathology = new EntityPathology(); pnlResult.Visible = true; pathology.Bilirubin = ddlBilirubin.SelectedValue; pathology.Blood = ddlBloodSample.SelectedValue; pathology.DocName = ((EntityUser) Session["user"]).Name; pathology.Hematocrit = ddlHematocrit.SelectedValue; pathology.Hemoglobin = ddlHemoglobin.SelectedValue; pathology.PatID = ((EntityPatient) Session["patient"]).Id; pathology.Rbc = ddlRedBloodCell.SelectedValue; pathology.Serum = ddlSerumLipase.SelectedValue; pathology.Urine = ddlUrinSample.SelectedValue; pathology.Username = ((EntityUser) Session["user"]).Username; pathology.Wbc = ddlWhiteBloodCell.SelectedValue; pathology.CtScan = ddlImagingGallbladder.SelectedValue; pathology.UltraSound = ddlImagingGallStone.SelectedValue; pathology.Endoscopy = ddlImagingBileDuct.SelectedValue; pathology.Result = ((String)Session["result"]); pathology.RVal = ((String)Session["r_val"]); Session.Add("pathology", pathology);

int i = BLLPathology.InsertValue(pathology); Check(); }

105

private void Check() { EntityPathology path = ((EntityPathology) Session["pathology"]); String str = "Above"; if (path.Bilirubin == str || path.Blood == str || path.Hematocrit == str || path.Hemoglobin == str || path.Rbc == str || path.Serum == str || path.Urine == str || path.Wbc == str || path.UltraSound == "Found" || path.CtScan == "Increase" || path.Endoscopy == "Found") { //float x = (Session["r_val"]); //Response.Write(x); if (Convert.ToDouble((String)Session["r_val"]) >= 50) { lblRes.Text = "<font color=red><b>" + ((String)Session["result"]).ToString() + " " + ((String)Session["r_val"]) + " Confirm.</b></font>"; } else if (Convert.ToDouble((String)Session["r_val"]) < 49 && Convert.ToDouble((String)Session["r_val"]) >= 45) { lblRes.Text = "<font color=red><b>" + ((String)Session["result"]).ToString() + " " + ((String)Session["r_val"]) + " So the system is confused that the patient have this disease or not.</b></font>"; } else { lblRes.Text = "<b>You should contact with the other specialist.</b>"; }

106

} else { lblRes.Text = "<b>You should contact with the other specialist.</b>"; } } protected void btnPrescribe_Click(object sender, EventArgs e) { Response.Redirect("../patient/prescribe.aspx"); } }

5.3.4 Prescribe Medicine In prescribe medicine doctor can suggest required medicine to patient that is available. If the required medicine is not available for suggest then doctor can add new medicine that will store for future use and also for current patient. When doctor will add new medicine then he/she can provide medicine name, medicine power, dose, days etc.

The sample code is given below: public partial class diagnosis_new : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {
107

EntityUser user = (EntityUser) Session["user"]; EntityPatient patient = (EntityPatient) Session["patient"]; if (Session["user"] != null) { if (!Page.IsPostBack) { Load_all_sym(); if (Session["patient"] != null) { lblPatientName.Text = "<b>Patient :</b>" + ((EntityPatient) Session["patient"]).Name; } } } else { Response.Redirect("~/application/login/lo ginuser.aspx"); } } private bool checkentry() { foreach (ListItem lst in CheckBoxList1.Items) if (lst.Selected) return true;

108

foreach (ListItem lst in CheckBoxList2.Items) if (lst.Selected) return true; foreach (ListItem lst in CheckBoxList3.Items) if (lst.Selected) return true;

return false; } protected void Button1_Click(object sender, EventArgs e) { if (!checkentry()) return; clsDataRet pan; clsDataRet app; clsDataRet col; clsDataRet com; string max = ""; com = getforcommon(ref CheckBoxList4, "COM"); pan = getselitem(ref CheckBoxList1, "PAN", com.SelVal); app = getselitem(ref CheckBoxList2, "APP", com.SelVal);

109

col = getselitem(ref CheckBoxList3, "COL", com.SelVal); if (pan.SelVal > app.SelVal) { if (pan.SelVal > col.SelVal) { max = "pan"; } else { max = "col"; } } else { if (app.SelVal > col.SelVal) { max = "app"; } else { max = "col"; } } Session["pan"] = pan; Session["app"] = app; Session["col"] = col;

110

Session["com"] = com; Session["max"] = max; if (Response != null) Response.Redirect("~/application/patient/default2.asp x"); } private void Load_all_sym() { load_by_cat(ref CheckBoxList1, "PAN"); load_by_cat(ref CheckBoxList2, "APP"); load_by_cat(ref CheckBoxList3, "COL"); load_by_cat(ref CheckBoxList4, "COM"); } private clsDataRet getforcommon(ref CheckBoxList chk, string category) { tblSymptomTableAdapter sym = new tblSymptomTableAdapter(); string[] tmp; clsDataRet ret = new clsDataRet(); double cnt = 0; ret.SelItm = "";

111

foreach (ListItem lst in chk.Items) { if (lst.Selected) { tmp = lst.Value.Split(':'); cnt += Convert.ToDouble(tmp[1]); ret.SelItm += tmp[0] + ","; } } return ret; } private clsDataRet getselitem(ref CheckBoxList chk, string category, double comval) { tblSymptomTableAdapter sym = new tblSymptomTableAdapter(); string[] tmp; clsDataRet ret = new clsDataRet(); double tot = Convert.ToDouble(sym.GetTolVal(category)); double cnt = 0; ret.SelItm = ""; foreach (ListItem lst in chk.Items) {

112

if (lst.Selected) { tmp = lst.Value.Split(':'); cnt += Convert.ToDouble(tmp[1]); ret.SelItm += tmp[0] + ","; } } ret.SelVal += comval; ret.SelVal = 100*cnt/tot; return ret; } private void load_by_cat(ref CheckBoxList chk, string category) { tblSymptomTableAdapter sym = new tblSymptomTableAdapter(); dtsMedical.tblSymptomDataTable dt = new dtsMedical.tblSymptomDataTable(); ListItem lst; dt = sym.GetDataByCat(category); chk.Items.Clear(); foreach (dtsMedical.tblSymptomRow dr in dt.Rows) { lst = new ListItem(); lst.Text = dr.sym_caption;

113

lst.Value = dr.sym_id.ToString() + ":" + dr.sym_value.ToString(); chk.Items.Add(lst); } } protected void CheckBox1_CheckedChanged(object sender, EventArgs e) { if (CheckBox1.Checked) { TextBox1.Text = ""; TextBox1.Visible = true; Button2.Visible = true; } else { TextBox1.Visible = false; Button2.Visible = false; } } protected void Button2_Click(object sender, EventArgs e) { int maxsl, maxcatsl; int iapp, icol, ipan, maxint; string max = "";

114

tblTokenTableAdapter tok = new tblTokenTableAdapter(); dtsMedical.tblTokenDataTable dt = new dtsMedical.tblTokenDataTable(); tblQuestionsTableAdapter ques = new tblQuestionsTableAdapter(); tblSymptomTableAdapter sym = new tblSymptomTableAdapter();

dt = tok.GetData(); iapp = getcnt(dt[0].tokapp); icol = getcnt(dt[0].tokcol); ipan = getcnt(dt[0].tokpan); if (ipan > iapp) { if (ipan > icol) { max = "PAN"; maxint = ipan; } else { max = "COL"; maxint = icol; } }

115

else { if (iapp > icol) { max = "APP"; maxint = iapp; } else { max = "COL"; maxint = icol; } } maxsl = (int) sym.GetMaxSl() + 1; maxcatsl = (int) sym.GatMaxCatSl(max) + 1;

sym.InsertQuery(maxsl.ToString(), max, maxcatsl, TextBox1.Text, (maxint*5).ToString()); ques.Insert(maxsl.ToString(), 1, "High"); ques.Insert(maxsl.ToString(), 2, "Medium"); ques.Insert(maxsl.ToString(), 3, "Low"); TextBox1.Visible = false; Button2.Visible = false; CheckBox1.Checked = false; Load_all_sym();

116

} private int getcnt(string str) { string[] tmp, tmp2; int i = 0; tmp = str.Split(','); tmp2 = TextBox1.Text.Split(' '); foreach (string s1 in tmp) { foreach (string s2 in tmp2) { if ((s1.Trim() == s2.Trim()) && (s1.Trim() != "")) { i++; goto next; } } next: ; } return i; } }

117

Chapter 6 Limitation & Conclusion

6.1

Introduction

Expert diagnosis system on myocardial infarction can be very useful for the doctors. This chapter discusses recent attempts to codify knowledge through the development of expert systems on myocardial infraction. This chapter argues that in the context of expert systems there is some knowledge that can be codified. Some for which this is partly possible, and some for which it is basically impossible given the state of today's technology. We also discuss in this chapter about the achievements i.e. what the thing we have acquired from this project and the type of problems we face in this project.

6.2 Achievements We work hard to implement An Online Expert Diagnosis System. While doing this project we achieved lots of things. It was a group project. So we learnt how to work in a group. We also learnt different software technologies like Asp.net, SQL server database, expert system, Inference engine, heart disease, knowledge base etc. We also meet different doctors and took their interview. It was completely a different type of experience for us.

118

6.3 Limitations of the Systems Even though we have tried our best to fix as many issues as possible within the Expert Diagnosis System it still has some limitations as given below: Has not sufficient knowledge about heart disease. So this system may not provide 100% accurate diagnosis. The reason behind this we had some meetings with the concerned doctors to capture knowledge from him, we believe more meetings we should have with him to gather more knowledge with a view to enrich the knowledge base of the system.

6.4 Possible Future Enhancements As this system is not actually fully implemented so the actual implementation can be done in future. Few extra features can be added with this Expert System like: After gathering huge amount of data, Data mining technique can be applied for better prediction. More disease information can be added for more diagnosis. More analysis can be done to improve performance.

6.5 Conclusion So far, we have succeeded to design and implement the system using ASP C# on .NET environment. After implementation we have shown the system to concerned doctor. He has shown positive impression and confirmed that this system will be a helpful tool in diagnosing relevant diseases. This system will be an excellent idea for this country. The use of such a system will save time for

119

both the doctor and patients. However, it takes much effort to implementing this system initially but after that it will be a great beneficial for this country. Moreover this system can manage the patient relevant information and history of heart disease.

120

6.6 References

1. [Hobler, K. (Spring 1998). "Acute and Suppurative Appendicitis: Disease

Duration and its Implications for Quality Improvement" ([dead link]


search

Scholar

). Permanente Medical Journal

2. http://xnet.kp.org/permanentejournal/spring98pj/Spring98.pdf#page=7. 3. http://en.wikipedia.org/wiki/Appendicitis 4. http://en.wikibooks.org/wiki/Expert_Systems

5. http://en.wikipedia.org/wiki/Requirements_analysis

6. http://www.outsource2india.com/software/RequirementAnalysis.asp

7. http://www.softwareqatest.com/qatweb1.html

8. http://easydiagnosis.com/cgi-bin/expert/start.cgi?mod=Depression

9. http://www.ehow.com/about_5845467_expert-used-health-careadministration.html

10.http://www.it.bton.ac.uk/staff/lp22/CS237/CS237MedicalXSys.html

11.http://matrixcognition.com/ORIGIN02.HTM

121

12.http://www.ncbi.nlm.nih.gov/pmc/articles/PMC1307157/

13.http://www.computer.org/portal/web/csdl/doi/10.1109/MS.2005.155

14.http://freemind.sourceforge.net/wiki/index.php/Main_Page

15.http://www.opensourcescripts.com/dir/ASP/

122

You might also like