This python module parses binary files recorded by Vital Recorder (.vital).
Parsing is done using Construct.
⚠️ Warning: This code has only been tested on a limited set of test data. Please validate converted files. For most usecases, saving the file as EDF from Vital Lab would be recommended instead.
For large files (above a few MB) the program is very slow. Using pypy speeds things up by a factor of 10-100.
To use pypy, install pypy3-dev, use it in a virtualenv (to make pip work on linux), pip install numpy pandas construct arrow
.
edit: Pypy now works with conda: install conda, then:
conda config --set channel_priority strict
conda create -c conda-forge -n pypy pypy
conda activate pypy
conda install -c conda-forge numpy pandas construct arrow
afterwards link python
to the pypy3
interpreter within the bin directory of the env
cd ~/miniconda3/envs/pypy/bin/
mv python python_bak
ln -s pypy3 python
vital = Vital('path/to/file.vital')
print(vital)
======= VITAL FILE INFO =======
Path: test/test_intellivue_demo1.vital
Size: 53.19 KB
Format Ver.: 3
Tracks (n): 16
----------- Tracks ------------
trkid name unit
1 NIBP_SYS mmHg
2 NIBP_DIA mmHg
3 NIBP_MEAN mmHg
4 NIBP_HR /min
5 ECG_HR /min
6 RR /min
7 ABP_MEAN mmHg
8 ABP_SYS mmHg
9 ABP_DIA mmHg
10 HR /min
11 PLETH_SAT_O2 %
12 PLETH_HR /min
13 PLETH_PERF_REL
14 ECG_II mV
15 PLETH
16 ABP mmHg
-------------------------------
vital_track = vital.get_track(name = 'track_name')
or vital_track = vital.get_track(trkid = trkid)
print(vital_track)
======= TRACK INFO =======
name: PLETH_SAT_O2
unit: %
starttime: 2019-06-27 11:14:16+00:00 (2 months ago)
measurements: 25 in 25 blocks
--------------------------
vital_track.to_pandas_ts()
vital_track.save_to_file('dir_path/')
$ python3 ./parse_vital --help
usage: parse_vital.py [-h] [--outdir OUTDIR] [--info]
[--trkid TRKID [TRKID ...]] [--name NAME [NAME ...]]
[--saveall]
vitalfile
Convert .Vital file to .csv files
positional arguments:
vitalfile Path to input file (.vital)
optional arguments:
-h, --help show this help message and exit
--outdir OUTDIR, -o OUTDIR
Directory for csv files (default=./converted)
--info, -I Info about .vital file
--trkid TRKID [TRKID ...], -t TRKID [TRKID ...]
Id(s) of track(s) to save
--name NAME [NAME ...], -n NAME [NAME ...]
Name(s) of track(s) to save
--saveall Save all tracks