mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 18:50:44 +00:00
Report fixes, Added CPAP mode to daily & reports
This commit is contained in:
parent
c74c57f343
commit
83b64776e9
@ -439,14 +439,18 @@ bool PRS1Loader::ParseSummary(Machine *mach, qint32 sequence, quint32 timestamp,
|
||||
if (mach->SessionExists(sequence))
|
||||
return false;
|
||||
|
||||
if (size<40)
|
||||
return false;
|
||||
|
||||
Session *session=new Session(mach,sequence);
|
||||
session->really_set_first(qint64(timestamp)*1000L);
|
||||
EventDataType max,min;
|
||||
|
||||
min=(data[0x03])/10.0;
|
||||
session->settings[CPAP_PressureMin]=min;
|
||||
max=(data[0x04])/10.0;
|
||||
session->settings[CPAP_PressureMax]=max;
|
||||
min=float(data[0x03])/10.0;
|
||||
session->settings[CPAP_PressureMin]=(double)min;
|
||||
//min=session->settings[CPAP_PressureMin].toDouble();
|
||||
max=float(data[0x04])/10.0;
|
||||
session->settings[CPAP_PressureMax]=(double)max;
|
||||
int offset=0;
|
||||
if (version==5) { //data[0x05]!=0) { // This is a time value for ASV stuff
|
||||
offset=4; // non zero adds 4 extra fields..
|
||||
@ -489,11 +493,8 @@ bool PRS1Loader::ParseSummary(Machine *mach, qint32 sequence, quint32 timestamp,
|
||||
if (max>0) {
|
||||
session->setMin(CPAP_Pressure,min);
|
||||
session->setMax(CPAP_Pressure,max);
|
||||
} else {
|
||||
session->setWavg(CPAP_Pressure,min );
|
||||
|
||||
}
|
||||
|
||||
session->setWavg(CPAP_Pressure,min);
|
||||
} else {
|
||||
// 0X28 & 0X29 is length on r5
|
||||
|
||||
@ -509,10 +510,10 @@ bool PRS1Loader::ParseSummary(Machine *mach, qint32 sequence, quint32 timestamp,
|
||||
// Not using these because sometimes this summary is broken.
|
||||
EventDataType minp,maxp,avgp,p90p;
|
||||
|
||||
minp=data[offset+0x16]/10.0;
|
||||
maxp=data[offset+0x17]/10.0;
|
||||
p90p=data[offset+0x18]/10.0;
|
||||
avgp=data[offset+0x19]/10.0;
|
||||
minp=float(data[offset+0x16])/10.0;
|
||||
maxp=float(data[offset+0x17])/10.0;
|
||||
p90p=float(data[offset+0x18])/10.0;
|
||||
avgp=float(data[offset+0x19])/10.0;
|
||||
|
||||
if (minp>0) session->setMin(CPAP_Pressure,minp); else session->setMin(CPAP_Pressure,min);
|
||||
if (maxp>0) session->setMax(CPAP_Pressure,maxp); else session->setMax(CPAP_Pressure,min);
|
||||
@ -1107,7 +1108,7 @@ bool PRS1Loader::OpenFile(Machine *mach, QString filename)
|
||||
}
|
||||
datasize=size-hl-2;
|
||||
|
||||
data=&m_buffer[pos+hl];
|
||||
data=&header[hl];
|
||||
|
||||
#ifdef PRS1_CRC_CHECK
|
||||
c16=CRC16(data,datasize);
|
||||
|
@ -372,12 +372,12 @@ int ResmedLoader::Open(QString & path,Profile *profile)
|
||||
qDebug() << "edf Serial number doesn't match STR.edf!";
|
||||
}
|
||||
} else if (i.key()=="PNA") {
|
||||
m->properties["Model"]=i.value();
|
||||
//m->properties["Model"]=""; //i.value();
|
||||
} else if (i.key()=="PCD") {
|
||||
bool ok;
|
||||
int j=i.value().toInt(&ok);
|
||||
if (RMS9ModelMap.find(j)!=RMS9ModelMap.end()) {
|
||||
m->properties["SubModel"]=RMS9ModelMap[j];
|
||||
m->properties["Model"]=RMS9ModelMap[j];
|
||||
}
|
||||
} else {
|
||||
m->properties[i.key()]=i.value();
|
||||
@ -436,27 +436,32 @@ int ResmedLoader::Open(QString & path,Profile *profile)
|
||||
sig=stredf.lookupSignal("Set Pressure");
|
||||
if (sig) {
|
||||
EventDataType pressure=sig->data[dn]*sig->gain;
|
||||
sess->settings[CPAP_Pressure]=pressure;
|
||||
sess->setWavg(CPAP_Pressure,pressure);
|
||||
sess->setAvg(CPAP_Pressure,pressure);
|
||||
sess->set90p(CPAP_Pressure,pressure);
|
||||
sess->setMax(CPAP_Pressure,pressure);
|
||||
sess->setMin(CPAP_Pressure,pressure);
|
||||
sess->settings[CPAP_PressureMin]=pressure;
|
||||
//sess->setWavg(CPAP_Pressure,pressure);
|
||||
//sess->setAvg(CPAP_Pressure,pressure);
|
||||
//sess->set90p(CPAP_Pressure,pressure);
|
||||
//sess->setMax(CPAP_Pressure,pressure);
|
||||
//sess->setMin(CPAP_Pressure,pressure);
|
||||
}
|
||||
} else {
|
||||
if (mode>5) {
|
||||
sess->settings[CPAP_Mode]=MODE_BIPAP;
|
||||
} else {
|
||||
sess->settings[CPAP_Mode]=MODE_APAP;
|
||||
|
||||
}
|
||||
sig=stredf.lookupSignal("Min Pressure");
|
||||
if (sig) {
|
||||
EventDataType pressure=sig->data[dn]*sig->gain;
|
||||
sess->settings[CPAP_PressureMin]=pressure;
|
||||
sess->setMin(CPAP_Pressure,pressure);
|
||||
}
|
||||
sig=stredf.lookupSignal("Max Pressure");
|
||||
if (sig) {
|
||||
EventDataType pressure=sig->data[dn]*sig->gain;
|
||||
sess->settings[CPAP_PressureMax]=pressure;
|
||||
sess->setMax(CPAP_Pressure,pressure);
|
||||
}
|
||||
|
||||
sig=stredf.lookupSignal(CPAP_PressureMin);
|
||||
if (sig)
|
||||
sess->setMin(CPAP_Pressure,sig->data[dn]*sig->gain);
|
||||
|
||||
sig=stredf.lookupSignal(CPAP_PressureMax);
|
||||
if (sig)
|
||||
sess->setMax(CPAP_Pressure,sig->data[dn]*sig->gain);
|
||||
}
|
||||
|
||||
}
|
||||
@ -805,21 +810,21 @@ bool ResmedLoader::LoadPLD(Session *sess,EDFParser &edf)
|
||||
void ResInitModelMap()
|
||||
{
|
||||
// Courtesy Troy Schultz
|
||||
RMS9ModelMap[36001]="ResMed S9 Escape";
|
||||
RMS9ModelMap[36002]="ResMed S9 Escape Auto";
|
||||
RMS9ModelMap[36003]="ResMed S9 Elite";
|
||||
RMS9ModelMap[36004]="ResMed S9 VPAP S";
|
||||
RMS9ModelMap[36005]="ResMed S9 AutoSet";
|
||||
RMS9ModelMap[36006]="ResMed S9 VPAP Auto";
|
||||
RMS9ModelMap[36007]="ResMed S9 VPAP Adapt";
|
||||
RMS9ModelMap[36008]="ResMed S9 VPAP ST";
|
||||
RMS9ModelMap[36001]="S9 Escape";
|
||||
RMS9ModelMap[36002]="S9 Escape Auto";
|
||||
RMS9ModelMap[36003]="S9 Elite";
|
||||
RMS9ModelMap[36004]="S9 VPAP S";
|
||||
RMS9ModelMap[36005]="S9 AutoSet";
|
||||
RMS9ModelMap[36006]="S9 VPAP Auto";
|
||||
RMS9ModelMap[36007]="S9 VPAP Adapt";
|
||||
RMS9ModelMap[36008]="S9 VPAP ST";
|
||||
/* S8 Series
|
||||
RMS9ModelMap[33007]="ResMed S8 Escape";
|
||||
RMS9ModelMap[33039]="ResMed S8 Elite II";
|
||||
RMS9ModelMap[33051]="ResMed S8 Escape II";
|
||||
RMS9ModelMap[33064]="ResMed S8 Escape II AutoSet";
|
||||
RMS9ModelMap[33064]="ResMed S8 Escape II AutoSet";
|
||||
RMS9ModelMap[33129]="ResMed S8 AutoSet II";
|
||||
RMS9ModelMap[33007]="S8 Escape";
|
||||
RMS9ModelMap[33039]="S8 Elite II";
|
||||
RMS9ModelMap[33051]="S8 Escape II";
|
||||
RMS9ModelMap[33064]="S8 Escape II AutoSet";
|
||||
RMS9ModelMap[33064]="S8 Escape II AutoSet";
|
||||
RMS9ModelMap[33129]="S8 AutoSet II";
|
||||
*/
|
||||
|
||||
resmed_codes[CPAP_FlowRate].push_back("Flow");
|
||||
|
@ -64,7 +64,7 @@ const QString PRS1_FlexSet="FlexSet";
|
||||
const QString CPAP_Mode="PAPMode";
|
||||
const QString CPAP_BrokenSummary="BrokenSummary";
|
||||
const QString CPAP_PressureMin="PressureMin";
|
||||
const QString CPAP_PressureMax="PressureMin";
|
||||
const QString CPAP_PressureMax="PressureMax";
|
||||
const QString CPAP_RampTime="RampTime";
|
||||
const QString CPAP_RampPressure="RampPressure";
|
||||
const QString CPAP_Obstructive="Obstructive";
|
||||
|
16
daily.cpp
16
daily.cpp
@ -691,15 +691,27 @@ void Daily::Load(QDate date)
|
||||
//float p90=cpap->p90(CPAP_Pressure);
|
||||
//eap90=cpap->p90(CPAP_EPAP);
|
||||
//iap90=cpap->p90(CPAP_IPAP);
|
||||
QString submodel=tr("Unknown Model");
|
||||
QString submodel; //=tr("Unknown Model");
|
||||
|
||||
//html+="<tr><td colspan=4 align=center><i>"+tr("Machine Information")+"</i></td></tr>\n";
|
||||
if (cpap->machine->properties.find("SubModel")!=cpap->machine->properties.end())
|
||||
submodel=" <br>"+cpap->machine->properties["SubModel"];
|
||||
submodel=" <br/>"+cpap->machine->properties["SubModel"];
|
||||
html+="<tr><td colspan=4 align=center><b>"+cpap->machine->properties["Brand"]+"</b> <br>"+cpap->machine->properties["Model"]+" "+cpap->machine->properties["ModelNumber"]+submodel+"</td></tr>\n";
|
||||
if (PROFILE.Exists("ShowSerialNumbers") && PROFILE["ShowSerialNumbers"].toBool()) {
|
||||
html+="<tr><td colspan=4 align=center>"+cpap->machine->properties["Serial"]+"</td></tr>\n";
|
||||
}
|
||||
CPAPMode mode=(CPAPMode)cpap->settings_max(CPAP_Mode);
|
||||
html+="<tr><td colspan=4 align=center>Mode: ";
|
||||
|
||||
EventDataType min=cpap->settings_min(CPAP_PressureMin);
|
||||
EventDataType max=cpap->settings_max(CPAP_PressureMax);
|
||||
if (mode==MODE_CPAP) html+="CPAP "+QString::number(min)+"cmH2O";
|
||||
else if (mode==MODE_APAP) html+="APAP "+QString::number(min)+"-"+QString::number(max)+"cmH2O";
|
||||
else if (mode==MODE_BIPAP) html+="Bi-Level";
|
||||
else if (mode==MODE_ASV) html+="ASV";
|
||||
else html+="Unknown";
|
||||
html+="</td></tr>\n";
|
||||
|
||||
|
||||
html+="<tr><td align='center'><b>Date</b></td><td align='center'><b>"+tr("Sleep")+"</b></td><td align='center'><b>"+tr("Wake")+"</b></td><td align='center'><b>"+tr("Hours")+"</b></td></tr>";
|
||||
int tt=qint64(cpap->total_time())/1000L;
|
||||
|
@ -810,8 +810,8 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
|
||||
QString title=name+" Report";
|
||||
//QTextOption t_op(Qt::AlignCenter);
|
||||
painter.setFont(*bigfont);
|
||||
QRectF bounds=painter.boundingRect(QRectF(0,0,res.width(),0),title,QTextOption(Qt::AlignCenter));
|
||||
painter.drawText(bounds,title,QTextOption(Qt::AlignCenter));
|
||||
QRectF bounds=painter.boundingRect(QRectF(0,0,res.width(),0),title,QTextOption(Qt::AlignHCenter | Qt::AlignTop));
|
||||
painter.drawText(bounds,title,QTextOption(Qt::AlignHCenter | Qt::AlignTop));
|
||||
painter.setFont(*defaultfont);
|
||||
top=bounds.height();
|
||||
//top+=15*yscale; //spacer
|
||||
@ -827,7 +827,7 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
|
||||
if (bounds.height()>maxy) maxy=bounds.height();
|
||||
}
|
||||
if (name=="Daily") {
|
||||
QString cpapinfo="Date: "+date.toString(Qt::SystemLocaleLongDate)+"\n";
|
||||
QString cpapinfo=date.toString(Qt::SystemLocaleLongDate)+"\n\n";
|
||||
Day *cpap=PROFILE.GetDay(date,MT_CPAP);
|
||||
if (cpap) {
|
||||
time_t f=cpap->first()/1000L;
|
||||
@ -837,9 +837,22 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
|
||||
int m=(tt/60)%60;
|
||||
int s=tt % 60;
|
||||
|
||||
cpapinfo+="Mask Time: "+QString().sprintf("%2i hours %2i minutes, %2i seconds",h,m,s)+"\n";
|
||||
cpapinfo+="Bedtime: "+QDateTime::fromTime_t(f).time().toString("HH:mm:ss")+"\n";
|
||||
cpapinfo+="Mask Time: "+QString().sprintf("%2i hours, %2i minutes, %2i seconds",h,m,s)+"\n";
|
||||
cpapinfo+="Bedtime: "+QDateTime::fromTime_t(f).time().toString("HH:mm:ss")+" ";
|
||||
cpapinfo+="Wake-up: "+QDateTime::fromTime_t(l).time().toString("HH:mm:ss")+"\n\n";
|
||||
QString submodel;
|
||||
cpapinfo+="Machine: ";
|
||||
if (cpap->machine->properties.find("SubModel")!=cpap->machine->properties.end())
|
||||
submodel="\n"+cpap->machine->properties["SubModel"];
|
||||
cpapinfo+=cpap->machine->properties["Brand"]+" "+cpap->machine->properties["Model"]+submodel;
|
||||
CPAPMode mode=(CPAPMode)cpap->settings_max(CPAP_Mode);
|
||||
cpapinfo+="\nMode: ";
|
||||
|
||||
if (mode==MODE_CPAP) cpapinfo+="CPAP";
|
||||
else if (mode==MODE_APAP) cpapinfo+="Auto-PAP";
|
||||
else if (mode==MODE_BIPAP) cpapinfo+="Bi-Level";
|
||||
else if (mode==MODE_ASV) cpapinfo+="ASV";
|
||||
|
||||
float ahi=(cpap->count(CPAP_Obstructive)+cpap->count(CPAP_Hypopnea)+cpap->count(CPAP_ClearAirway)+cpap->count(CPAP_Apnea))/cpap->hours();
|
||||
float csr=(100.0/cpap->hours())*(cpap->sum(CPAP_CSR)/3600.0);
|
||||
float uai=cpap->count(CPAP_Apnea)/cpap->hours();
|
||||
@ -994,7 +1007,7 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
|
||||
PROFILE["UseAntiAliasing"]=aa_setting;
|
||||
QPixmap pm2=pm.scaledToWidth(pw);
|
||||
painter.drawPixmap(0,top,pm2.width(),pm2.height(),pm2);
|
||||
top+=ph; //pm2.height();
|
||||
top+=pm2.height();
|
||||
|
||||
gcnt++;
|
||||
if (qprogress) {
|
||||
|
Loading…
Reference in New Issue
Block a user