npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-ecg-utils

v0.1.1

Published

The main functionality is the calculation of cardio-interval lengths, heart rate and Stress Index.

Downloads

7

Readme

Mathematical library for working with ECG data from the Callibri sensor.

The main functionality is the calculation of cardio-interval lengths, heart rate and Stress Index (SI).

During the first 6 seconds the algorithm is learning, if no 5 RR-intervals are found in the signal 5 RR-intervals are not found, the training is repeated. Further work with the library is iterative (adding new data, calculating indicators).

Initialization

Determine the basic parameters

  1. Raw signal sampling frequency. Integer type. The allowed values are 250 or 1000.
  2. Data processing window size. Integer type. Valid values of sampling_rate / 4 or sampling_rate / 2.
  3. Number of windows to calculate SI. Integer type. Allowable values [20...50].
  4. The averaging parameter of the IN calculation. Default value is 6.

Creating a library instance

Firstly you need to determine lybrary parameters and then put them to library. Tne next step is initialize the filters. In the current version the filters are built-in and clearly defined: Butterworth 2nd order BandPass 5_15 Hz.

You can initialize averaging for SI calculation. It is optional value.

ReactNative (JavaScript)
// 1. Raw signal sampling frequency
let sampling_rate = 250;
// 2. Data processing window size
let data_window = sampling_rate / 2;
// 3. Number of windows to calculate SI
let nwins_for_pressure_index = 30; 
let math = new EcgMath(sampling_rate, data_window, nwins_for_pressure_index)
// Filters are initialized in the constructor

// optional
// 4. The averaging parameter of the IN calculation. Default value is 6.
let pressureIndexAverage = 6;
math.setPressureAverage(pressureIndexAverage);

Initializing a data array for transfer to the library:

The size of the transmitted array has to be of a certain length:

  • 25 values for a signal frequency of 250 Hz
  • 100 values for a signal frequency of 1000 Hz
ReactNative (JavaScript)
var samples: number[] = new Array(25)
// or
var samples: number[] = new Array(100)

Optional functions (not necessary for the library to work)

Check for initial signal corruption. This method should be used if you want to detect and notify of a distorted signal explicitly.

ReactNative (JavaScript)
if(math.isInitialSignalCorrupted){
    // Signal corrupted!!!
}

Work with the library

  1. Adding and process data:
ReactNative (JavaScript)
math.pushData(samples)
  1. Getting the results:
ReactNative (JavaScript)
// check for a new peak in the signal
if(math.isRRdetected){
    // RR-interval length
    console.log(math.RR)
    // HR
    console.log(math.HR)
    // SI
    console.log(math.PressureIndex)
    // Moda
    console.log(math.Moda)
    // Amplitude of mode
    console.log(math.AmplModa)
    // Variation range
    console.log(math.VariationDist)
    math.setRRchecked()
}

Finishing work with the library:

ReactNative (JavaScript)
math.clearData()
math.free()