Sistem Pakar Mendiagnosa Gangguan Kelenjar Tiroid Menggunakan Metode Forward Chaining dan Dempster Shafer Berbasis Android

Download (0)

Teks penuh

(1)

Listing Program

Menu Utama program

#Region Project Attributes

#ApplicationLabel: Gangguan Tiroid #VersionCode: 1

#VersionName:

'SupportedOrientations possible values: unspecified, landscape or portrait.

#SupportedOrientations: portrait #CanInstallToExternalStorage: False #End Region

#Region Activity Attributes #FullScreen: True

#IncludeTitle: False #End Region

Sub Process_Globals

'These global variables will be declared once when the application starts.

'These variables can be accessed from all modules. End Sub

Sub Globals

'These global variables will be redeclared each time the activity is created.

'These variables can only be accessed from this module. Dim Latar As BitmapDrawable

Dim imgDiagnosa, imgTips, imgInfo, imgTentang, imgLogo As ImageView

End Sub

Sub Activity_Create(FirstTime As Boolean)

'Do not forget to load the layout file created with the visual designer. For example:

'Activity.LoadLayout("Layout1") 'Inisialiasi Background

If File.Exists(File.DirAssets,"Latar.png") Then

Latar.Initialize(LoadBitmap(File.DirAssets,"Latar.png")) Activity.Background = Latar

Else

Msgbox("File Tidak Ada", "Peringatan") End If

'Inisialiasi Menu

If File.Exists(File.DirAssets,"Diagnosa.png")= True Then imgDiagnosa.Initialize("imgDiagnosa")

imgDiagnosa.Bitmap = LoadBitmap(File.DirAssets, "Diagnosa.png")

imgDiagnosa.Gravity = Gravity.FILL

(2)

Msgbox("File Not Found", "Warning") End If

If File.Exists(File.DirAssets,"Info.png")= True Then imgInfo.Initialize("imgInfo")

imgInfo.Bitmap = LoadBitmap(File.DirAssets, "Info.png") imgInfo.Gravity = Gravity.FILL

Activity.AddView(imgInfo, 37%x, 60%y, 26%x, 26%x) Else

Msgbox("File Not Found", "Warning") End If

If File.Exists(File.DirAssets,"Tips.png")= True Then imgTips.Initialize("imgTips")

imgTips.Bitmap = LoadBitmap(File.DirAssets, "Tips.png") imgTips.Gravity = Gravity.FILL

Activity.AddView(imgTips, 68.5%x, 60%y, 26%x, 26%x) Else

Msgbox("File Not Found", "Warning") End If

If File.Exists(File.DirAssets,"Tentang.png")= True Then imgTentang.Initialize("imgTentang")

imgTentang.Bitmap = LoadBitmap(File.DirAssets, "Tentang.png")

imgTentang.Gravity = Gravity.FILL

Activity.AddView(imgTentang, 15%x, 78%y, 70%x, 25%x) Else

Msgbox("File Not Found", "Warning") End If

End Sub

Menu Diagnosa

#Region Activity Attributes #FullScreen: True

#IncludeTitle: False #End Region

Sub Process_Globals

'These global variables will be declared once when the application starts.

'These variables can be accessed from all modules. End Sub

Sub Globals

'These global variables will be redeclared each time the activity is created.

'These variables can only be accessed from this module. Dim TotalGejala As Int = 30

Dim Latar As BitmapDrawable Dim Posisi As Int

Dim G(TotalGejala) As Gejala Dim Bobot(TotalGejala) As Double Dim Jawaban(TotalGejala) As Int

(3)

Dim lblPertanyaan, lblHiper, lblHipo, lblKesimpulan As Label Dim txtBelHiper, txtPlaHiper As EditText

Dim txtBelHipo, txtPlaHipo As EditText End Sub

Sub Inisialisasi() Posisi = 0

G(0).Initialize("G01", "mudah lelah dan lesu", 0.2)

G(1).Initialize("G02", "otot keram dan lemah, khususnya kerja otot lengan dan kaki", 0.2)

G(2).Initialize("G03", "hiperkinesis seperti gelisah, cemas, lekas marah, emosional dan kebingungan", 0.4)

G(3).Initialize("G04", "rambut dan kuku mudah rontok/rapuh", 0.3)

G(4).Initialize("G05", "bengkak di leher atau kelenjar gondok membesar", 0.4)

' Hiper Tiroid

G(5).Initialize("G06", "nafsu makan meningkat", 0.2)

G(6).Initialize("G07", "sensitif terhadap panas(Palpitasi)", 0.2)

G(7).Initialize("G08", "jantung berdebar kencang dan cepat(Takikardia)", 0.3)

G(8).Initialize("G09", "banyak berkeringat / keringat berlebihan", 0.4)

G(9).Initialize("G10", "biasanya tangan bergetar terus(Tremor)", 0.4)

G(10).Initialize("G11", "frekuensi buang air besar yang sering(Diare)", 0.2)

G(11).Initialize("G12", "mata tampak melotot atau

menonjol(Exophthalmos)disertai penglihatan ganda dan kelopak mata tertarik", 0.6)

G(12).Initialize("G13", "mata membengkak, memerah dan sensitif terhadap cahaya", 0.5)

G(13).Initialize("G14", "gemetar, gugup dan gelisah", 0.3) G(14).Initialize("G15", "kulit lembab dan hangat", 0.2) G(15).Initialize("G16", "berat badan menurun", 0.2) ' Hipo Tiroid

G(16).Initialize("G17", "nafsu makan berkurang", 0.2)

G(17).Initialize("G18", "denyut nadi dan jantung melambat", 0.3)

G(18).Initialize("G19", "suhu tubuh rendah", 0.2) G(19).Initialize("G20", "kulit kasar dan kering", 0.2)

G(20).Initialize("G21", "sensitif terhadap udara dingin", 0.2) G(21).Initialize("G22", "kurang konsentrasi dan daya ingat lemah(Demensia)", 0.1)

G(22).Initialize("G23", "tekanan darah menurun", 0.2)

G(23).Initialize("G24", "mengalami gangguan cerna sembelit atau konstipasi", 0.2)

G(24).Initialize("G25", "wajah sembab dan bengkak", 0.5) G(25).Initialize("G26", "sendi nyeri dan kaku", 0.2) G(26).Initialize("G27", "berat badan meningkat", 0.2) G(27).Initialize("G28", "kelopak mata, tangan dan kaki membengkak", 0.6)

G(28).Initialize("G29", "penurunan kemampuan berbicara(seperti suara pelan dan parau, kadang cara bicara yang gagap)", 0.4)

(4)

Sub Dempster_Shafer()

Dim mB1, mP1, mB2, mP2 As Double Dim Hiper, Hipo As Double

Dim Pecahan As Int = 10 ' Hipertiroid

mB1 = Bobot(0) 'G(0).Bel mP1 = 1 - mB1 'G(0).Pla

txtBelHiper.Text = "B : " & Round2(mB1,Pecahan) txtPlaHiper.Text = "P : " & Round2(mP1,Pecahan) Hiper = Round2(mB1,Pecahan)

' Hipotiroid mB1 = Bobot(0) mP1 = 1 - Bobot(0)

txtBelHipo.Text = "B : " & Round2(mB1, Pecahan) txtPlaHipo.Text = "P : " & Round2(mP1, Pecahan) Hipo = Round2(mB1,Pecahan)

If Hiper = 0 OR Hipo = 0 Then

lblKesimpulan.Text = lblKesimpulan.Text & "Tidak Menderita"

Else If Hiper > Hipo Then

lblKesimpulan.Text = lblKesimpulan.Text & "Kemungkinan menderita Hipertiroid"

Else

lblKesimpulan.Text = lblKesimpulan.Text & "kemungkinan menderita Hipotiroid"

End If End Sub

Sub TampilkanJawaban()

If Jawaban(Posisi) = 1 Then rdbYa.Checked = True Else

rdbTidak.Checked = True End If

End Sub

Sub SimpanJawaban()

If rdbYa.Checked = True Then Jawaban(Posisi) = 1

Bobot(Posisi) = G(Posisi).Bel Else

Jawaban(Posisi) = 0 Bobot(Posisi) = 0 End If

End Sub

Sub Pertanyaan()

lblPertanyaan.Text = "Pertanyaan Ke " & (Posisi + 1) & CRLF & CRLF & " Apakah " & G(Posisi).Keterangan & "?"

End Sub Sub Maju()

(5)

Posisi = Posisi + 1

If Posisi < TotalGejala Then Pertanyaan

TampilkanJawaban End If

If Posisi = TotalGejala Then btnMaju.Visible = False btnMundur.Visible = False rdbYa.Visible = False rdbTidak.Visible = False btnDiagnosa.Visible = True

lblPertanyaan.Text = "Silahkan tekan tombol Diagnosa untuk melihat hasil!"

End If End Sub Sub Mundur()

SimpanJawaban If Posisi > 0 Then

Posisi = Posisi - 1 Pertanyaan

End If

TampilkanJawaban End Sub

Sub Activity_Create(FirstTime As Boolean)

'Do not forget to load the layout file created with the visual designer. For example:

'Activity.LoadLayout("Layout1") Inisialisasi

'Inisialiasi Background

If File.Exists(File.DirAssets,"Latar2.png") Then

Latar.Initialize(LoadBitmap(File.DirAssets,"Latar2.png")) Activity.Background = Latar

Else

Msgbox("File Tidak Ada", "Peringatan") End If

'Label Hiper

lblHiper.Initialize("")

lblHiper.Text = "Hiper Tiroid"

lblHiper.TextSize = 5%x 'GetDeviceLayoutValues.Width / 25 lblHiper.TextColor = Colors.Black

lblHiper.Visible = False

Activity.AddView(lblHiper, 15%x, 25%y, 70%x, 5%y) 'Label Hipo

lblHipo.Initialize("")

lblHipo.Text = "Hipo Tiroid"

lblHipo.TextSize = 5%x 'GetDeviceLayoutValues.Width / 25 lblHipo.TextColor = Colors.Black

lblHipo.Visible = False

Activity.AddView(lblHipo, 15%x, 45%y, 70%x, 5%y) 'Label Kesimpulan

lblKesimpulan.Initialize("")

(6)

lblKesimpulan.TextSize = 5%x 'GetDeviceLayoutValues.Width / 25 lblKesimpulan.TextColor = Colors.Black

lblKesimpulan.Visible = False

Activity.AddView(lblKesimpulan, 15%x, 72%y, 70%x, 5%y) 'Pertanyaan 1

lblPertanyaan.Initialize("")

lblPertanyaan.TextSize = 6%x 'GetDeviceLayoutValues.Width / 25 lblPertanyaan.TextColor = Colors.Black

lblPertanyaan.Gravity = Gravity.CENTER_HORIZONTAL Pertanyaan

Activity.AddView(lblPertanyaan, 15%x, 10%y, 70%x, 50%y) rdbYa.Initialize("")

rdbYa.TextSize = 6%x 'GetDeviceLayoutValues.Width / 25 rdbYa.TextColor = Colors.Black

rdbYa.Text = "Ya" rdbYa.Checked = True

Activity.AddView(rdbYa, 15%x, 55%y, 30%x, 10%y) rdbTidak.Initialize("")

rdbTidak.TextSize = 6%x 'GetDeviceLayoutValues.Width / 25 rdbTidak.TextColor = Colors.Black

rdbTidak.Text = "Tidak"

Activity.AddView(rdbTidak, 15%x, 65%y, 30%x, 10%y)

' Hasil Dempster Shafer txtBelHiper.Initialize("") txtBelHiper.Visible = False

txtBelHiper.TextSize = 5%x 'GetDeviceLayoutValues.Width / 30 txtBelHiper.TextColor = Colors.Black

Activity.AddView(txtBelHiper, 15%x, 30%y, 70%x, 8%y) txtBelHipo.Initialize("")

txtBelHipo.Visible = False

txtBelHipo.TextSize = 5%x 'GetDeviceLayoutValues.Width / 30 txtBelHipo.TextColor = Colors.Black

Activity.AddView(txtBelHipo, 15%x, 50%y, 70%x, 8%y) ' Tombol Maju & Mundur

btnMundur.Initialize("btnMundur") btnMundur.Text = "Mundur"

Activity.AddView(btnMundur, 10%x, 85%y, 35%x, 10%y) btnMaju.Initialize("btnMaju")

btnMaju.Text = "Maju"

Activity.AddView(btnMaju, 55%x, 85%y, 35%x, 10%y) ' Tombol Diagnosa

btnDiagnosa.Initialize("btnDiagnosa") btnDiagnosa.Text = "Diagnosa"

Activity.AddView(btnDiagnosa, 10%x, 85%y, 80%x, 10%y) btnDiagnosa.Visible = False

Figur

Memperbarui...

Referensi

Pindai kode QR dengan aplikasi 1PDF
untuk diunduh sekarang

Instal aplikasi 1PDF di