The Problem:

Many people die from diseases, many of them that lurk in the body and patients only show signs of the disease when it is harder to treat the disease. Regular examinations and testing may also be impractical due to problems such as expenses. Yet it is important diagnose a disease in its early stages to make treatment easier. This may be a problem in the developed countries but developing countries have a worse problem.

In developing countries, there are very little doctors and the doctors that are available have limited supply of resources for diagnosing diseases and help save lives. The shortage of not only doctors, but also supplies, contribute to the deaths from diseases that may be easily treated in developed countries.

The Solution:

I have learned that solutions to important problems come from things that may be unexpected or may be common in day to day life. I thought about smartphones. Smartphones are common in this world. In fact, even people in many parts of India, typically considered as a developing countries, have smartphones. I thought about how smartphones can be used to measure important health factors. Now I think I may have a solution.

The solution is to create a smartphone app that takes advantage of certain scientific properties to use the smartphone sensors to detect vital signs and diagnose diseases. I will measure heart rate, blood pressure, possibly implement EKG and oximetry, and maybe even a glucometer. I will use artificial neural networks to find patterns in health and interpret data.


Stages of development:

Stage 1 - Heart rate (along with heart rate variability) and blood pressure implementation (Goal: June 31, 2015)

Stage 2 - EKG and oximetry implementation (Goal: July 19, 2015)

Stage 3 - Glucometer implementation (Goal:August 1, 2015)

Stage 4 - Neural network implementation (Goal: August 15, 2015)

Stage 5 - Doctor implementation (Goal: Auguts 30, 2015)

I will add details over here as I work on individual stages.

Implementation

I will create a prototype app for each stage as I add features for the app.

Phonegap

I will use the Phongap platform to help develop my project, in particular, Phonegap Build. Phonegap Build takes in website files (HTML, Javascript, CSS) and turns it into a smartphone app. Therefore, I will need to create a website-like application. Note that the application that I am uploading to Phongap is not neccesssarily a website. I can use Phonegap plugins that require smartphone features. As I develop my smartphone app, I will see whether I can make it just a website that can be used anywhere, anytime.

Heart rate (along with heart rate variability)

Measuring heart rate with a smartphone app is now common, although I consider it as the first step for my project. Having a heart rate sensor is important for any health app. To measure heart rate, it is important to record a video of either the face of a patient or a really close close-up of the patient's finger. Since obviously, blood gives off red light, the red color component can show the heart rate. However, a better approach is to convert the RGB values of the pixels in each frame of the video to HSV format. To do so, I will use TinyColor. First, I need the video pixel data. I do this like:

ctx.drawImage(myVideo);
var data = ctx.getImageData(0, 0, w, h).data;

Then, I use TinyColor to convert the RGB values to HSV values. The hue can be plotted and this graph can be used to measure heart rate variability. Finally, is neccesary to find out the number of peaks per minute, which is the measure of heart rate in beats per minutes.

To find the peaks (beats), I use this function:

function getPeaksAtThreshold(data, threshold) {
  var peaksArray = [];
  var length = data.length;
  for(var i = 0; i < length;) {
    if (data[i] > threshold) {
      peaksArray.push(i);
      // Skip forward ~ 1/4s to get past this peak.
      i += 10000;
    }
    i++;
  }
  return peaksArray;
}