Making Custom Filters for Vital Recorder


  • In Vital Recorder, Filter is a macro function for analyzing recorded biological signals.
  • Users can create their own filters according to the following rules.
  • To use the filters in Vital Recorder, you can create your own filters as a text file with extension .js and put them in the filters folder.

Making Filter

  • The filter language is javascript language.
  • The filter file must be an ASCII or UTF8 encoded text file.
  • The file name of the filter file excluding the extension (js) must be the same as the filter object name.
  • A filter file that has a file name different from the filter object name does not appear in the filter list in the program even if it exists in the filters folder. However, you can also read these files, so putting the helper functions in this file will help with the filter implementation.
  • Since the filter object is called at the start of filtering and then only the run function is called repeatedly, the objects defined outside the run function are retained in the repeated run function call.

How to define filters

The filter object can be defined as a javascript object with the same name as the file name as shown below.

var spi_calc = {

        name : 'filter name',

        desc: 'filter description',

        interval: 10,

        padding: 2,

        input: [{type: 'wav'}, {type: 'wav'}],

        output: [{type: 'num', min: 0, max: 300, unit: ''}],

        run : function (ecg, pleth) {

                // execute code

                return [[0,0]];



Properties of the filter object

  • name (UTF8 encoded string): The name of the filter to be displayed (optional)
  • Set as function name when not specified
  • desc (UTF8 encoded string): Description of the filter
  • Unspecified is set to the same value as name
  • interval (real number): length of filter input (optional)
  • padding (real number): time overlapping before and after the input value
  • input: Input parameter information required by the filter function (required)
  • An array of objects that can be up to five and have the following parameters
  • type: ‘wav’, ‘par’, ‘num’, ‘str’
  • name: Displayed when executing filter by variable name. If not specified, it is automatically specified as 'par1', 'wav1', etc. depending on the variable type
  • min: Minimum value
  • max: Maximum value
  • unit: unit. If this value is 'string', this parameter is treated as a string.
  • output: Parameter information to be passed to the Vital Recorder as a calculation result in the filter function (required)
  • Same as input variable list
  • Up to 5 arrays can be specified

Using Filter

  • Simply create a filter function, place it in the filters folder, and the Vital Recorder will automatically read and use it.
  • The filter function is called every interval time.
  • The data of the last duration is sent every interval time.
  • Pass parameters in the order specified in the input variable.
  • wav: {srate, data[]}
  • The result of sampling from input time to end time with srate
  • Filled with undefined if there is no sampled value
  • num : [{dt, val}]
  • dt is the relative time from the start of the call
  • A filter function can return multiple variables as a result of a call. Ex) a-line analysis shows PPV, SBP, MBP