From 44d0256bbc41264e6f48c66f3caefe6e683b2fde Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sat, 31 Dec 2011 21:36:19 +1000 Subject: [PATCH] More CPAP/VPAP Fixes, (so much for the database being 'ready' :) --- SleepLib/loader_plugins/intellipap_loader.cpp | 10 +- SleepLib/loader_plugins/prs1_loader.cpp | 10 +- SleepLib/loader_plugins/resmed_loader.cpp | 10 +- SleepLib/schema.cpp | 1 + SleepLib/session.cpp | 5 +- daily.cpp | 40 ++-- mainwindow.cpp | 185 ++++++++++++------ overview.cpp | 2 +- 8 files changed, 170 insertions(+), 93 deletions(-) diff --git a/SleepLib/loader_plugins/intellipap_loader.cpp b/SleepLib/loader_plugins/intellipap_loader.cpp index c955364d..c1e66bc5 100644 --- a/SleepLib/loader_plugins/intellipap_loader.cpp +++ b/SleepLib/loader_plugins/intellipap_loader.cpp @@ -252,8 +252,8 @@ int IntellipapLoader::Open(QString & path,Profile *profile) int rr=m_buffer[pos+0xa]; sess->eventlist[CPAP_RespRate][0]->AddEvent(time,rr); // Respiratory Rate - sess->eventlist[CPAP_Te][0]->AddEvent(time,m_buffer[pos+0xf]); // - sess->eventlist[CPAP_Ti][0]->AddEvent(time,m_buffer[pos+0xc]); + sess->eventlist[INTELLIPAP_Unknown1][0]->AddEvent(time,m_buffer[pos+0xf]); // + sess->eventlist[INTELLIPAP_Unknown1][0]->AddEvent(time,m_buffer[pos+0xc]); sess->eventlist[CPAP_Snore][0]->AddEvent(time,m_buffer[pos+0x4]); //4/5?? @@ -321,7 +321,8 @@ int IntellipapLoader::Open(QString & path,Profile *profile) quint64 last=qint64(SessionEnd[i])*1000L; sess->settings[CPAP_PresReliefType]=(PRTypes)PR_SMARTFLEX; - sess->settings[CPAP_PresReliefSet]=set1["SmartFlex"].toInt(); + int i=set1["SmartFlex"].toInt(); + sess->settings[CPAP_PresReliefSet]=i; int sfm=set1["SmartFlexMode"].toInt(); if (sfm==0) { sess->settings[CPAP_PresReliefMode]=PM_FullTime; @@ -334,8 +335,7 @@ int IntellipapLoader::Open(QString & path,Profile *profile) EventDataType pres=sess->Min(CPAP_Pressure); if (max==min) { sess->settings[CPAP_Mode]=(int)MODE_CPAP; - sess->settings[CPAP_PressureMin]=min; - sess->settings[CPAP_PressureMax]=min; + sess->settings[CPAP_Pressure]=min; } else { sess->settings[CPAP_Mode]=(int)MODE_APAP; sess->settings[CPAP_PressureMin]=min; diff --git a/SleepLib/loader_plugins/prs1_loader.cpp b/SleepLib/loader_plugins/prs1_loader.cpp index ea21ba89..7c7fa535 100644 --- a/SleepLib/loader_plugins/prs1_loader.cpp +++ b/SleepLib/loader_plugins/prs1_loader.cpp @@ -457,10 +457,7 @@ bool PRS1Loader::ParseSummary(Machine *mach, qint32 sequence, quint32 timestamp, EventDataType max,min; 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.. @@ -471,7 +468,12 @@ bool PRS1Loader::ParseSummary(Machine *mach, qint32 sequence, quint32 timestamp, if (max>0) { // Ignoring bipap until I see some more data. session->settings[CPAP_Mode]=(int)MODE_APAP; - } else session->settings[CPAP_Mode]=(int)MODE_CPAP; + session->settings[CPAP_PressureMin]=(double)min; + session->settings[CPAP_PressureMax]=(double)max; + } else { + session->settings[CPAP_Mode]=(int)MODE_CPAP; + session->settings[CPAP_Pressure]=(double)min; + } // This is incorrect.. if (data[offset+0x08] & 0x80) { // Flex Setting diff --git a/SleepLib/loader_plugins/resmed_loader.cpp b/SleepLib/loader_plugins/resmed_loader.cpp index 252a907f..3ae10ab5 100644 --- a/SleepLib/loader_plugins/resmed_loader.cpp +++ b/SleepLib/loader_plugins/resmed_loader.cpp @@ -621,7 +621,7 @@ int ResmedLoader::Open(QString & path,Profile *profile) sig=stredf.lookupSignal(RMS9_SetPressure); // ?? What's meant by Set Pressure? if (sig) { EventDataType pressure=sig->data[dn]*sig->gain; - sess->settings[CPAP_PressureMin]=pressure; + sess->settings[CPAP_Pressure]=pressure; } } else { // VPAP or Auto if (mode>5) { @@ -685,13 +685,13 @@ int ResmedLoader::Open(QString & path,Profile *profile) if (sig) { EventDataType pressure=sig->data[dn]*sig->gain; sess->settings[CPAP_PressureMin]=pressure; - sess->setMin(CPAP_Pressure,pressure); + //sess->setMin(CPAP_Pressure,pressure); } sig=stredf.lookupSignal(CPAP_PressureMax); if (sig) { EventDataType pressure=sig->data[dn]*sig->gain; sess->settings[CPAP_PressureMax]=pressure; - sess->setMax(CPAP_Pressure,pressure); + //sess->setMax(CPAP_Pressure,pressure); } } @@ -1058,13 +1058,13 @@ int ResmedLoader::Open(QString & path,Profile *profile) if (sig) { EventDataType pressure=sig->data[dn]*sig->gain; sess->settings[CPAP_PressureMin]=pressure; - sess->setMin(CPAP_Pressure,pressure); + //sess->setMin(CPAP_Pressure,pressure); } sig=stredf.lookupSignal(CPAP_PressureMax); if (sig) { EventDataType pressure=sig->data[dn]*sig->gain; sess->settings[CPAP_PressureMax]=pressure; - sess->setMax(CPAP_Pressure,pressure); + //sess->setMax(CPAP_Pressure,pressure); } } diff --git a/SleepLib/schema.cpp b/SleepLib/schema.cpp index 67509a54..ed67bd2c 100644 --- a/SleepLib/schema.cpp +++ b/SleepLib/schema.cpp @@ -73,6 +73,7 @@ void init() CPAP_PSMax=schema::channel["PSMax"].id(); CPAP_Mode=schema::channel["PAPMode"].id(); CPAP_BrokenSummary=schema::channel["BrokenSummary"].id(); + CPAP_BrokenWaveform=schema::channel["BrokenWaveform"].id(); CPAP_PressureMin=schema::channel["PressureMin"].id(); CPAP_PressureMax=schema::channel["PressureMax"].id(); CPAP_RampTime=schema::channel["RampTime"].id(); diff --git a/SleepLib/session.cpp b/SleepLib/session.cpp index 20511da7..7e76ed2c 100644 --- a/SleepLib/session.cpp +++ b/SleepLib/session.cpp @@ -615,7 +615,10 @@ void Session::UpdateSummaries() EventDataType gain=el->gain(); m_gain[id]=gain; } else m_gain[id]=0; - updateCountSummary(id); + + if ((id!=CPAP_FlowRate) && (id!=CPAP_MaskPressure)) + updateCountSummary(id); + Min(id); Max(id); count(id); diff --git a/daily.cpp b/daily.cpp index 42a1964b..f469348f 100644 --- a/daily.cpp +++ b/daily.cpp @@ -762,7 +762,7 @@ void Daily::Load(QDate date) html+="Mode: "; if (mode==MODE_CPAP) { - EventDataType min=cpap->settings_min(CPAP_PressureMin); + EventDataType min=round(cpap->settings_wavg(CPAP_Pressure)*2)/2.0; html+=tr("CPAP")+" "+QString::number(min)+STR_UNIT_CMH2O; } else if (mode==MODE_APAP) { EventDataType min=cpap->settings_min(CPAP_PressureMin); @@ -978,31 +978,32 @@ void Daily::Load(QDate date) // html+=""; html+=QString("").arg(tr("Machine Settings")); html+=""; - if (cpap->machine->GetClass()==STR_MACH_PRS1) { - int i=cpap->settings_max(PRS1_FlexMode); - int j=cpap->settings_max(PRS1_FlexSet); - QString flexstr=(i>1) ? schema::channel[PRS1_FlexMode].option(i)+" "+schema::channel[PRS1_FlexSet].option(j) : "None"; + int i=cpap->settings_max(CPAP_PresReliefType); + int j=cpap->settings_max(CPAP_PresReliefSet); + QString flexstr=(i>1) ? schema::channel[CPAP_PresReliefType].option(i)+" x"+QString::number(j) : "None"; - html+=QString("").arg(tr("Flex")) + html+=QString("").arg(tr("Pr. Relief")) .arg(flexstr); - int humid=round(cpap->settings_wavg(PRS1_HumidSetting)); - html+=QString("").arg(tr("Humidifier")) + if (cpap->machine->GetClass()==STR_MACH_PRS1) { + int humid=round(cpap->settings_wavg(PRS1_HumidSetting)); + html+=QString("").arg(tr("Humidifier")) .arg(humid==0 ? STR_GEN_Off : "x"+QString::number(humid)); - } else if (cpap->machine->GetClass()==STR_MACH_ResMed) { + } + /*} else if (cpap->machine->GetClass()==STR_MACH_ResMed) { int epr=cpap->settings_max(RMS9_EPR); int epr2=cpap->settings_max(RMS9_EPRSet); html+=QString("") .arg(tr("EPR")).arg(epr).arg(epr2); - } + }*/ } html+="
%1

%1%2
%1%2
%1%2
%1%2
%1%2 / %3
"; if (cpap || oxi) { html+=""; - html+=""; + html+=""; html+=QString("").arg(tr("Session Information")); - html+=""; + html+=""; QDateTime fd,ld; bool corrupted_waveform=false; QString tooltip; @@ -1013,7 +1014,7 @@ void Daily::Load(QDate date) .arg(tr("Start")) .arg(tr("End")); if (cpap) { - html+=QString("").arg(tr("CPAP Sessions")); + html+=QString("").arg(tr("CPAP Sessions")); for (QVector::iterator s=cpap->begin();s!=cpap->end();s++) { fd=QDateTime::fromTime_t((*s)->first()/1000L); ld=QDateTime::fromTime_t((*s)->last()/1000L); @@ -1021,11 +1022,11 @@ void Daily::Load(QDate date) int h=len/3600; int m=(len/60) % 60; int s1=len % 60; - QHash::iterator i=(*s)->settings.find(CPAP_BrokenWaveform); tooltip=cpap->machine->GetClass()+" "+tr("CPAP")+" "+QString().sprintf("%2ih, %2im, %2is",h,m,s1); // tooltip needs to lookup language.. :-/ - if ((i!=(*s)->settings.end()) && i.value().toBool()) corrupted_waveform=true; + QHash::iterator i=(*s)->settings.find(CPAP_BrokenWaveform); + corrupted_waveform=(i!=(*s)->settings.end()) && i.value().toBool(); Session *sess=*s; if (!sess->settings.contains(SESSION_ENABLED)) { sess->settings[SESSION_ENABLED]=true; @@ -1041,8 +1042,9 @@ void Daily::Load(QDate date) .arg(ld.toString("HH:mm")); } } + if (oxi) { - html+=QString("").arg(tr("Oximetry Sessions")); + html+=QString("").arg(tr("Oximetry Sessions")); for (QVector::iterator s=oxi->begin();s!=oxi->end();s++) { fd=QDateTime::fromTime_t((*s)->first()/1000L); ld=QDateTime::fromTime_t((*s)->last()/1000L); @@ -1050,7 +1052,6 @@ void Daily::Load(QDate date) int h=len/3600; int m=(len/60) % 60; int s1=len % 60; - QHash::iterator i=(*s)->settings.find(CPAP_BrokenWaveform); tooltip=oxi->machine->GetClass()+" "+tr("Oximeter")+" "+QString().sprintf("%2ih, %2im, %2is",h,m,s1); Session *sess=*s; @@ -1059,7 +1060,8 @@ void Daily::Load(QDate date) } bool b=sess->settings[SESSION_ENABLED].toBool(); - if ((i!=(*s)->settings.end()) && i.value().toBool()) corrupted_waveform=true; + QHash::iterator i=(*s)->settings.find(CPAP_BrokenWaveform); + corrupted_waveform=(i!=(*s)->settings.end()) && i.value().toBool(); html+=QString("") .arg((*s)->session()) .arg(tooltip) @@ -1073,7 +1075,7 @@ void Daily::Load(QDate date) } } if (corrupted_waveform) { - html+=QString("").arg(tr("One or more waveform record for this session had faulty source data. Some waveform overlay points may not match up correctly.")); + html+=QString("").arg(tr("One or more waveform record for this session had faulty source data. Some waveform overlay points may not match up correctly.")); } html+="
 
 
%1


%1
%1
%1
%1
%3%2%5%6%7
%1
%1

"; } diff --git a/mainwindow.cpp b/mainwindow.cpp index 81a24723..941e100e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -419,6 +419,8 @@ struct RXChange mode=copy.mode; min=copy.min; max=copy.max; + maxhi=copy.maxhi; + machine=copy.machine; per1=copy.per1; per2=copy.per2; highlight=copy.highlight; @@ -433,48 +435,52 @@ struct RXChange CPAPMode mode; EventDataType min; EventDataType max; + EventDataType maxhi; EventDataType per1; EventDataType per2; EventDataType weighted; PRTypes prelief; + Machine * machine; short prelset; short highlight; }; -enum RXSortMode { RX_first, RX_last, RX_days, RX_ahi, RX_mode, RX_min, RX_max, RX_per1, RX_per2, RX_weighted }; +enum RXSortMode { RX_first, RX_last, RX_days, RX_ahi, RX_mode, RX_min, RX_max, RX_maxhi, RX_per1, RX_per2, RX_weighted }; RXSortMode RXsort=RX_first; bool RXorder=false; -bool operator<(const RXChange & comp1, const RXChange & comp2) { - if (RXorder) { - switch (RXsort) { - case RX_ahi: return comp1.ahi < comp2.ahi; - case RX_days: return comp1.days < comp2.days; - case RX_first: return comp1.first < comp2.first; - case RX_last: return comp1.last < comp2.last; - case RX_mode: return comp1.mode < comp2.mode; - case RX_min: return comp1.min < comp2.min; - case RX_max: return comp1.max < comp2.max; - case RX_per1: return comp1.per1 < comp2.per1; - case RX_per2: return comp1.per2 < comp2.per2; - case RX_weighted: return comp1.weighted < comp2.weighted; - }; - } else { - switch (RXsort) { - case RX_ahi: return comp1.ahi > comp2.ahi; - case RX_days: return comp1.days > comp2.days; - case RX_first: return comp1.first > comp2.first; - case RX_last: return comp1.last > comp2.last; - case RX_mode: return comp1.mode > comp2.mode; - case RX_min: return comp1.min > comp2.min; - case RX_max: return comp1.max > comp2.max; - case RX_per1: return comp1.per1 > comp2.per1; - case RX_per2: return comp1.per2 > comp2.per2; - case RX_weighted: return comp1.weighted > comp2.weighted; - }; - } - return true; -} +//bool operator<(const RXChange & comp1, const RXChange & comp2) { +// if (RXorder) { +// switch (RXsort) { +// case RX_ahi: return comp1.ahi < comp2.ahi; +// case RX_days: return comp1.days < comp2.days; +// case RX_first: return comp1.first < comp2.first; +// case RX_last: return comp1.last < comp2.last; +// case RX_mode: return comp1.mode < comp2.mode; +// case RX_min: return comp1.min < comp2.min; +// case RX_max: return comp1.max < comp2.max; +// case RX_maxhi: return comp1.maxhi < comp2.maxhi; +// case RX_per1: return comp1.per1 < comp2.per1; +// case RX_per2: return comp1.per2 < comp2.per2; +// case RX_weighted: return comp1.weighted < comp2.weighted; +// }; +// } else { +// switch (RXsort) { +// case RX_ahi: return comp1.ahi > comp2.ahi; +// case RX_days: return comp1.days > comp2.days; +// case RX_first: return comp1.first > comp2.first; +// case RX_last: return comp1.last > comp2.last; +// case RX_mode: return comp1.mode > comp2.mode; +// case RX_min: return comp1.min > comp2.min; +// case RX_max: return comp1.max > comp2.max; +// case RX_maxhi: return comp1.maxhi > comp2.maxhi; +// case RX_per1: return comp1.per1 > comp2.per1; +// case RX_per2: return comp1.per2 > comp2.per2; +// case RX_weighted: return comp1.weighted > comp2.weighted; +// }; +// } +// return true; +//} bool RXSort(const RXChange * comp1, const RXChange * comp2) { if (RXorder) { switch (RXsort) { @@ -485,6 +491,7 @@ bool RXSort(const RXChange * comp1, const RXChange * comp2) { case RX_mode: return comp1->mode < comp2->mode; case RX_min: return comp1->min < comp2->min; case RX_max: return comp1->max < comp2->max; + case RX_maxhi: return comp1->maxhi < comp2->maxhi; case RX_per1: return comp1->per1 < comp2->per1; case RX_per2: return comp1->per2 < comp2->per2; case RX_weighted: return comp1->weighted < comp2->weighted; @@ -498,6 +505,7 @@ bool RXSort(const RXChange * comp1, const RXChange * comp2) { case RX_mode: return comp1->mode > comp2->mode; case RX_min: return comp1->min > comp2->min; case RX_max: return comp1->max > comp2->max; + case RX_maxhi: return comp1->maxhi > comp2->maxhi; case RX_per1: return comp1->per1 > comp2->per1; case RX_per2: return comp1->per2 > comp2->per2; case RX_weighted: return comp1->weighted > comp2->weighted; @@ -674,11 +682,11 @@ void MainWindow::on_summaryButton_clicked() } else { html+=QString("%1%2%3%4%5%6") .arg(tr("Pressure")) - .arg(p_profile->calcSettingsMin(CPAP_PressureMin,MT_CPAP),0,'f',3) - .arg(p_profile->calcSettingsMin(CPAP_PressureMin,MT_CPAP,cpapweek,lastcpap),0,'f',3) - .arg(p_profile->calcSettingsMin(CPAP_PressureMin,MT_CPAP,cpapmonth,lastcpap),0,'f',3) - .arg(p_profile->calcSettingsMin(CPAP_PressureMin,MT_CPAP,cpap6month,lastcpap),0,'f',3) - .arg(p_profile->calcSettingsMin(CPAP_PressureMin,MT_CPAP,cpapyear,lastcpap),0,'f',3); + .arg(p_profile->calcSettingsMin(CPAP_Pressure,MT_CPAP),0,'f',3) + .arg(p_profile->calcSettingsMin(CPAP_Pressure,MT_CPAP,cpapweek,lastcpap),0,'f',3) + .arg(p_profile->calcSettingsMin(CPAP_Pressure,MT_CPAP,cpapmonth,lastcpap),0,'f',3) + .arg(p_profile->calcSettingsMin(CPAP_Pressure,MT_CPAP,cpap6month,lastcpap),0,'f',3) + .arg(p_profile->calcSettingsMin(CPAP_Pressure,MT_CPAP,cpapyear,lastcpap),0,'f',3); } //html+="TODO: 90% pressure.. Any point showing if this is all CPAP?"; @@ -795,7 +803,8 @@ void MainWindow::on_summaryButton_clicked() if (cpapdays>0) { QDate first,last=lastcpap; CPAPMode mode,cmode=MODE_UNKNOWN; - EventDataType cmin=0,cmax=0,min,max; + EventDataType cmin=0,cmax=0,cmaxhi=0, min,max,maxhi; + Machine *mach,*lastmach=NULL; PRTypes prelief=PR_UNKNOWN; short prelset=0; QDate date=lastcpap; @@ -826,12 +835,20 @@ void MainWindow::on_summaryButton_clicked() } mode=(CPAPMode)round(day->settings_wavg(CPAP_Mode)); - min=day->settings_min(CPAP_PressureMin); - if (mode==MODE_CPAP) { - max=day->settings_max(CPAP_PressureMin); - } else max=day->settings_max(CPAP_PressureMax); - - if ((mode!=cmode) || (min!=cmin) || (max!=cmax)) { + if (mode>=MODE_ASV) { + min=day->settings_min(CPAP_EPAP); + max=day->settings_max(CPAP_IPAPLo); + maxhi=day->settings_max(CPAP_IPAPHi); + } else if (mode>=MODE_BIPAP) { + min=day->settings_min(CPAP_EPAP); + max=day->settings_max(CPAP_IPAP); + } else if (mode>=MODE_APAP) { + min=day->settings_min(CPAP_PressureMin); + max=day->settings_max(CPAP_PressureMax); + } else { + min=day->settings_min(CPAP_Pressure); + } + if ((mode!=cmode) || (min!=cmin) || (max!=cmax) || (maxhi!=cmaxhi) || (day->machine!=lastmach)) { if (cmode!=MODE_UNKNOWN) { first=date.addDays(1); int days=PROFILE.countDays(MT_CPAP,first,last); @@ -843,14 +860,19 @@ void MainWindow::on_summaryButton_clicked() rx.mode=cmode; rx.min=cmin; rx.max=cmax; + rx.maxhi=cmaxhi; rx.prelief=prelief; rx.prelset=prelset; + if (modecalcPercentile(CPAP_Pressure,percentile,MT_CPAP,first,last); rx.per2=0; - } else { + } else if (modecalcPercentile(CPAP_EPAP,percentile,MT_CPAP,first,last); rx.per2=p_profile->calcPercentile(CPAP_IPAP,percentile,MT_CPAP,first,last); + } else { + rx.per1=p_profile->calcPercentile(CPAP_EPAP,percentile,MT_CPAP,first,last); + rx.per2=p_profile->calcPercentile(CPAP_IPAPHi,percentile,MT_CPAP,first,last); } rx.weighted=float(rx.days)/float(cpapdays)*rx.ahi; rxchange.push_back(rx); @@ -858,7 +880,9 @@ void MainWindow::on_summaryButton_clicked() cmode=mode; cmin=min; cmax=max; + cmaxhi=maxhi; last=date; + lastmach=day->machine; lastchanged=true; } @@ -878,12 +902,16 @@ void MainWindow::on_summaryButton_clicked() rx.mode=mode; rx.min=min; rx.max=max; + rx.maxhi=maxhi; if (modecalcPercentile(CPAP_Pressure,0.9,MT_CPAP,first,last); rx.per2=0; - } else { + } else if (modecalcPercentile(CPAP_EPAP,0.9,MT_CPAP,first,last); rx.per2=p_profile->calcPercentile(CPAP_IPAP,0.9,MT_CPAP,first,last); + } else { + rx.per1=p_profile->calcPercentile(CPAP_EPAP,percentile,MT_CPAP,first,last); + rx.per2=p_profile->calcPercentile(CPAP_IPAPHi,percentile,MT_CPAP,first,last); } rx.weighted=float(rx.days)/float(cpapdays); //rx.weighted=float(days)*rx.ahi; @@ -915,7 +943,7 @@ void MainWindow::on_summaryButton_clicked() if (tmpRX.size()>0) { RXsort=RX_ahi; - QString minstr,maxstr,modestr; + QString minstr,maxstr,modestr,maxhistr; qSort(tmpRX.begin(),tmpRX.end(),RXSort); tmpRX[0]->highlight=4; // worst int ls=tmpRX.size()-1; @@ -930,10 +958,16 @@ void MainWindow::on_summaryButton_clicked() minstr="Min"; maxstr="Max"; modestr=tr("APAP"); - } else { // BIPAP or greater + } else if (mode%3") @@ -944,6 +978,7 @@ void MainWindow::on_summaryButton_clicked() recbox+=QString("%1: %2").arg(tr("Mode")).arg(modestr); recbox+=QString("%1: %2").arg(minstr).arg(tmpRX[ls]->min,0,'f',1); if (!maxstr.isEmpty()) recbox+=QString(" %1: %2").arg(maxstr).arg(tmpRX[ls]->max,0,'f',1); + if (!maxhistr.isEmpty()) recbox+=QString(" %1: %2").arg(maxhistr).arg(tmpRX[0]->maxhi,0,'f',1); recbox+=""; recbox+=QString("%1: %2").arg(tr("Start")).arg(tmpRX[ls]->first.toString(Qt::SystemLocaleShortDate)); @@ -959,10 +994,15 @@ void MainWindow::on_summaryButton_clicked() minstr="Min"; maxstr="Max"; modestr=tr("APAP"); - } else { // BIPAP or greater + } else if (mode%3") @@ -973,6 +1013,7 @@ void MainWindow::on_summaryButton_clicked() recbox+=QString("%1: %2").arg(tr("Mode")).arg(modestr); recbox+=QString("%1: %2").arg(minstr).arg(tmpRX[0]->min,0,'f',1); if (!maxstr.isEmpty()) recbox+=QString(" %1: %2").arg(maxstr).arg(tmpRX[0]->max,0,'f',1); + if (!maxhistr.isEmpty()) recbox+=QString(" %1: %2").arg(maxhistr).arg(tmpRX[0]->maxhi,0,'f',1); recbox+=""; recbox+=QString("%1: %2").arg(tr("Start")).arg(tmpRX[0]->first.toString(Qt::SystemLocaleShortDate)); @@ -986,7 +1027,10 @@ void MainWindow::on_summaryButton_clicked() html+=QString("
Changes to Prescription Settings"); html+=QString(""); QString extratxt; - if (cpapmode>=MODE_BIPAP) { + if (cpapmode>=MODE_ASV) { + extratxt=QString("") + .arg(tr("EPAP")).arg(tr("IPAPLo")).arg(tr("IPAPHi")).arg(tr("%1% EPAP").arg(percentile*100.0)).arg(tr("%1% IPAP").arg(percentile*100.0)); + } else if (cpapmode>=MODE_BIPAP) { extratxt=QString("") .arg(tr("EPAP")).arg(tr("IPAP")).arg(tr("%1% EPAP").arg(percentile*100.0)).arg(tr("%1% IPAP").arg(percentile*100.0)); } else if (cpapmode>MODE_CPAP) { @@ -1016,7 +1060,10 @@ void MainWindow::on_summaryButton_clicked() } else if (rx.highlight==4) { color="#ffc0c0"; } else color=""; - if (cpapmode>=MODE_BIPAP) { + if(cpapmode>=MODE_ASV) { + extratxt=QString("") + .arg(rx.max,0,'f',2).arg(rx.maxhi,0,'f',2).arg(rx.per1,0,'f',2).arg(rx.per2,0,'f',2); + } else if (cpapmode>=MODE_BIPAP) { extratxt=QString("").arg(rx.max,0,'f',2).arg(rx.per1,0,'f',2).arg(rx.per2,0,'f',2); } else if (cpapmode>MODE_CPAP) { extratxt=QString("").arg(rx.max,0,'f',2).arg(rx.per1,0,'f',2); @@ -1548,13 +1595,35 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date) CPAPMode mode=(CPAPMode)(int)cpap->settings_max(CPAP_Mode); cpapinfo+=tr("\nMode: "); - EventDataType min=cpap->settings_min(CPAP_PressureMin); - EventDataType max=cpap->settings_max(CPAP_PressureMax); - - if (mode==MODE_CPAP) cpapinfo+=tr("CPAP %1cmH2O").arg(min); - else if (mode==MODE_APAP) cpapinfo+=tr("APAP %1-%2cmH2O").arg(min).arg(max); - else if (mode==MODE_BIPAP) cpapinfo+=tr("Bi-Level %1-%2cmH2O").arg(min).arg(max); - else if (mode==MODE_ASV) cpapinfo+=tr("ASV"); + if (mode==MODE_CPAP) { + EventDataType min=round(cpap->settings_wavg(CPAP_Pressure)*2)/2.0; + cpapinfo+=tr("CPAP")+" "+QString::number(min)+STR_UNIT_CMH2O; + } else if (mode==MODE_APAP) { + EventDataType min=cpap->settings_min(CPAP_PressureMin); + EventDataType max=cpap->settings_max(CPAP_PressureMax); + cpapinfo+=tr("APAP")+" "+QString::number(min)+"-"+QString::number(max)+STR_UNIT_CMH2O; + } else if (mode==MODE_BIPAP) { + EventDataType epap=cpap->settings_min(CPAP_EPAP); + EventDataType ipap=cpap->settings_max(CPAP_IPAP); + EventDataType ps=cpap->settings_max(CPAP_PS); + cpapinfo+=tr("Bi-Level")+QString("\nEPAP: %1 IPAP: %2 %3\nPS: %4") + .arg(epap,0,'f',1).arg(ipap,0,'f',1).arg(STR_UNIT_CMH2O).arg(ps,0,'f',1); + } + else if (mode==MODE_ASV) { + EventDataType epap=cpap->settings_min(CPAP_EPAP); + EventDataType low=cpap->settings_min(CPAP_IPAPLo); + EventDataType high=cpap->settings_max(CPAP_IPAPHi); + EventDataType psl=cpap->settings_min(CPAP_PSMin); + EventDataType psh=cpap->settings_max(CPAP_PSMax); + cpapinfo+=tr("ASV")+QString("\nEPAP: %1 IPAP: %2 - %3 %4\nPS: %5 / %6") + .arg(epap,0,'f',1) + .arg(low,0,'f',1) + .arg(high,0,'f',1) + .arg(STR_UNIT_CMH2O) + .arg(psl,0,'f',1) + .arg(psh,0,'f',1); + } + else cpapinfo+=tr("Unknown"); float ahi=(cpap->count(CPAP_Obstructive)+cpap->count(CPAP_Hypopnea)+cpap->count(CPAP_ClearAirway)+cpap->count(CPAP_Apnea)); if (PROFILE.general->calculateRDI()) ahi+=cpap->count(CPAP_RERA); diff --git a/overview.cpp b/overview.cpp index 81e6584c..e87b8439 100644 --- a/overview.cpp +++ b/overview.cpp @@ -231,7 +231,7 @@ Overview::Overview(QWidget *parent,gGraphView * shared) : pr->addSlice(CPAP_Pressure,QColor("grey"),ST_PERC,true,0.95); } else { - pr->addSlice(CPAP_PressureMin,QColor("grey"),ST_SETWAVG,true); + pr->addSlice(CPAP_Pressure,QColor("grey"),ST_SETWAVG,true); } PR->AddLayer(pr);
%1%2%3%4%5%1%2%3%4%1%2%3%4%1%2%3%1%2