Thursday, 22 June 2017

GSoC 2017: First Evaluations

My other two blogs were short and sweet. You aren't that lucky this time!
Two months into Google Summer of Code 2017 and First Evaluations being just around the corner, a detailed blog is in order.

As I've mentioned in the introductory blogs, my task, along with Dipankar, is to work on the Biometric sensor's interface for astronauts (though we have very independent roles to play in the same project). The overall project revolves in interfacing the various sensors that measure astronaut's biometrics with the Mars Society's central control system that is built using Tango Controls.

The device we chose for the astronaut (mentioned in the previous blog) took care of most of the sensors we needed.

Now it was time to get dirty with code.
We decided to have good abstraction between various components of the system.
As of now, we have the following modules:
1) anomaly_detector
2) health_monitor
3) hexoskin_helper



These three modules act as packages that the main Health Monitor Tango Device Server would use. So the work on building these three components began, keeping the Tango Device Server for later.

My work was focused on making the Health monitor package and Hexoskin Helper packages.

The hexoskin helper package solely deals with polling the smart shirt and getting the  data from various sensors on-board the shirt in real-time.
The health monitor package acts as the backbone of the system and an interface for the various components and the device server.

The anomaly detector is the pure geek stuff done by Dipankar that contains various algorithms for detecting anomalies in the astronauts' biometric data. Two algorithms has been implemented so far - atrial fibrillation and ventricular tachycardia.  This calls for method in the hexoskin helper that needs to get the desired measurements from the shirt in real-time.
The Atrial Fibrillation requires RR-Intervals and HeartRate Quality, and the Ventricular Tachycardia requires ECG, RR-Intervals,
HeartRate Quality, RR-Interval-Status and Heart Rate.

The Atrial Fibrillation interface in the health monitor - to use the methods and functions from the Anomaly Detector module - was straight forward approach, but the same for the Ventricular Tachycardia was a tricky business because of the complex flow that it follows. Different functions from the Anomaly Detector were run on different threads to get the interface ready. Details about this complex procedure can be found here.

The hexoskin helper is split into 3 parts:
  • Utility helper:- That takes care all non-biometric related stuff like authentication for polling the smart shirt, accessing various records (a live session), etc. Also all the datatypes (the hexoskin biometrics) are defined along with their IDs. This makes it easier to extend the system for more sensors without having a need to dig into the hexoskin documentation, which is excellent.
    The data sample rates are also defined, in 256/samples/second, which makes sure that the data is collected properly from the hexoskin server in batches and with correct sampling rates.
  • Resource helper:- This has all the methods that is used for the data collection - previously collected data as well real-time. Real-time data is collected using generator functions in python, that yield the biometric data every, say, 5 seconds.
  • Database helper:- A small helper file that facilitates the database usage for storing the detected anomalies. 
The database used is SQLAlchemy (ORM - Object Relational Mapping).

Health monitor contains a a simple file that will be imported by the Tango device server. This file acts as an interface between the device server and all the components. It also contains the database where the anomalies are stored.

With the not-so-basic skeleton and the prerequisites for the device server being done, the next phase will be getting these components hooked up with a device server. Also various other anomaly detection algorithms are in queue and will be incorporated into the system.





No comments:

Post a Comment