vitaldb-reader
Reads VitalDB .vital files at native resolution, with this atlas's corrections as separate, versioned steps: reset records in sampling order, corrected scale factors, samples placed by count, and the timing model.
What it is
The reader keeps every track at the resolution and in the dtype the file stores it, in file order, with record
times in absolute file time, and resamples nothing. Each correction the atlas found is its own module with a
version, so an analysis can say exactly which it applied:
- Reset records in sampling order (
resets, RULE_VERSION): Five records out of order at every SNUADC reset,
Records out of order at SNUADC resets, and where the lost time goes.
- Corrected scale factors (
scales, SCALE_RULES_VERSION) for the Primus waveforms and the mislabelled
arterial tracks: Primus waveform gains are wrong in every recording, for CO₂ or for AWP, Three ART tracks carry the PLETH conversion factors.
- Samples placed by count (
timing), so none are lost to the stamp arithmetic:
SNUADC stamps run −0.95 ppm against the sample count, Stamp-based loaders lose samples at overlaps.
- The timing model (
timing_model, MODEL_VERSION): each monitor numeric's delay and window, and the
resolution of the clinical times: Monitor numerics describe the past, never the future, Anaesthesia record times are rounded up,
How the Solar8000 computes its heart rate.
It was first written as a VitalDB connector for TimeNet (TimeNet); the reader became its own package
so that the scripts behind this atlas (vitaldb-bench) can be run from public code. The .vital format
is VitalDB's, documented in vitalutils; the reader is an independent implementation.
Install
pip install "vitaldb-reader @ git+https://github.com/metrology-atlas/vitaldb-reader@0.1.0"
What is in it
Reading
|
|
vital_file.py |
Reads the .vital container (devices, tracks, records, exact record times) in file order. |
Corrections
|
|
resets.py |
Finds the reset clusters in an SNUADC track and puts their records back in sampling order. |
scales.py |
Corrected gain and offset where the stored scale factors are wrong. |
timing_model.py |
Delay and window of each monitor numeric; resolution of the clinical times. |
Timing and values
|
|
timing.py |
Runs and segments of each waveform track; samples placed by count; nominal rates. |
resolution.py |
Value resolution of each track, converter limits and near-duplicate records. |
Tests
|
|
test_resets.py |
Tests of the reordering rule, including the variant clusters. |
Studies that use it
Observations it handles
| Observation |
Status |
Summary |
| Five records out of order at every SNUADC reset |
established |
At each step-mode reset the five records after it are written in the wrong order: two continue the old timing and three start the new, interleaved. Read in file order, or sorted by stamp, one second of signal is scrambled. |
| Primus waveform gains are wrong in every recording, for CO₂ or for AWP |
established |
Recordings store the Primus waveforms with one of three sets of scale factors. Checked against the Primus's own ETCO₂ and PIP numerics in all 6,388 recordings, CO₂ fits only 0.075 mmHg per code and AWP only 0.1 mbar per code with offset −20, so most recordings overstate CO₂ by a third, and the others overstate AWP by about 3% (950 recordings) or understate it about fourfold (26). |
| SNUADC stamps run −0.95 ppm against the sample count |
established |
Between corrections each 0.2 s record stamp increment is about 0.19 µs short: stamps run −0.95 ppm from the sample count in 88% of files (both SNUADC modes). It is arithmetic, not clock drift. The other 12% sit above it, mostly between −0.90 and −0.72 ppm. |
Mentioned in