cpap-lib 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package cpap-lib --version 1.0.0                
NuGet\Install-Package cpap-lib -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="cpap-lib" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add cpap-lib --version 1.0.0                
#r "nuget: cpap-lib, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install cpap-lib as a Cake Addin
#addin nuget:?package=cpap-lib&version=1.0.0

// Install cpap-lib as a Cake Tool
#tool nuget:?package=cpap-lib&version=1.0.0                

Summary

cpap-lib is a managed (C#/.NET) library that allows client applications to read, explore, and analyze the data recorded by a CPAP machine. It can read the CPAP data stored on the SD Card and extract all of the waveform, event, and settings data into an easy to use data model that allows for detailed analysis of everything the CPAP machine is capable of recording.

Currently the only fully supported CPAP machine is the ResMed AirSense 10, because that is the machine I have and therefore the data files I have available to test with.

I have done some limited testing of the ResMed AirCurve 10 ASV as well, but don't have extensive sample data to test with. Other ResMed Series 10 models may be supported, and Series 11 models may also be at least partially supported.

There is also very limited "proof of concept" support for the Philips Respironics System One model 560P, but other Philips Respironics models are almost certainly not supported.

Dependencies

This library uses StagPoint.EuropeanDataFormat.Net to read the EDF files that contain the CPAP data.

SD Card Files and Folder Structure

Example

Root Folder/
├── Identification.tgt
├── STR.edf
└── DATALOG/
    ├── 20230821/
    │   ├── 20230822_001107_EVE.edf
    │   ├── 20230822_001118_BRP.edf
    │   ├── 20230822_001119_PLD.edf
    │   ├── 20230822_001119_SAD.edf
    │   └── ...
    ├── 20230822/
    │   ├── 20230822_224916_EVE.edf
    │   ├── 20230822_224924_BRP.edf
    │   ├── 20230822_224924_PLD.edf
    │   ├── 20230822_224924_SAD.edf
    │   └── ...
    └── ...

Identification.tgt

This is a two-column text file with a number of machine-specific fields.

Key Example Value Meaning
#SRN XXXXXXXXXXX Serial number
#PNA AirSense_10_AutoSet Text description of the model of machine
#PCD 37028 The Model Number
Key Example Value Meaning
#IMF 0001 TBD
#VIR 0064 TBD
#RIR 0064 TBD
#PVR 0064 TBD
#PVD 001A TBD
#CID CXXXX-XXX-XXX-XXX-XXX-XXX-XXX TBD
#RID 000D TBD
#VID 0027 TBD
#SID SXXXX-XXXX TBD
#PCB (90)R370-7518(91)T1(21)97141060 TBD
#MID 0024 TBD
#FGT 24_M36_V39 TBD
#BID SX577-0200 TBD

STR.edf

The STR.edf file is a European Data Format file that contains 81 signals representing what is essentially a vertical table of values reflecting the settings and statistics for each recorded day.

It is discussed in more detail on this page.

DATALOG Folder

Underneath the DATALOG folder is another set of folders, one for each day recorded. Each folder will be named for the day whose data is stored within.

Within each of those dated subfolders will be a set of EDF files that contain the recorded data for each session recorded on that day. <br/>These files will each have a filename that conforms to the following format: yyyyMMdd_HHmmss_[Type].edf

Example Path Example Filename Type Description
DATALOG/20230821 20230822_001107_EVE.edf EVE There will only be one of these per folder, and it contains all of the events (Apnea, Hypopnea, CSR, etc) that were flagged during the entire day's recording sessions. The filename contains the date and time of the first session recorded on this day
DATALOG/20230821 20230822_001118_BRP.edf BRP There will be one of these files for every recorded session. It contains the high-resolution Flow and Pressure data for the session.
DATALOG/20230821 20230822_001119_PLD.edf PLD There will be one of these files for every recorded session. It contains the low-resolution data for the recording session (Flow Limit, Mask Pressure, etc)
DATALOG/20230821 20230822_001118_SAD.edf SAD There will be one of these files for every recorded session. It contains Oximetry data (Blood Oxygen Saturation %, Pulse Rate) for the recorded session. If no pulse oximeter device is attached, the signal data will contain negative values.

Data Format: STR.edf File

The STR.edf file is a European Data Format file that contains 81 signals representing what is essentially a vertical table of values reflecting the settings and statistics for each recorded day.

General Information

Signal Description
Date The "ResMed Date" on which the recording starts
MaskOn An array of offsets (in seconds) from the start time of the file indicating the start of each session
MaskOff An array of offsets (in seconds) from the start time of the file indicating the end of each session
MaskEvents The number of (MaskOn, MaskOff) events per day.
Duration The combined duration (in minutes) of all sessions on the given day.
OnDuration TBD
PatientHours TBD
Mode The therapy mode used (CPAP, APAP, BiLevel, ASV, etc)

Event Information

Signal Description
AHI Apnea-Hypopnea Index, the average number of Apnea or Hypopnea events per hour.
HI Hypopnea Index - The average number of Hypopnea events that occurred per hour
AI Apnea Index - The Average number of Apnea events that occurred per hour.
OAI Obstructive Apnea Index - The average number of Obstructive Apnea events that occurred per hour.
CAI Clear Airway Index - The number of Clear Airway (or Central Apnea) events that occurred per hour.
UAI Unclassified Apnea Index - The number of Apnea events that could not be classified that occurred per hour.
RIN Respiratory Disturbance Index - The number of Respiratory Effort Related Arousal events that occurred per hour.
CSR Cheyne–Stokes Respiration Index - The percent of time spent in Cheyne–Stokes Respiration

Machine Settings

General Settings

Signal Data Type Description
S.RampEnable True/False Indicates whether the Ramp mode is enabled
S.RampTime Number The length of the ramp period, in minutes
S.SmartStart True/False
S.PtAccess Plus/On Essentials mode
S.ABFilter Yes/No Whether antibacterial filters are installed
S.Mask Enum Can be set to Unknown, Pillows, Nasal, or Full Face
S.Tube Number When enabled, contains the Tube Temperature set point
S.ClimateControl Manual/Auto Whether Climate Control is set to Manual or Auto mode
S.HumEnable True/False Whether the humidifier is enabled
S.HumLevel Number The Humidity Level set point
S.TempEnable True/False TBD
S.Temp Number The temperature set point
HeatedTube True/False Whether a heated tube is attached
Humidifier True/False Whether a humidifier unit is attached

CPAP Mode settings

These settings are used when the machine is operating in CPAP mode

Signal Data Type Description
S.C.StartPress Number The starting pressure for the Ramp, if enabled
S.C.Press Number The constant pressure that will be delivered (except during ramp times)

AutoSet Settings

These settings are used when the machine is operating in AutoSet mode (see here for more information)

Signal Data Type Description
S.AS.Comfort Standard/Soft Indicates the speed at which pressure increases during AutoSet mode operation
S.AS.StartPress Number The starting pressure during the Ramp period, if enabled
S.AS.MaxPress Number The maximum pressure that will be delivered
S.AS.MinPress Number The minimum pressure that will be delivered

EPR settings

These settings are used when Expiratory Pressure Relief (EPR) is enabled.

Signal Data Type Description
S.EPR.ClinEnable True/False TBD - Maybe whether EPR is enabled through the Clinician's Menu?
S.EPR.EPREnable True/False Indicates whether EPR is enabled
S.EPR.Level Number (1-3) The amount of pressure drop (in cmHO2) that will occur when exhaling
S.EPR.EPRType Off / Ramp Only / Full Time When EPR is active. It can be off, active only during Ramp time, or enabled at all times

Statistics

Signal Description
BlowPress.95
BlowPress.5
Flow.95
Flow.5
BlowFlow.50
AmbHumidity.50
HumTemp.50
HTubeTemp.50
HTubePow.50
HumPow.50
SpO2.50
SpO2.95
SpO2.Max
SpO2Thresh
MaskPress.50
MaskPress.95
MaskPress.Max
TgtIPAP.50
TgtIPAP.95
TgtIPAP.Max
TgtEPAP.50
TgtEPAP.95
TgtEPAP.Max
Leak.50
Leak.95
Leak.70
Leak.Max
MinVent.50
MinVent.95
MinVent.Max
RespRate.50
RespRate.95
RespRate.Max
TidVol.50
TidVol.95
TidVol.Max

Fault Information

Signal Description
Fault.Device TBD
Fault.Alarm TBD
Fault.Humidifier TBD
Fault.HeatedTube TBD
Crc16 TBD
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
.NET Framework net47 is compatible.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3.1 152 1/23/2024
1.0.3 102 1/22/2024
1.0.2 107 1/18/2024
1.0.1 109 1/13/2024
1.0.0 126 1/7/2024

Initial Release