0% found this document useful (1 vote)
3K views

Expert System

The document describes designing an expert system to prescribe medicine given symptoms using UML diagrams and generating code in Visual Basic. The system is divided into modules for patients, clerks, the expert system, finding diseases, and prescribing medicines. It includes use case, class, and collaboration diagrams. The coding uses forms and modules to store disease and medicine data in a database, retrieve symptoms from patients, diagnose diseases, update records, and prescribe appropriate medicines. In conclusion, the expert system was developed successfully using the outlined design and code.

Uploaded by

Kevin Shaun
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
3K views

Expert System

The document describes designing an expert system to prescribe medicine given symptoms using UML diagrams and generating code in Visual Basic. The system is divided into modules for patients, clerks, the expert system, finding diseases, and prescribing medicines. It includes use case, class, and collaboration diagrams. The coding uses forms and modules to store disease and medicine data in a database, retrieve symptoms from patients, diagnose diseases, update records, and prescribe appropriate medicines. In conclusion, the expert system was developed successfully using the outlined design and code.

Uploaded by

Kevin Shaun
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 13

EX NO: DATE : AIM:

EXPERT SYSTEM TO PRESCRIBE MEDICINE FOR GIVEN SYMPTOMS

To design a model for an expert system to prescribe medicine given the symptoms using UML AND generate code using visual basic. SYSTEM REQUIREMENTS: a)Hardware A server to store all the data and for prescribing diseases. A client machine to interact with user. A printer to print bills. b)software A database server like oracle,MS-SQL server,MYSQL etc. A front end software like visual basic, developer 2000 etc. A networking operating system like LINUX, WINDOWS 2000 server etc. MODULES: The system is divided into the following module. 1. patient 2. clerk 3. expert system 4. finds disease 5. prescribe medicines

USE CASE DIAGRAM:

CLASS DIAGRAM:

COLLOBORATION DIAGRAM:
1 1 iv s sym to s : .g e p m 77 a b : .p y ill p tie t:p a n a tie t n cle rk:cle rk

6 6 rin re o : .p t p rt

3 3 d sym to s : .fin s p m

2 2 e s d ta : .fe d e ils

fin s d sym to s p m

o tp t u u scre n e :scre n e 44 o d a : .sh w ise se 5 5 o md e : .sh w e icin

SEQUENCE DIAGRAM
clerk:clerk finds symptoms output screen:screen

patient:patient

1.gives symptoms 2.feeds details

3.finds symptoms

4.show disease

5.show medicine

6.print report

7.pay bill

CODINGS: Expert System: Form7:

Private Sub Command1_Click() If Text1 = "user" And Text2 = "123" Then Form1.Show ElseIf Text1 = "doctor" And Text2 = "rgg" Then Form2.Show End If End Sub Private Sub Command2_Click() End End Sub Form1

Private Sub Command2_Click() Form7.Show Me.Hide End Sub Private Sub Command3_Click() Dim vc As Control For Each vc In Me.Controls If TypeOf vc Is TextBox Then vc.Text = "" ElseIf TypeOf vc Is ComboBox Then vc.Text = "--Select--" End If Next End Sub Private Sub Form_Load() vcon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\home\My Documents\db3.mdb;Persist Security Info=False" vcon.Open Dim m As String Dim vrs As New ADODB.Recordset m = "select sym1 from disease" vrs.Open m, vcon, 1, 3, 1 If vrs.EOF = False Then Do While vrs.EOF = False Combo1.AddItem vrs(0) vrs.MoveNext Loop End If vrs.Close m = "select sym2 from disease" vrs.Open m, vcon, 1, 3, 1 If vrs.EOF = False Then Do While vrs.EOF = False Combo2.AddItem vrs(0) vrs.MoveNext Loop End If End Sub Form2:

Private Sub Form_Load() Me.WindowState = 2 End Sub Private Sub mnueddis_Click() Form5.Show End Sub Private Sub mnuedmed_Click() Form6.Show End Sub Private Sub mnuexit_Click() Form7.Show Me.Hide End Sub Private Sub mnumedicine_Click() Form4.Show End Sub Private Sub mnusym_Click() Form3.Show End Sub Form3:

Dim vcon As New ADODB.Connection Private Sub Command1_Click() vcon.Execute "insert into disease values ('" & Text1 & " ','" & Text2 & " ','" & Text3 & "')" MsgBox "The Disease Table is inserted successfully" End Sub Private Sub Command2_Click() Dim vc As Control For Each vc In Me.Controls If TypeOf vc Is TextBox Then vc.Text = "" ElseIf TypeOf vc Is ComboBox Then vc.Text = "--Select--" End If Next End Sub Private Sub Command3_Click() Form2.Show Me.Hide End Sub Private Sub Form_Load() Me.WindowState = 1 vcon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\home\My Documents\db3.mdb;Persist Security Info=False" vcon.Open End Sub Form4:

Dim vcon As New ADODB.Connection Private Sub Command1_Click() vcon.Execute "insert into medi values ('" & Text1 & " ','" & Text2 & " ')" MsgBox "The Medicine Table is inserted successfully" End Sub Private Sub Command2_Click() Dim vc As Control For Each vc In Me.Controls If TypeOf vc Is TextBox Then vc.Text = "" ElseIf TypeOf vc Is ComboBox Then vc.Text = "--Select--" End If Next End Sub Private Sub Command3_Click() Form2.Show Me.Hide End Sub Form5: Dim vcon As New ADODB.Connection Public s, t As String Private Sub Command1_Click() vcon.Execute "update disease set dis= '" & Text2 & "' where sym1='" & s & "' and sym2='" & t & " ' " MsgBox "It is Updated Successfully" End Sub

Private Sub Command2_Click() Dim vc As Control For Each vc In Me.Controls If TypeOf vc Is TextBox Then vc.Text = "" ElseIf TypeOf vc Is ComboBox Then vc.Text = "--Select--" End If Next End Sub Private Sub Command3_Click() Form2.Show Me.Hide End Sub Private Sub Command4_Click() Dim m As String s = Combo1.Text t = Combo2.Text m = "select dis from disease where sym1= '" & Combo1 & " ' and sym2='" & Combo2 & " '" Dim vrs As New ADODB.Recordset vrs.Open m, vcon, 1, 3, 1 If vrs.EOF = False Then Text1.Text = vrs(0) Else vrs.Close s = Combo2.Text t = Combo1.Text

m = "select dis from disease where sym1= '" & Combo2 & " ' and sym2='" & Combo1 & " '" vrs.Open m, vcon, 1, 3, 1 If vrs.EOF = False Then Text1.Text = vrs(0) vrs.Close Else MsgBox "sorry there is no combination this software supports" vrs.Close GoTo l End If End If vrs.Close l: End Sub Private Sub Form_Load() vcon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\home\My Documents\db3.mdb;Persist Security Info=False" vcon.Open Dim m As String Dim vrs As New ADODB.Recordset m = "select sym1 from disease" vrs.Open m, vcon, 1, 3, 1 If vrs.EOF = False Then Do While vrs.EOF = False Combo1.AddItem vrs(0) vrs.MoveNext Loop End If vrs.Close m = "select sym2 from disease" vrs.Open m, vcon, 1, 3, 1 If vrs.EOF = False Then Do While vrs.EOF = False Combo2.AddItem vrs(0) vrs.MoveNext Loop End If End Sub FORM6:

Dim vcon As New ADODB.Connection Private Sub Command1_Click() Dim m As String Dim vrs As New ADODB.Recordset m = "select medicine from medi where disease= '" & Combo1 & "'" vrs.Open m, vcon, 1, 3, 1 If vrs.EOF = False Then Text1.Text = vrs(0) End If End Sub Private Sub Command2_Click() vcon.Execute "update medi set medicine= '" & Text2 & "' where disease='" & Combo1 & "' " MsgBox "It is Updated Successfully" End Sub Private Sub Command3_Click() Dim vc As Control For Each vc In Me.Controls If TypeOf vc Is TextBox Then vc.Text = "" ElseIf TypeOf vc Is ComboBox Then vc.Text = "--Select--" End If Next End Sub Private Sub Command4_Click() Form2.Show Me.Hide End Sub

Private Sub Form_Load() vcon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\home\My Documents\db3.mdb;Persist Security Info=False" vcon.Open Dim m As String Dim vrs As New ADODB.Recordset m = "select disease from medi" vrs.Open m, vcon, 1, 3, 1 If vrs.EOF = False Then Do While vrs.EOF = False Combo1.AddItem vrs(0) vrs.MoveNext Loop End If End Sub DataBase : Table Name disease medi

FieldName sym1,sym2,dis disease,medicine

CONCLUSION: Thus the expert system has been completed and output was verified and executed successfully.

You might also like