Solved

sample code for determining the blood pressure (hypertension, prehypertension, normal) on the basis of input given 120/83 or 118/82 etc

Posted on 2011-02-24
23
1,091 Views
Last Modified: 2012-05-11
I need a sample program either in c#, php, vb or c++
Which will ask for blood pressure from user and the system will tell the if it is hypertension, prehypertension, low blood pressure or normal

normal range is 120/80
119/80 , 120/83 etc are close to normal range
My program should be able to determine that the given range is in normal, high or low

solution must follow fuzzy logic..........
0
Comment
Question by:mohanupadhyay
  • 8
  • 5
  • 4
  • +3
23 Comments
 
LVL 21

Accepted Solution

by:
developmentguru earned 168 total points
Comment Utility
As I understand such things you would need more than just the systolic and diastolic numbers that would need to be considered.  Many doctors try to adjust different numbers (good weight, good heart rate, etc based on age).  I don't particularly agree with this practice but you are the one who wants the code, so I would need to know how you feel about that.

I did a simple Google search for "blood pressure numbers explained" and even the first 3 results differed...
http://www.infoplease.com/ipa/A0905008.html
http://www.new-fitness.com/Blood_Pressure/numbers.html
http://www.betterhealth.vic.gov.au/bhcv2/bhcarticles.nsf/pages/Blood_pressure_explained?open

I would be most likely to set this up as a web service myself (if you can count on a connection to the service's host)... this would allow me to be able to base the numbers on a text file for data.  If you decide the numbers should be changed then you can make the changes without changing any code that would be using the web service (C#, PHP, Java, Delphi, VB, or C++, etc).

The links also show you several ranges, not just 3.

I could see where the logic may need to include some "fuzziness" if you have more factors than a simple set of numbers... if you introduce age and resting heart rate for example then the fuzziness could be employed.  Fuzzy logic generally requires several parameters to operate on.  In the best case, so far, you have 2.

So... this leaves the ball squarely in your court.  What type of numbers do you want to include, what should their values be and how do you want to implement?

Let me know
0
 
LVL 27

Assisted Solution

by:aburr
aburr earned 166 total points
Comment Utility
Assuming the authorative definition given below you get
-
Blood Pressure
American Heart Association recommended blood pressure levels
Blood Pressure Category       Systolic
(mm Hg)              Diastolic
(mm Hg)
Normal      less than 120      and      less than 80
Prehypertension      120–139      or      80–89
High                     
Stage 1      140–159      or      90–99
Stage 2      160 or higher      or      100 or higher
 
 
Let s = systolic, d = diastolic, n = normal, p = prehyper, s1 = stage one,  and s2 = stage 2 .
If s < 120, then result1 = 1
If s >= 120 AND <= 139 then result1 =2
If s>= 140 AND <= 159 then result1 =3
If s >159, then result1=4
-
If d < 80, then result2 = 1
If d >= 80 AND <= 89 then result2 =2
If s>= 90 AND <= 99 then result 2= 3
If s >99, then result2=4
--
If result1 – result 2 = 0 then result = result1
If result1 –result2 <0 then result = result2
If result 1 – result2>:0 then result = result1
--
If result = 1   then pressure is n
If result = 2  then pressure is p
If result = 3  then pressure = s1
If result = 4 then pressure  = s2
0
 
LVL 3

Author Comment

by:mohanupadhyay
Comment Utility
Blood pressure also depends on age, gender so now we have 3 inputs, bloodpressure s/d, age and gender
I have to consider all 3 in my fuzzy logic
0
 
LVL 27

Expert Comment

by:aburr
Comment Utility
If you want to add age and gender you have to say just how you want them to affect your results.
0
 
LVL 21

Expert Comment

by:developmentguru
Comment Utility
Since you mentioned age I did another search, see what you think of the numbers in this link:

http://www.disabled-world.com/artman/publish/bloodpressurechart.shtml

It shows 10 ranges for blood pressure (4 high, 3 normal, and 3 low) divided into 10 age categories.  The categories don't go all that old, so you may need to extrapolate.
0
 
LVL 3

Author Comment

by:mohanupadhyay
Comment Utility
I am a user and I know only blood pressure, age and gender
Now can your program give me the result the blood pressure is high, low or normal

I need some fuzzy logic to identify this.
0
 
LVL 21

Expert Comment

by:developmentguru
Comment Utility
Can you show a link identifying the gender bias?  None I have seen indicate any difference for gender.
0
 
LVL 3

Author Comment

by:mohanupadhyay
Comment Utility
I have given you all the inputs. Now if you can give me the logic then good else leave this question you can not do this.
0
 
LVL 21

Expert Comment

by:developmentguru
Comment Utility
I'm sorry but that is one of the most ignorant statements I have seen on this site.  As a professional programmer it is not my job to tell anyone how to build their program.  They have to come up with what they want.  I am not a doctor, nor do I play one on TV.  I am a programmer.  I'm not sure if you realize this, but it is illegal to attempt to treat an illness if you are not a medical doctor (at least in the US).  I do not know what country you are from, or what the medical laws or beliefs are in your region.

Because of all of that, I need to know what, definitive, blood pressure ranges you want to use.  Some have been offered and you have not identified any that you would want to use.

You mention wanting to include a gender bias of some sort, again, without identifying what it should be.

Age range data has been provided to you and, once again, you have no comment.

If you don't know how you want this program to run then I would suggest you speak to a physician and get a professional opinion and stop expecting programmers to know how to do a doctor's job.
0
 
LVL 21

Expert Comment

by:developmentguru
Comment Utility
If you can decide what the numbers are that you want to use then I will see what I can come up with.
0
 
LVL 27

Expert Comment

by:aburr
Comment Utility
"I have given you all the inputs"
You have not even come close to giving all the required inputs if you want something other than s and d to determine where two number lie in an unspecified range
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 3

Author Comment

by:mohanupadhyay
Comment Utility
I have given you inputs given you outputs now the remaining thing is to build fuzzy logic.
normal range is 120/80 or you can see some standard on site
I f I know that then I should not put this question on this site.
0
 
LVL 22

Expert Comment

by:8080_Diver
Comment Utility
mohanupadhyay,

For someone who is requesting free assistance, you are demonstrating a somewhat less than friendly or cooperative attitude.

The basics of using the s/d figures with "fuzzy logic" is that you need to determine what the acceptable variance from the "Identified norm" is, for instance S +/- 5 and D +/- 5.  If this varies with the persons age, race, sex, sexual preference, or anything else, then you will need to define the acceptable variance for the amatrix defined by those options.  Once you have that defined, then providing the code is a fairly easy task.

So, please define your acceptable variances for the matrix of setting that are defined by the factors you want to consider.  At that time, I will gladly supply you with the psuedo-code for handling that.
0
 
LVL 3

Author Comment

by:mohanupadhyay
Comment Utility
Sorry friends for my attitude.

8080 Diver

Please proceed with the variance +/- 5 for both
Please do consider the age and gender factor also
age range if you find that then it is ok or you can divide it into LESS THAN 35 26-50, 50-75 and ABOVE 75
0
 
LVL 37

Expert Comment

by:TommySzalapski
Comment Utility
Sorry to but in so late in the conversation, but why fuzzy logic for this? It would seem that a strict classifier would be better here. Fuzzy logic is best suited for highly complex systems with many inputs and lots of data where a straight algorithm will not do and the power of the human brain's heuristics is needed. In my professional opinion, attempting to apply fuzzy logic to a system this simple will be inaccurate and ineffective and also take up way more time than needed.

Why not just use the cutoffs that the medical professionals use? You could adjust them up and down a bit for age etc. All the data you need is out there (most is here in this thread). Unless this is for some sort of academic assignment, then I can't see a good reason to use fuzzy logic for this.
0
 
LVL 3

Author Comment

by:mohanupadhyay
Comment Utility
Still I need a professional who can solve this.
Lets wait till the professional reads this.................
0
 
LVL 3

Author Comment

by:mohanupadhyay
Comment Utility
fuzzy logic is not everyone's cup of tea..................
not a problem even I doesn't know about it
So I would be grateful if anyone give me the e-tutorial where I can learn to apply fuzzy logic.
I will do this on my own
0
 
LVL 27

Expert Comment

by:aburr
Comment Utility
Tutorials-
-
#
Fuzzy logic tutorial.
Free fuzzy logic tutorial. ... Fuzzy Logic for "Just Plain Folks" (Online Tutorial, Free for your personal use.)
fuzzy-logic.com -
#
Fuzzy Logic Tutorial - An Introduction
Search WWW Search seattlerobotics.org
www.seattlerobotics.org/encoder/mar98/fuz/flindex.html -
0
 
LVL 37

Expert Comment

by:TommySzalapski
Comment Utility
If this is for homework, then we can't solve it for you anyway, we can just offer guidance. If this is not for homework, then please explain why you want to use fuzzy logic. Using fuzzy logic to solve this would be like sending a postcard to your next-door neighbor by airmail. It might get there eventually, but you've wasted lots of time and money in the long run. As an expert, I would have to advise against it until I understood why it was necessary.
0
 
LVL 3

Author Comment

by:mohanupadhyay
Comment Utility
This is a sample, only the smallest part of whole process, Its a big module
I need a sample so I can put the logic to my entire module.
This will give me idea how fuzzy logic is applied.
0
 
LVL 37

Assisted Solution

by:TommySzalapski
TommySzalapski earned 166 total points
Comment Utility
I see. In that case, I would check out those links aburr posted (especially www.fuzzy-logic.com). They will give better examples than I could make from the blood pressure data.
0
 
LVL 53

Expert Comment

by:Dhaest
Comment Utility
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Article by: Nadia
Linear search (searching each index in an array one by one) works almost everywhere but it is not optimal in many cases. Let's assume, we have a book which has 42949672960 pages. We also have a table of contents. Now we want to read the content on p…
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now