This project implements a library to find the systolic/diastolic pressures of the closest pulse in a vector based on a point selected by the user.
The vector is already processed, which means the data is filtered and formatted in mmHg. It contains the pulse pressure along the time representing an arterial blood pressure wave.
More info on doc folder.
NOTICE: Instructions for Linux ecosystem like Ubuntu 19.04. Please adapt for your scenario. Thanks!
GIT for repo clone
$ sudo apt install git
Build needs C++11 standard compliant:
$ sudo apt install build-essential g++
Tests needs and CMake and Google Tests(GTest) libs installed:
$ sudo apt install cmake
$ git clone https://github.com/google/googletest/ ~/googletest
$ cd ~/googletest
$ cmake CMakeLists.txt
$ make
$ sudo cp *.a /usr/lib
Clone lib repo:
$ git clone https://github.com/google/googletest/ ~/bp-monitor
Build:
$ cd ~/bp-monitor/src
$ make
For simple DEBUG version:
$ cd ~/bp-monitor/src
$ make debug
Install on system libs:
$ sudo cp ~/bp-monitor/src/libbpmonitor.so /lib
$ sudo cp ~/bp-monitor/src/lib-monitor.h /usr/include
NOTICE: Instructions for Raspberry PI v3. Please adapt for your scenario. Thanks!
Clone lib repo:
$ git clone https://github.com/google/googletest/ ~/bp-monitor
Clone BUILDROOT repo:
$ git clone https://github.com/buildroot/buildroot ~/buildroot
The dir package contains the files necessary. Copy this to BUILDROOT:
$ cp -a ~/bp-monitor/package ~/buildroot
Edit the file ~/buildroot/packages/Config.in
and add these lines to enable lib as package on build:
menu "Target packages"
...
# BP Monitor Package
source "package/bp-monitor/Config.in"
...
To build package:
$ cd ~/buildroot
$ make bp-monitor
To build entire system:
$ cd ~/buildroot
$ make
To use this library simple include header:
...
#include "bp-monitor.h"
...
Instantiate de bPressureMonitor
class and call method measure
passing as parameter the waveform buffer (as array of int), the size of the buffer, the point index selected by user and the bPressure
struct by ref to receive data.
...
bPressureMonitor m;
bPressure result = { 0, 0, 0, 0};
int result = m.measure(sample_buffer, number_of_samples, index_target, bPressure result struct);
if (result)
# Error on measure
else
# Measure OK
...
Return codes
Code | Description |
---|---|
0 | Measure OK, structs contains the data |
1 | Invalid arguments passed (Ex. zero samples, zero index, index > n samples) |
2 | Impossible measure at index |
The struct result:
struct BP {
int SBP; // systolic blood pressure value measure
int SBPi; // systolic blood pressure index at measure
int DBP; // diastolic blood pressure value measure
int DBPi; // diastolic blood pressure index at measure
int hr; // heart rate estimative
};
Example of use in folder example.
Unit tests is on folder test
. The file tests.cpp
contains test cases in Google Test) Format.
To run:
$ cd ~/bp-monitor/test
$ cmake ./
$ make
$ ./runTests
Test Cases
Code | Description |
---|---|
measureValues | Test true results cases |
MeasureFailed | Test true failed measure cases |
InvalidArgs | Test invalid measure request param |
injectData | Try to modify values before request |
Coding style
The code is based on Google C++ Style Guide and checked with cpplint.py
script provide by Google.
Try on folder bp-monitor
$ cpplint.py --counting=detailed $( find . -name *.h -or -name *.cpp | grep -vE "CMakeFiles" )