Nothing Special   »   [go: up one dir, main page]

ECG Report Generator Portable

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 32

An ECG Database and Report

Generator - A Graphic Interface

OSEI KUFFUOR
MS Thesis Defense
Advisor: Dr Patrick O Bobbie
In this Issue:
 Fundamental Concept of ECG
 ECG Theory
 The Heart
 Overview of ECG Report Generator
 Design and Implementation
 ECG Database
 The Application
 ECG Report Analyzer
 Generate FinalReport
 Automatic Email Sender
 Conclusion
 References
Introduction
 Cardiovascular disease (CVD),
principally heart disease and stroke.
 Nation’s leading killer for both men
and women
 This disease kills all racial and ethnic
groups
 About 1 million American die of CVD
each year
Introduction cont’
According to American Heart
Association, one person dies every
30 seconds which is over 2,600
deaths in every single day.
Victims between 35-64 years of age
About 62 million Americans have
some form of cardiovascular
disease
ECG Measurement
 Signals from two leads are
connected between two point of the
body
 Electrical voltage observed between
the electrodes is given by the dot
product of the two vectors
 Modern standard ECG – uses more
electrode connection points
Heart Rate

In normal sinus rhythm, a resting


heart rate of below 60 bpm is
called bradycardia and a rate of
above 90 bpm is called tachycardia
In this diagnosis, I calibrated
Normal Heart Rate = 100 and more
than that results in some form of
Cardiovascular heart disease
Signal from ECG

Convert Signal into actual data

Signal stored at Workstation


VB.Net
App SQL
Server
Database

Overview ECG Report Analyzer


of ECG
Report
Generate Final Report
Generator
Send Email To Doctor
The Application(VB.Net)
Major Functions in the Application

CreateDatabase()
Create Table()
CreateProcedure()
CreateView()
PopulateTable()
DisplayData()
CreateDatabase()
 Using SQL statements you can create database objects programmatically
 Private Sub bntCreateDatabase_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
bntCreateDatabase.Click
If bntCreateTable.Enabled Then
Dim dr As DialogResult = MessageBox.Show
If dr = DialogResult.Yes Then
ResetUI()
CreateTable()
End If
Else
CreateTable()
End If
End Sub
 This function creates a database in the form of a table.
Function CreateTable ( )

The CREATE TABLE statement


defines a table. The definition
must include its name and all the
attributes of its columns. The
definition can include other
attributes of the table, such as its
primary key or check constraints.
CreateTable Cont’
 Private Sub bntCreateTable_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles bntCreateTable.Click
Dim strSQL As String = _
"USE Ecg" & vbCrLf & _
"IF EXISTS (" & _
"SELECT * " & _
"FROM Ecg.dbo.sysobjects " & _
"WHERE Name = 'NW_Diagnostic' " & _
"AND TYPE = 'u')" & vbCrLf & _
"BEGIN" & vbCrLf & _
"DROP TABLE Ecg.dbo.NW_Diagnostic" & vbCrLf & _
"END" & vbCrLf & _
"CREATE TABLE NW_Diagnostic (" & _
"DiagnosisID Int NOT NULL," & _
"Temperature NVarChar(10) NOT NULL," & _
"Humi NVarChar(10) NOT NULL," & _
"SignalVoltage NVarChar(10) NOT NULL," & _
"Enviro NVarChar (10) NOT NULL, " & _
"BatteryVoltage NVarChar (10) NOT NULL, " & _
"Name NVarChar(10) NOT NULL, " & _
"CONSTRAINT [PK_DiagnosisID] PRIMARY KEY CLUSTERED" & _
"(DiagnosisID))"
CreateProcedure( )
 Stored procedures are important aspect
in all database programs
 VB.NET applications are no exceptions to
this rule.
 Stored procedures enable users change
the business logic without actually
tinkering with the application.
CreateProcedure() cont’
 First ,you have to DROP Procedure if it exists
Dim strSQL As String = _
"USE Ecg" & vbCrLf & _
"IF EXISTS (" & _
"SELECT * " & _
"FROM Ecg.dbo.sysobjects " & _
"WHERE Name = 'AddDiagnostic' " & _
"AND TYPE = 'p')" & vbCrLf & _
"BEGIN" & vbCrLf & _
"DROP PROCEDURE AddDiagnostic" & vbCrLf
&_
"END"
CreateProcedure( ) cont’
 Once the Procedure is DROPPED, then re-create Procedure
 cmd.CommandText = _
"CREATE PROCEDURE AddDiagnostic AS" & vbCrLf
&_
"INSERT INTO NW_Diagnostic" & vbCrLf & _
"(DiagnosisID,Temperature,Humi,SignalVoltage,Enviro,Ba
tteryVoltage,Name) “
"SELECT
DiagnosisID,Temperature,Humi,SignalVoltage,Enviro,B
atteryVoltage,Name " & "FROM
Northwind.dbo.Diagnosis "
cmd.ExecuteNonQuery()
northwindConnection.Close()
bntCreateView.Enabled = True
Function CreateView ()

 A view is a structured list of items from the


entities or semantic objects defined in the data
model
 A view instance is a view that is populated with
data for one entity or semantic object
 To create a view instance, the application must
first obtain the new data values and relationships
 This is most likely done via a data entry form, but
applications also receive data from other
program and in other ways
Function CreateView () cont’

 DROP View if it exists

 Private Sub bntCreateView_Click(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles bntCreateView.Click
Dim northwindConnection As New SqlConnection(connectionString)
Dim strSQL As String = _
"USE Ecg" & vbCrLf & _
"IF EXISTS (" & _
"SELECT * " & _
"FROM Ecg.dbo.sysobjects " & _
"WHERE Name = 'GetDiagnostic' " & _
"AND TYPE = 'v')" & vbCrLf & _
"BEGIN" & vbCrLf & _
"DROP VIEW GetDiagnostic" & vbCrLf & _
"END"
CreateView cont’
 Re-create View
Try
cmd.CommandText = _
"CREATE VIEW GetDiagnostic AS " & _
"SELECT * " & _
"FROM NW_Diagnostic"
cmd.ExecuteNonQuery()
northwindConnection.Close()
bntPopulateTable.Enabled = True
PopulateData()
 The PopulateData statement inserts rows into a
table, nickname, or view, or the underlying tables
 Inserting a row into a nickname inserts the row
into the data source object to which the nickname
refers. Inserting a row into a view also inserts the
row into the table on which the view is based, if
no INSTEAD OF TRIGGER is defined for the
insert operation on this view.
PopulateData cont’
 Private Sub bntPopulateTable_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
bntPopulateTable.Click
Dim strSQL As String = "EXECUTE Ecg.dbo.AddDiagnostic"
Try
Dim cmd As New SqlCommand(strSQL,
northwindConnection)
northwindConnection.Open()
cmd.ExecuteNonQuery()
northwindConnection.Close()
bntDisplayData.Enabled = True
End Try
End Sub
Function Display Data ()

 The function DisplayData is the end result


of the above functions. Users want to see
data being display as well as programmers.
This function will display all data
depending on which format is being used.
In this application, the bntDisplayData will
display data in the DataGrid.
DisplayData() cont’
 Private Sub bntDisplayData_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles bntDisplayData.Click
If IsNothing(dgDiagnosis.DataSource) Then
Dim strSQL As String = _
"USE Ecg" & vbCrLf & _
"SELECT * " & _
"FROM GetDiagnostic"
Try
Dim northwindConnection As New SqlConnection(connectionString)
Dim cmd As New SqlCommand(strSQL, northwindConnection)
Dim da As New SqlDataAdapter(cmd)
Dim dsDiagnostic As New DataSet
da.Fill(dsDiagnostic, "Diagnostic")
End Try
End If
End Sub
ECG Is heart Is
Is systolic N N Normal

ECG
wave rate No diastoli
form >130? o o Sinus
>100 c >80?

y
e
s
Report

Y
e
s
.High blood Pressure

Y
e
s
.Valvular heart disease
Cardiovascular
.rheumatic fever Coronary
disease

Analyzer
.rheumatic heart disease artery
.Coronary artery disease disease
.

Is smoke,obeese Is sex female N Heart Attack


Or >40? o warning sign
High blood
cholesterol level

Y
e
s
Discomfort in
the back,neck
RISK FACTORS jaw or

y
e
s
Sex hormones stomach
Birth Control pill candidate
Cardiovas Heavy Alcoholic
cular

Y
e
s
disease
Y .Heart
Is age >65? e blood
s Pressure
Is chest discomfort .Coronary
N
or disease
o
High Blood Difficult breathing?
Pressure
Vavular heart
disease
Rheumatic fever
Reheumatic heart
disease N N
o END o
ECG Diagnostic Analyzer
 Diagnostic Analyzer uses algorithm to diagnose the patient’s condition. For example:

SignalVoltage as string, Temperature as Integer, HeartRate as Integer,


Systolic as Integer, Diastolic as Integer, Smoke as Boolean;

if ( heartRate > 100) then


disease =”Highblood pressure”
else if
(systolic >130)
disease= “Cardiovascular”
else if
(diastolic > 80)
disease = “Coronary artery disease”
else
disease = “Normal sinus”
End if
End
Generate FinalReport
 Final reports is comprehensive for
the following reasons:
 Reliability
 Correctness
 Help doctors to know the big picture:
• Best-Case Performance
• Average-Case Performance
• Worst-Case Performance
Generate FinalReport cont’

 The final report is mostly queries generated


during the diagnosis phase. Example of the
final report’s retrieval using Subquery:

 SELECT Diagnosis.Name
FROM Diagnosis
WHERE Diagnosis.DiagnosisID IN
(SELECT History.Heredity
FROM History.Medication IN
(SELECT * FROM DiseaseOne));
Function EmailSender()
 According to definition by [2], SMTP
(Simple Mail Transfer Protocol): The
standard e-mail protocol on the Internet
and part of the TCP/IP protocol suite
 SMTP defines the message format and the
message transfer agent (MTA), which
stores and forward the mail
 SMTP was originally designed for only
plain text (ASCII text), but MIME and other
encoding methods enable executable
programs and multimedia files to be
attached to and transported with the email
message.
SendEmail() -Format
 Date: 9 Aug 2006 04:10:34
From: spsu@spsu.edu
To: doctor@ga.org
Subject: James Doe Heart-Diagnostic Report
Message: Name- James Doe
Date of Birth: 10/10/2000
SSN: xxx-xxx-2437 (format for security purpose)
Heart Rate > 100
Systolic > 130
Gender: Female and smokes
Medication: Ampicillian 500mg
Possible Diagnosis Results: Cardiovascular heart disease
Medication Center: 1234 Great Street, Marietta GA, 30060(phone) 770-456-1234
Heredity:
Father was a cardiovascular candidate
Mother never had any kind of heart disease
End of message
Conclusion and Future Considerations

 I have learnt a lot from this project and this will help
me to go deep into database programming. After
finishing this project, I highly recommend that the
code for streaming signal voltage from the ECG to
the database should have the same platform as the
ECG Database and Report Generator. This will help
to automate the streaming of data with alongside
with the Database Report Generator.
 The future continuation development of this project
should include internet base programming and a
function that can be connected to a phone device in
other to send phone message to the doctor.
References
 [1] Craig S. Mullins, “Database Administration”; The Complete Guide to
Practice and procedures, 2002
 [2] David Gefen & Chitibabu Govindarajulu, “Advanced Visual Basic.Net”,
2004
 [3] Gary J. Bronson & David Rosenthal, “Introduction to Programming
with Visual Basic.Net”, 2005
 [4] Keith Franklin, “VB.Net Developers”, 2002

[5] Daniel Marr, “ECG Application Featuring Data Transmission by


Bluetooth”, PhD Thesis, University of Queensland, Australia, Oct 2002
 [6] William Brims, “Wireless ECG Volume I”, Master Thesis, University
of Queensland, Australia, Oct 2002
 [7] National Center for Health Statistic and National Center for Chronic
Disease Prevention and Health Promotion, Centers for Disease Control
and prevention, 1995.

[8] http://www.healingwithnutrition.com/cdisease/cardiovascular/cardiovascular.html
THE
END
Questions?

You might also like