F3V3 events are formatted as waveforms (rather than a series of timestamped
events), with one chunk per mask-on slice. The previous assumption of only
a single event chunk per session meant that all events after the first slice
were getting dropped.
BiPAP AVAPS 30 (System One 60 Series) now works much better, although the data
doesn't yet show any gaps where the mask is off. Fixing that requires changes
throughout the code and not just in the PRS1 loader.
Also, LL calculation seems wrong. Perhaps the automatic calculation of
unintentional leak from total leak doesn't work for AVAPS, throwing off
automatic LL calculation? (F3V3 reports neither unintentional leakage nor
large leak events.)
This fixes the start/end times of such compliance sessions, but their
total_time is broken due to the presence of a 0-length slice.
That will require a more extensive fix of the slice system throughout
the program.
Also update the leak calculation logic to depend on the set of reported
events rather than hard-coding it based on machine family and version.
No change in functionality.
This commit adds a mapping from PRS1 events to the OSCAR channels that
should receive the data, along with the necessary supporting code to
allow for generic handling of PRS1 events as a result.
The F3V6 importer has minimal changes to partially use the new
plumbing, enough to make sure that it works and causes no change in
the imported data.
This fixes 960P-960T, which was importing both values at each interval, presumably
trampling each other. 950P didn't report it, and DreamStation never calculated it.
Also fix timed breath gain for pre-DreamStation autoSV.
F3V3 is unusual. Its events are recorded at fixed intervals like a waveform.
Its summary is recorded with absolute timestamps. Slices are each given their
own chunks in the event file.
This last oddity isn't yet handled.
While examining this, a few other importing issues have been cleaned up:
PRS1DataChunk::ParseEvents no longer needs the mode passed in as an argument,
F5V012 importers should quietly eat the newly parsed pressure
adjustment events until we can import both those and average pressure
statistics, and F5V012 importers should handle real VS events and treat
VS statistics like the other importers do.
This is very incomplete since we currently have only limited sample
data for F5V2. The events that have been verified will parse
correctly, and the rest will result in a parsing error.
There are some very strange changes in the event numbers compared
to F5V1 and F5V3, it's unclear why.
Note that F5V2 uses a gain of 0.125 like F5V3 instead of 0.1 like F5V1.
F5V1 introduces a new Hypopnea variant (event 8) with 2 data bytes.
This was previously seen in F5V3, and it's unclear how this is
different from the usual Hypopnea event (event 7, 1 data byte).
Parsing used to stop when it encountered this event, but now it
can continue through the end of the session.
F5V1 also adds a leak value in its periodic stats, also previously
seen in F5V3. PB start time and duration are now correct.
As with F5V0, now VS, LL, and EPAP adjustment are correctly parsed,
and timestamps and durations are now accurate.
The handlers were essentially copied from F5V3 and F5V0 for
consistency and cross-checking.
This fixes a lot of issues with event parsing. Now VS, LL, and EPAP
adjustment events are now correctly parsed.
And as a result the timestamps for events and overall session durations
are now accurate.
The handlers were essentially copied from F5V3 and F0V12 for
consistency and cross-checking.
No changes were intended in the imported data, but the parsers
were fantastically broken, so touching anything in the code
results in lots of differences in the output.
As a result, the imported data for F5V012 is now unstable.
On the plus side, the parser no longer bails on event 8 for F5V1.
This will almost certainly need to be split into 3 separate
functions.
F0V4 is unsurprisingly a midpoint between the two. PB/LL durations are
doubled as in F0V6 and, in fact, the contents of all events seem
identical between F0V4 and F0V6, apart from the new hypopnea events 0x14
and 0x15 in F0V6. We haven't encountered event 0 in F0V4 or F0V6 data
yet, but it would be an interesting comparison to F0V23.
It's now clear that PRS1PressureAverageEvent can't just be the average
overall pressure, at least not for CPAP: it's too low. This needs
further study.
Import changes:
- As with F0V23, apneas/hypopneas now have a (correct) duration of 0.
- PB/LL will now be drawn at the correct time, instead of starting when
they end. This was already fixed previously in F0V23.
- The EPAP graph is removed from CPAP data until we understand what
the underlying data is.
It also turns out that every sample machine that claims to be F0V3 in its
property file contains only F0V2 data, so there appears to be nothing
additional to test, but now there are more warnings in case we ever do
actually encounter F0V3 data.
Also warn if we ever encounter oximetry.
The only difference so far is the lack of doubled duration for PB/LL, slightly rearranged
events 0-3, and the absence of events 0x14 and 0x15 in F0V2 (so far).
The only change in import functionality is that apneas/hypopneas now have a (correct)
duration of 0.
Next step is to test against more samples and particularly F0V3 samples.