mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 10:40:42 +00:00
RDI Calcs preference for PRS1 Users, Made Summary more BIPAP aware, Added IPAP/EAP 90% to Overview chart, VSnore 2 reenabled for PRS1 CPAP mode, hide flow limitations for PRS1 CPAP mode.
This commit is contained in:
parent
39de03d2f5
commit
23c936fc3f
@ -576,12 +576,15 @@ void AHIChart::SetDay(Day *d)
|
||||
if (sess->eventlist.contains(CPAP_NRI))
|
||||
el[4]=sess->eventlist[CPAP_NRI][0];
|
||||
else el[4]=NULL;
|
||||
/*if (sess->eventlist.contains(CPAP_ExP))
|
||||
el[5]=sess->eventlist[CPAP_ExP][0];
|
||||
else el[5]=NULL;*/
|
||||
|
||||
int znt=5;
|
||||
if (PROFILE.general->calculateRDI()) {
|
||||
if (sess->eventlist.contains(CPAP_RERA)) {// What about ExP??
|
||||
el[5]=sess->eventlist[CPAP_RERA][0];
|
||||
znt++;
|
||||
} else el[5]=NULL;
|
||||
}
|
||||
qint64 t;
|
||||
for (int i=0;i<5;i++) {
|
||||
for (int i=0;i<znt;i++) {
|
||||
if (!el[i]) continue;
|
||||
for (quint32 j=0;j<el[i]->count();j++) {
|
||||
t=el[i]->time(j);
|
||||
|
@ -421,7 +421,7 @@ CPAP_ClearAirway, CPAP_Apnea, CPAP_CSR, CPAP_LeakFlag, CPAP_ExP, CPAP_NRI, CPAP_
|
||||
CPAP_RERA, CPAP_PressurePulse, CPAP_FlowLimit, CPAP_FlowRate, CPAP_MaskPressure, CPAP_MaskPressureHi,
|
||||
CPAP_RespEvent, CPAP_Snore, CPAP_MinuteVent, CPAP_RespRate, CPAP_TidalVolume, CPAP_PTB, CPAP_Leak,
|
||||
CPAP_LeakMedian, CPAP_LeakTotal, CPAP_MaxLeak, CPAP_FLG, CPAP_IE, CPAP_Te, CPAP_Ti, CPAP_TgMV,
|
||||
CPAP_UserFlag1, CPAP_UserFlag2, CPAP_BrokenSummary, CPAP_BrokenWaveform;
|
||||
CPAP_UserFlag1, CPAP_UserFlag2, CPAP_BrokenSummary, CPAP_BrokenWaveform, CPAP_RDI;
|
||||
|
||||
ChannelID RMS9_E01, RMS9_E02, RMS9_EPR, RMS9_EPRSet, RMS9_SetPressure;
|
||||
ChannelID INTP_SmartFlex;
|
||||
|
@ -84,7 +84,7 @@ CPAP_ClearAirway, CPAP_Apnea, CPAP_CSR, CPAP_LeakFlag, CPAP_ExP, CPAP_NRI, CPAP_
|
||||
CPAP_RERA, CPAP_PressurePulse, CPAP_FlowLimit, CPAP_FlowRate, CPAP_MaskPressure, CPAP_MaskPressureHi,
|
||||
CPAP_RespEvent, CPAP_Snore, CPAP_MinuteVent, CPAP_RespRate, CPAP_TidalVolume, CPAP_PTB, CPAP_Leak,
|
||||
CPAP_LeakMedian, CPAP_LeakTotal, CPAP_MaxLeak, CPAP_FLG, CPAP_IE, CPAP_Te, CPAP_Ti, CPAP_TgMV,
|
||||
CPAP_UserFlag1, CPAP_UserFlag2, CPAP_BrokenSummary, CPAP_BrokenWaveform;
|
||||
CPAP_UserFlag1, CPAP_UserFlag2, CPAP_BrokenSummary, CPAP_BrokenWaveform, CPAP_RDI;
|
||||
|
||||
extern ChannelID RMS9_E01, RMS9_E02, RMS9_EPR, RMS9_EPRSet, RMS9_SetPressure;
|
||||
extern ChannelID INTP_SmartFlex;
|
||||
|
@ -239,7 +239,11 @@ void Profile::AddDay(QDate date,Day *day,MachineType mt) {
|
||||
QList<Day *> & dl=daylist[date];
|
||||
for (QList<Day *>::iterator a=dl.begin();a!=dl.end();a++) {
|
||||
if ((*a)->machine->GetType()==mt) {
|
||||
throw OneTypePerDay();
|
||||
if (QMessageBox::question(NULL,"Different Machine Detected","This data comes from another machine to what's usually imported, and has overlapping data.\nThis new data will override any older data from the old machine. Are you sure you want to do this?",QMessageBox::Yes,QMessageBox::No)==QMessageBox::No) {
|
||||
throw OneTypePerDay();
|
||||
}
|
||||
daylist[date].erase(a);
|
||||
break;
|
||||
}
|
||||
}
|
||||
daylist[date].push_back(day);
|
||||
@ -543,6 +547,7 @@ const char * US_STR_SkipEmptyDays="SkipEmptyDays";
|
||||
const char * US_STR_RebuildCache="RebuildCache";
|
||||
const char * US_STR_ShowDebug="ShowDebug";
|
||||
const char * US_STR_LinkGroups="LinkGroups";
|
||||
const char * US_STR_CalculateRDI="CalculateRDI";
|
||||
|
||||
int Profile::countDays(MachineType mt, QDate start, QDate end)
|
||||
{
|
||||
@ -791,11 +796,37 @@ EventDataType Profile::calcPercentile(ChannelID code, EventDataType percent, Mac
|
||||
// }
|
||||
// }
|
||||
|
||||
if (array.size()==0) return 0;
|
||||
/*if (array.size()==0) return 0;
|
||||
qSort(array);
|
||||
|
||||
|
||||
int idx=array.size()*percent;
|
||||
if (idx>array.size()-1) idx=array.size()-1;
|
||||
return array[idx];
|
||||
return array[idx]; */
|
||||
|
||||
|
||||
int size=array.size();
|
||||
if (!size)
|
||||
return 0;
|
||||
size--;
|
||||
qSort(array);
|
||||
int p=EventDataType(size)*percent;
|
||||
float p2=EventDataType(size)*percent;
|
||||
float diff=p2-p;
|
||||
EventDataType val=array[p];
|
||||
if (diff>0) {
|
||||
int s=p+1;
|
||||
if (s>size-1) s=size-1;
|
||||
EventDataType v2=array[s];
|
||||
EventDataType v3=v2-val;
|
||||
if (v3>0) {
|
||||
val+=v3*diff;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return val;
|
||||
|
||||
}
|
||||
|
||||
QDate Profile::FirstDay(MachineType mt)
|
||||
|
@ -512,6 +512,7 @@ extern const char * US_STR_SkipEmptyDays;
|
||||
extern const char * US_STR_RebuildCache;
|
||||
extern const char * US_STR_ShowDebug;
|
||||
extern const char * US_STR_LinkGroups;
|
||||
extern const char * US_STR_CalculateRDI;
|
||||
|
||||
/*! \class UserSettings
|
||||
\brief Profile Options relating to General User Settings
|
||||
@ -528,6 +529,7 @@ public:
|
||||
if (!m_profile->contains(US_STR_RebuildCache)) (*m_profile)[US_STR_RebuildCache]=false; // can't remember..
|
||||
if (!m_profile->contains(US_STR_ShowDebug)) (*m_profile)[US_STR_ShowDebug]=false;
|
||||
if (!m_profile->contains(US_STR_LinkGroups)) (*m_profile)[US_STR_LinkGroups]=true; // can't remember..
|
||||
if (!m_profile->contains(US_STR_CalculateRDI)) (*m_profile)[US_STR_CalculateRDI]=false;
|
||||
}
|
||||
~UserSettings() {}
|
||||
|
||||
@ -539,6 +541,7 @@ public:
|
||||
bool rebuildCache() { return (*m_profile)[US_STR_RebuildCache].toBool(); }
|
||||
bool showDebug() { return (*m_profile)[US_STR_ShowDebug].toBool(); }
|
||||
bool linkGroups() { return (*m_profile)[US_STR_LinkGroups].toBool(); }
|
||||
bool calculateRDI() { return (*m_profile)[US_STR_CalculateRDI].toBool(); }
|
||||
|
||||
void setUnitSystem(UnitSystem us) { (*m_profile)[US_STR_UnitSystem]=(int)us; }
|
||||
void setEventWindowSize(double size) { (*m_profile)[US_STR_EventWindowSize]=size; }
|
||||
@ -546,6 +549,8 @@ public:
|
||||
void setRebuildCache(bool rebuild) { (*m_profile)[US_STR_RebuildCache]=rebuild; }
|
||||
void setShowDebug(bool b) { (*m_profile)[US_STR_ShowDebug]=b; }
|
||||
void setLinkGroups(bool link) { (*m_profile)[US_STR_LinkGroups]=link; }
|
||||
void setCalculateRDI(bool rdi) { (*m_profile)[US_STR_CalculateRDI]=rdi; }
|
||||
|
||||
|
||||
Profile *m_profile;
|
||||
};
|
||||
|
@ -136,6 +136,7 @@ void init()
|
||||
OXI_SPO2Drop=schema::channel["SPO2Drop"].id();
|
||||
OXI_Plethy=schema::channel["Plethy"].id();
|
||||
CPAP_AHI=schema::channel["AHI"].id();
|
||||
CPAP_RDI=schema::channel["RDI"].id();
|
||||
Journal_Notes=schema::channel["Journal"].id();
|
||||
Journal_Weight=schema::channel["Weight"].id();
|
||||
Journal_BMI=schema::channel["BMI"].id();
|
||||
|
69
daily.cpp
69
daily.cpp
@ -91,7 +91,12 @@ Daily::Daily(QWidget *parent,gGraphView * shared)
|
||||
int default_height=PROFILE.appearance->graphHeight();
|
||||
SF=new gGraph(GraphView,STR_TR_EventFlags,STR_TR_EventFlags,default_height);
|
||||
FRW=new gGraph(GraphView,tr("Flow Rate"),schema::channel[CPAP_FlowRate].description()+"\n("+schema::channel[CPAP_FlowRate].units()+")",default_height);
|
||||
AHI=new gGraph(GraphView,tr("AHI"),schema::channel[CPAP_AHI].description()+"\n("+schema::channel[CPAP_AHI].units()+")",default_height);
|
||||
|
||||
|
||||
if (PROFILE.general->calculateRDI()) {
|
||||
AHI=new gGraph(GraphView,tr("RDI"),schema::channel[CPAP_RDI].description()+"\n("+schema::channel[CPAP_RDI].units()+")",default_height);
|
||||
} else AHI=new gGraph(GraphView,tr("AHI"),schema::channel[CPAP_AHI].description()+"\n("+schema::channel[CPAP_AHI].units()+")",default_height);
|
||||
|
||||
MP=new gGraph(GraphView,tr("Mask Pressure"),schema::channel[CPAP_MaskPressure].description()+"\n("+schema::channel[CPAP_MaskPressure].units()+")",default_height);
|
||||
PRD=new gGraph(GraphView,tr("Pressure"),schema::channel[CPAP_Pressure].description()+"\n("+schema::channel[CPAP_Pressure].units()+")",default_height);
|
||||
LEAK=new gGraph(GraphView,tr("Leak"),schema::channel[CPAP_Leak].description()+"\n("+schema::channel[CPAP_Leak].units()+")",default_height);
|
||||
@ -150,7 +155,7 @@ Daily::Daily(QWidget *parent,gGraphView * shared)
|
||||
fg->AddLayer((new gFlagsLine(CPAP_UserFlag1,QColor("yellow"),tr("UF1"))));
|
||||
fg->AddLayer((new gFlagsLine(CPAP_UserFlag2,QColor("green"),tr("UF2"))));
|
||||
//fg->AddLayer((new gFlagsLine(PRS1_0B,QColor("dark green"),tr("U0B"))));
|
||||
//fg->AddLayer((new gFlagsLine(CPAP_VSnore2,QColor("red"),tr("VS2"))));
|
||||
fg->AddLayer((new gFlagsLine(CPAP_VSnore2,QColor("red"),tr("VS2"))));
|
||||
SF->setBlockZoom(true);
|
||||
SF->AddLayer(new gShadowArea());
|
||||
SF->AddLayer(new gYSpacer(),LayerLeft,gYAxis::Margin);
|
||||
@ -173,7 +178,11 @@ Daily::Daily(QWidget *parent,gGraphView * shared)
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(PRS1_0B,QColor("blue"),"0B",FT_Dot)));
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(PRS1_10,QColor("orange"),"10",FT_Dot)));
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(PRS1_0E,QColor("dark red"),"0E",FT_Dot)));
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(CPAP_RERA,QColor("gold"),tr("RE"))));
|
||||
if (PROFILE.general->calculateRDI())
|
||||
FRW->AddLayer(AddCPAP(los->add(new gLineOverlayBar(CPAP_RERA,QColor("gold"),tr("RE")))));
|
||||
else
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(CPAP_RERA,QColor("gold"),tr("RE"))));
|
||||
|
||||
FRW->AddLayer(AddCPAP(los->add(new gLineOverlayBar(CPAP_Apnea,QColor("dark green"),tr("A")))));
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(CPAP_VSnore,QColor("red"),tr("VS"))));
|
||||
FRW->AddLayer(AddCPAP(new gLineOverlayBar(CPAP_FlowLimit,QColor("black"),tr("FL"))));
|
||||
@ -214,9 +223,12 @@ Daily::Daily(QWidget *parent,gGraphView * shared)
|
||||
PRD->AddLayer(AddCPAP(new gLineChart(CPAP_IPAPHi,Qt::darkRed,square)));
|
||||
PRD->AddLayer(AddCPAP(new gLineChart(CPAP_Pressure,QColor("dark green"),square)));
|
||||
|
||||
AHI->AddLayer(AddCPAP(new gLineChart(CPAP_AHI,QColor("light green"),square)));
|
||||
if (PROFILE.general->calculateRDI()) {
|
||||
AHI->AddLayer(AddCPAP(new AHIChart(QColor("#37a24b"))));
|
||||
} else {
|
||||
AHI->AddLayer(AddCPAP(new gLineChart(CPAP_AHI,QColor("light green"),square)));
|
||||
}
|
||||
|
||||
//AHI->AddLayer(AddCPAP(new AHIChart(QColor("#37a24b"))));
|
||||
LEAK->AddLayer(AddCPAP(new gLineChart(CPAP_LeakTotal,Qt::darkYellow,square)));
|
||||
LEAK->AddLayer(AddCPAP(new gLineChart(CPAP_Leak,Qt::darkMagenta,square)));
|
||||
LEAK->AddLayer(AddCPAP(new gLineChart(CPAP_MaxLeak,Qt::darkRed,square)));
|
||||
@ -250,17 +262,7 @@ Daily::Daily(QWidget *parent,gGraphView * shared)
|
||||
|
||||
PTB->setForceMaxY(100);
|
||||
SPO2->setForceMaxY(100);
|
||||
//FRW->setRecMinY(-120);
|
||||
//FRW->setRecMaxY(0);
|
||||
|
||||
/*SPO2->setRecMaxY(100);
|
||||
SPO2->setRecMinY(75);
|
||||
PULSE->setRecMinY(40);
|
||||
|
||||
LEAK->setRecMinY(0);
|
||||
LEAK->setRecMaxY(80);
|
||||
PRD->setRecMinY(4.0);
|
||||
PRD->setRecMaxY(15.0); */
|
||||
for (int i=0;i<ng;i++){
|
||||
graphs[i]->AddLayer(new gYAxis(),LayerLeft,gYAxis::Margin);
|
||||
graphs[i]->AddLayer(new gXAxis(),LayerBottom,0,20);
|
||||
@ -273,7 +275,6 @@ Daily::Daily(QWidget *parent,gGraphView * shared)
|
||||
ui->calendar->setWeekdayTextFormat(Qt::Saturday, format);
|
||||
ui->calendar->setWeekdayTextFormat(Qt::Sunday, format);
|
||||
|
||||
//Qt::DayOfWeek dow=QLocale::system().firstDayOfWeek();
|
||||
Qt::DayOfWeek dow=firstDayOfWeekFromLocale();
|
||||
|
||||
ui->calendar->setFirstDayOfWeek(dow);
|
||||
@ -356,7 +357,7 @@ void Daily::Link_clicked(const QUrl &url)
|
||||
}
|
||||
return;
|
||||
} else if (code=="event") {
|
||||
QList<QTreeWidgetItem *> list=ui->treeWidget->findItems(schema::channel[data].description(),Qt::MatchContains);
|
||||
QList<QTreeWidgetItem *> list=ui->treeWidget->findItems(schema::channel[sid].description(),Qt::MatchContains);
|
||||
if (list.size()>0) {
|
||||
ui->treeWidget->collapseAll();
|
||||
ui->treeWidget->expandItem(list.at(0));
|
||||
@ -364,7 +365,7 @@ void Daily::Link_clicked(const QUrl &url)
|
||||
ui->treeWidget->setCurrentItem(wi);
|
||||
ui->tabWidget->setCurrentIndex(1);
|
||||
} else {
|
||||
mainwin->Notify(tr("No %1 events are recorded this day").arg(schema::channel[data].description()),"",1500);
|
||||
mainwin->Notify(tr("No %1 events are recorded this day").arg(schema::channel[sid].description()),"",1500);
|
||||
}
|
||||
} else if (code=="graph") {
|
||||
qDebug() << "Select graph " << data;
|
||||
@ -441,6 +442,7 @@ void Daily::UpdateEventsTree(QTreeWidget *tree,Day *day)
|
||||
&& (code!=CPAP_ExP)
|
||||
&& (code!=CPAP_FlowLimit)
|
||||
&& (code!=CPAP_PressurePulse)
|
||||
&& (code!=CPAP_VSnore2)
|
||||
&& (code!=CPAP_VSnore)) continue;
|
||||
QTreeWidgetItem *mcr;
|
||||
if (mcroot.find(code)==mcroot.end()) {
|
||||
@ -690,14 +692,15 @@ void Daily::Load(QDate date)
|
||||
|
||||
modestr=schema::channel[CPAP_Mode].m_options[mode];
|
||||
|
||||
float ahi=(cpap->count(CPAP_Obstructive)+cpap->count(CPAP_Hypopnea)+cpap->count(CPAP_ClearAirway)+cpap->count(CPAP_Apnea))/cpap->hours();
|
||||
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);
|
||||
ahi/=cpap->hours();
|
||||
float csr=(100.0/cpap->hours())*(cpap->sum(CPAP_CSR)/3600.0);
|
||||
float uai=cpap->count(CPAP_Apnea)/cpap->hours();
|
||||
float oai=cpap->count(CPAP_Obstructive)/cpap->hours();
|
||||
float hi=(cpap->count(CPAP_ExP)+cpap->count(CPAP_Hypopnea))/cpap->hours();
|
||||
float cai=cpap->count(CPAP_ClearAirway)/cpap->hours();
|
||||
float rei=cpap->count(CPAP_RERA)/cpap->hours();
|
||||
float vsi=cpap->count(CPAP_VSnore)/cpap->hours();
|
||||
float fli=cpap->count(CPAP_FlowLimit)/cpap->hours();
|
||||
float nri=cpap->count(CPAP_NRI)/cpap->hours();
|
||||
float lki=cpap->count(CPAP_LeakFlag)/cpap->hours();
|
||||
@ -748,9 +751,14 @@ void Daily::Load(QDate date)
|
||||
if (cpap->machine->GetClass()==STR_MACH_ResMed) {
|
||||
cs="4 width='100%' align=center>";
|
||||
} else cs="2 width='50%'>";
|
||||
html+="<tr><td colspan="+cs+"<table cellspacing=0 cellpadding=1 border=0 width='100%'>"
|
||||
"<tr><td align='right' bgcolor='#F88017'><b><font color='black'><a href='nothing' title='"+schema::channel[CPAP_AHI].description()+"'>"+tr("AHI")+"</a></font></b></td><td width=20% bgcolor='#F88017'><b><font color='black'>"+QString().sprintf("%.2f",ahi)+"</font></b></td></tr>\n"
|
||||
"<tr><td align='right' bgcolor='#4040ff'><b><font color='white'> <a href='event="+QString::number(CPAP_Hypopnea)+"' title='"+schema::channel[CPAP_Hypopnea].description()+"'>"+tr("Hypopnea")+"</a></font></b></td><td bgcolor='#4040ff'><font color='white'>"+QString().sprintf("%.2f",hi)+"</font></td></tr>\n";
|
||||
html+="<tr><td colspan="+cs+"<table cellspacing=0 cellpadding=1 border=0 width='100%'>";
|
||||
|
||||
if (PROFILE.general->calculateRDI()) {
|
||||
html+="<tr><td align='right' bgcolor='#F88017'><b><font color='black'><a href='nothing' title='"+schema::channel[CPAP_RDI].description()+"'>"+tr("RDI")+"</a></font></b></td><td width=20% bgcolor='#F88017'><b><font color='black'>"+QString().sprintf("%.2f",ahi)+"</font></b></td></tr>\n";
|
||||
} else {
|
||||
html+="<tr><td align='right' bgcolor='#F88017'><b><font color='black'><a href='nothing' title='"+schema::channel[CPAP_AHI].description()+"'>"+tr("AHI")+"</a></font></b></td><td width=20% bgcolor='#F88017'><b><font color='black'>"+QString().sprintf("%.2f",ahi)+"</font></b></td></tr>\n";
|
||||
}
|
||||
html+="<tr><td align='right' bgcolor='#4040ff'><b><font color='white'> <a href='event="+QString::number(CPAP_Hypopnea)+"' title='"+schema::channel[CPAP_Hypopnea].description()+"'>"+tr("Hypopnea")+"</a></font></b></td><td bgcolor='#4040ff'><font color='white'>"+QString().sprintf("%.2f",hi)+"</font></td></tr>\n";
|
||||
if (cpap->machine->GetClass()==STR_MACH_ResMed) {
|
||||
html+="<tr><td align='right' bgcolor='#208020'><b> <a href='event="+QString::number(CPAP_Apnea)+"' title='"+schema::channel[CPAP_Apnea].description()+"'>"+tr("Unspecified Apnea")+"</a></b></td><td bgcolor='#208020'>"+QString().sprintf("%.2f",uai)+"</td></tr>\n";
|
||||
}
|
||||
@ -760,16 +768,21 @@ void Daily::Load(QDate date)
|
||||
|
||||
if (cpap->machine->GetClass()==STR_MACH_PRS1) {
|
||||
html+="<td colspan=2><table cellspacing=0 cellpadding=1 border=0 width='100%'>"
|
||||
"<tr><td align='right' bgcolor='#ffff80'><b> <a href='event="+QString::number(CPAP_RERA)+"' title='"+schema::channel[CPAP_RERA].description()+"'>"+tr("RERA")+"</a></b></td><td width=20% bgcolor='#ffff80'>"+QString().sprintf("%.2f",rei)+"</td></tr>\n"
|
||||
"<tr><td align='right' bgcolor='#404040'><b> <font color='white'><a href='event="+QString::number(CPAP_FlowLimit)+"' title='"+schema::channel[CPAP_FlowLimit].description()+"'>"+tr("Flow Limit")+"</a></font></b></td><td bgcolor='#404040'><font color='white'>"+a.sprintf("%.2f",fli)+"</font></td></tr>\n"
|
||||
"<tr><td align='right' bgcolor='#ff4040'><b> <a href='event="+QString::number(CPAP_VSnore)+"'title=' "+schema::channel[CPAP_VSnore].description()+"'>"+tr("Vsnore")+"</a></b></td><td bgcolor='#ff4040'>"+QString().sprintf("%.2f",vsi)+"</td></tr>\n"
|
||||
"<tr><td align='right' bgcolor='#80ff80'><b> <a href='event="+QString::number(CPAP_CSR)+"' title='"+schema::channel[CPAP_CSR].description()+"'>"+tr("PB/CSR")+"</a></b></td><td bgcolor='#80ff80'>"+QString().sprintf("%.2f",csr)+"%</td></tr>\n"
|
||||
"<tr><td align='right' bgcolor='#ffff80'><b> <a href='event="+QString::number(CPAP_RERA)+"' title='"+schema::channel[CPAP_RERA].description()+"'>"+tr("RERA")+"</a></b></td><td width=20% bgcolor='#ffff80'>"+QString().sprintf("%.2f",rei)+"</td></tr>\n";
|
||||
if (mode>MODE_CPAP) {
|
||||
html+="<tr><td align='right' bgcolor='#404040'><b> <font color='white'><a href='event="+QString::number(CPAP_FlowLimit)+"' title='"+schema::channel[CPAP_FlowLimit].description()+"'>"+tr("Flow Limit")+"</a></font></b></td><td bgcolor='#404040'><font color='white'>"+a.sprintf("%.2f",fli)+"</font></td></tr>\n";
|
||||
html+="<tr><td align='right' bgcolor='#ff4040'><b> <a href='event="+QString::number(CPAP_VSnore)+"'title=' "+schema::channel[CPAP_VSnore].description()+"'>"+tr("Vsnore")+"</a></b></td><td bgcolor='#ff4040'>"+QString().sprintf("%.2f",cpap->count(CPAP_VSnore)/cpap->hours())+"</td></tr>\n";
|
||||
} else {
|
||||
html+="<tr bgcolor='#404040'><td colspan=2> </td></tr>";
|
||||
html+="<tr><td align='right' bgcolor='#ff4040'><b> <a href='event="+QString::number(CPAP_VSnore2)+"'title=' "+schema::channel[CPAP_VSnore2].description()+"'>"+tr("Vsnore")+"</a></b></td><td bgcolor='#ff4040'>"+QString().sprintf("%.2f",cpap->count(CPAP_VSnore2)/cpap->hours())+"</td></tr>\n";
|
||||
}
|
||||
html+="<tr><td align='right' bgcolor='#80ff80'><b> <a href='event="+QString::number(CPAP_CSR)+"' title='"+schema::channel[CPAP_CSR].description()+"'>"+tr("PB/CSR")+"</a></b></td><td bgcolor='#80ff80'>"+QString().sprintf("%.2f",csr)+"%</td></tr>\n"
|
||||
"</table></td>";
|
||||
} else if (cpap->machine->GetClass()==STR_MACH_Intellipap) {
|
||||
html+="<td colspan=2><table cellspacing=0 cellpadding=2 border=0 width='100%'>"
|
||||
"<tr><td align='right' bgcolor='#ffff80'><b> <a href='event="+QString::number(CPAP_NRI)+"'>"+tr("NRI")+"</a></b></td><td width=20% bgcolor='#ffff80'>"+QString().sprintf("%.2f",nri)+"</td></tr>\n"
|
||||
"<tr><td align='right' bgcolor='#404040'><b> <font color='white'><a href='event="+QString::number(CPAP_Leak)+"'>"+tr("Leak Idx")+"</a></font></b></td><td bgcolor='#404040'><font color='white'>"+a.sprintf("%.2f",lki)+"</font></td></tr>\n"
|
||||
"<tr><td align='right' bgcolor='#ff4040'><b> <a href='event="+QString::number(CPAP_VSnore)+"'>"+tr("V.Snore")+"</a></b></td><td bgcolor='#ff4040'>"+QString().sprintf("%.2f",vsi)+"</td></tr>\n"
|
||||
"<tr><td align='right' bgcolor='#ff4040'><b> <a href='event="+QString::number(CPAP_VSnore)+"'>"+tr("V.Snore")+"</a></b></td><td bgcolor='#ff4040'>"+QString().sprintf("%.2f",cpap->count(CPAP_VSnore)/cpap->hours())+"</td></tr>\n"
|
||||
"<tr><td align='right' bgcolor='#80ff80'><b> <a href='event="+QString::number(CPAP_ExP)+"'>"+tr("Exh. Puff")+"</a></b></td><td bgcolor='#80ff80'>"+QString().sprintf("%.2f",exp)+"</td></tr>\n"
|
||||
"</table></td>";
|
||||
|
||||
|
2
daily.h
2
daily.h
@ -248,7 +248,7 @@ private:
|
||||
|
||||
gGraph *PRD,*FRW,*GAHI,*TAP,*LEAK,*SF,*TAP_EAP,*TAP_IAP,*PULSE,*SPO2,
|
||||
*SNORE,*RR,*MP,*MV,*TV,*FLG,*PTB,*OF, *THPR,
|
||||
*PLETHY,*TI,*TE, *RE, *IE, *TgMV, *AHI;
|
||||
*PLETHY,*TI,*TE, *RE, *IE, *TgMV, *AHI, *RDI;
|
||||
|
||||
QList<Layer *> OXIData;
|
||||
QList<Layer *> CPAPData;
|
||||
|
@ -3,7 +3,7 @@
|
||||
Metric units please.. A conversion system will deal with the other measurement systems
|
||||
English only.. A different translation table will be used..
|
||||
It's only details & label that will be translated. name is used internally.
|
||||
One id code per item
|
||||
Important: One id code per item, DO NOT CHANGE ID NUMBERS!!!
|
||||
-->
|
||||
<channels language="en" version="1.0">
|
||||
<group name="CPAP">
|
||||
@ -16,13 +16,13 @@ One id code per item
|
||||
<channel id="0x1005" class="data" name="FlowLimit" details="Flow Limitation" label="FL" unit="events/hour" color="dark grey"/>
|
||||
<channel id="0x1006" class="data" name="RERA" details="Resp. Effort Related Arousal" unit="events/hour" label="RERA" color="gold"/>
|
||||
<channel id="0x1007" class="data" name="VSnore" details="Vibratory Snore" label="VS" unit="events/hour" color="red"/>
|
||||
<channel id="0x1008" class="data" name="VSnore2" details="Vibratory Snore 2" label="VS2" unit="events/hour" color="orange"/>
|
||||
<channel id="0x1008" class="data" name="VSnore2" details="Vibratory Snore #2" label="VS2" unit="events/hour" color="orange"/>
|
||||
<channel id="0x1009" class="data" name="PressurePulse" details="Pressure Pulse" label="PP" unit="events/hour" color="dark red"/>
|
||||
<channel id="0x100a" class="data" name="LeakFlag" details="Leak Event" label="L" unit="events/hour" color="dark blue"/>
|
||||
<channel id="0x100b" class="data" name="NRI" details="Non-Responding Event" label="NRI" unit="events/hour" color="orange"/>
|
||||
<channel id="0x100c" class="data" name="ExP" details="Exhale Puff" label="EP" unit="events/hour" color="dark magenta"/>
|
||||
<channel id="0x101e" class="data" name="UserFlag1" details="User Flag 1" label="UF1" unit="events/hour" color="dark cyan"/>
|
||||
<channel id="0x101f" class="data" name="UserFlag2" details="User Flag 2" label="UF2" unit="events/hour" color="dark cyan"/>
|
||||
<channel id="0x101e" class="data" name="UserFlag1" details="User Flag #1" label="UF1" unit="events/hour" color="dark cyan"/>
|
||||
<channel id="0x101f" class="data" name="UserFlag2" details="User Flag #2" label="UF2" unit="events/hour" color="dark cyan"/>
|
||||
|
||||
<channel id="0x1020" class="data" name="PressureMin" details="Min Therapy Pressure" label="PMin" color="black"/>
|
||||
<channel id="0x1021" class="data" name="PressureMax" details="Max Therapy Pressure" label="PMax" color="black"/>
|
||||
@ -54,6 +54,7 @@ One id code per item
|
||||
<channel id="0x1116" class="data" name="AHI" details="Apnea/Hypopnea Index" label="AHI/Hr" unit="events/hr" color="dark red"/>
|
||||
<channel id="0x1117" class="data" name="LeakTotal" details="Total Leak Rate" label="Total Leaks" unit="L/min" color="dark green"/>
|
||||
<channel id="0x1118" class="data" name="LeakMedian" details="Median Leak Rate" label="Median Leaks" unit="L/min" color="dark green"/>
|
||||
<channel id="0x1119" class="data" name="RDI" details="Respiratory Disturbance Index" label="RDI" unit="events/hr" color="dark red"/>
|
||||
|
||||
<channel id="0x1150" class="data" name="PRS1_00" details="Unknown 00" label="U00" unit="?" color="black"/>
|
||||
<channel id="0x1151" class="data" name="PRS1_01" details="Unknown 01" label="U01" unit="?" color="black"/>
|
||||
|
135
mainwindow.cpp
135
mainwindow.cpp
@ -359,11 +359,11 @@ QString htmlHeader()
|
||||
"</style>"
|
||||
"</head>"
|
||||
"<body leftmargin=0 topmargin=0 rightmargin=0>"
|
||||
"<div align=center>"
|
||||
"<h2><img src='qrc:/docs/sheep.png' width=100px height=100px>SleepyHead v"+VersionString+" "+ReleaseStatus+"</h2>"
|
||||
"<p><i>This page is being redesigned to be more useful... Please send me your ideas on what you'd like to see here :)</i></p>"
|
||||
"<p>The plan is to get the content happening first, then make the layout pretty...</p>"
|
||||
"<p>Percentile calcs aren't done, as they require ALL data in memory, or very slow calcs, loading and unloading the data.. I really don't want to be forced to have to do either of those. There is simply too much variance to cache this data. :(</br>"
|
||||
"If an average of the daily percentile values were useful, maybe.. ? </p>"
|
||||
"</div>"
|
||||
"<hr/>");
|
||||
}
|
||||
QString htmlFooter()
|
||||
@ -376,8 +376,10 @@ EventDataType calcAHI(QDate start, QDate end)
|
||||
EventDataType val=(p_profile->calcCount(CPAP_Obstructive,MT_CPAP,start,end)
|
||||
+p_profile->calcCount(CPAP_Hypopnea,MT_CPAP,start,end)
|
||||
+p_profile->calcCount(CPAP_ClearAirway,MT_CPAP,start,end)
|
||||
+p_profile->calcCount(CPAP_Apnea,MT_CPAP,start,end))
|
||||
/p_profile->calcHours(MT_CPAP,start,end);
|
||||
+p_profile->calcCount(CPAP_Apnea,MT_CPAP,start,end));
|
||||
if (PROFILE.general->calculateRDI())
|
||||
val+=p_profile->calcCount(CPAP_RERA,MT_CPAP,start,end);
|
||||
val/=p_profile->calcHours(MT_CPAP,start,end);
|
||||
|
||||
return val;
|
||||
}
|
||||
@ -393,7 +395,8 @@ struct RXChange
|
||||
mode=copy.mode;
|
||||
min=copy.min;
|
||||
max=copy.max;
|
||||
p90=copy.p90;
|
||||
per1=copy.per1;
|
||||
per2=copy.per2;
|
||||
highlight=copy.highlight;
|
||||
weighted=copy.weighted;
|
||||
}
|
||||
@ -404,12 +407,13 @@ struct RXChange
|
||||
CPAPMode mode;
|
||||
EventDataType min;
|
||||
EventDataType max;
|
||||
EventDataType p90;
|
||||
EventDataType per1;
|
||||
EventDataType per2;
|
||||
EventDataType weighted;
|
||||
short highlight;
|
||||
};
|
||||
|
||||
enum RXSortMode { RX_first, RX_last, RX_days, RX_ahi, RX_mode, RX_min, RX_max, RX_p90, RX_weighted };
|
||||
enum RXSortMode { RX_first, RX_last, RX_days, RX_ahi, RX_mode, RX_min, RX_max, RX_per1, RX_per2, RX_weighted };
|
||||
RXSortMode RXsort=RX_first;
|
||||
bool RXorder=false;
|
||||
|
||||
@ -423,7 +427,8 @@ bool operator<(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_p90: return comp1.p90 < comp2.p90;
|
||||
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 {
|
||||
@ -435,7 +440,8 @@ bool operator<(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_p90: return comp1.p90 > comp2.p90;
|
||||
case RX_per1: return comp1.per1 > comp2.per1;
|
||||
case RX_per2: return comp1.per2 > comp2.per2;
|
||||
case RX_weighted: return comp1.weighted > comp2.weighted;
|
||||
};
|
||||
}
|
||||
@ -451,7 +457,8 @@ 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_p90: return comp1->p90 < comp2->p90;
|
||||
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 {
|
||||
@ -463,7 +470,8 @@ 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_p90: return comp1->p90 > comp2->p90;
|
||||
case RX_per1: return comp1->per1 > comp2->per1;
|
||||
case RX_per2: return comp1->per2 > comp2->per2;
|
||||
case RX_weighted: return comp1->weighted > comp2->weighted;
|
||||
};
|
||||
}
|
||||
@ -516,11 +524,19 @@ void MainWindow::on_summaryButton_clicked()
|
||||
int cpapdays=PROFILE.countDays(MT_CPAP,firstcpap,lastcpap);
|
||||
CPAPMode cpapmode=(CPAPMode)p_profile->calcSettingsMax(CPAP_Mode,MT_CPAP,firstcpap,lastcpap);
|
||||
|
||||
float percentile=0.95;
|
||||
|
||||
QString ahitxt;
|
||||
if (PROFILE.general->calculateRDI()) {
|
||||
ahitxt=tr("RDI");
|
||||
} else {
|
||||
ahitxt=tr("AHI");
|
||||
}
|
||||
if (cpapdays==0) {
|
||||
html+="<p>No Machine Data Imported</p>";
|
||||
} else {
|
||||
html+="<div align=center>";
|
||||
html+=QString("<p><b>Summary Information as of %1</b></p>").arg(lastcpap.toString(Qt::SystemLocaleLongDate));
|
||||
html+=QString("<p><b>Key Statistics as of %1</b></p>").arg(lastcpap.toString(Qt::SystemLocaleLongDate));
|
||||
html+=QString("<table cellpadding=2 cellspacing=0 border=1 width=90%>");
|
||||
|
||||
if (cpap_machines.size()>0) {
|
||||
@ -537,22 +553,22 @@ void MainWindow::on_summaryButton_clicked()
|
||||
html+=QString("<tr><td><b>%1</b></td><td><b>%2</b></td><td><b>%3</b></td><td><b>%4</b></td><td><b>%5</b></td><td><b>%6</td></tr>")
|
||||
.arg(tr("Details")).arg(tr("Most Recent")).arg(tr("Last 7 Days")).arg(tr("Last 30 Days")).arg(tr("Last 6 months")).arg(tr("Last Year"));
|
||||
html+=QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td><td>%5</td><td>%6</td></tr>")
|
||||
.arg(tr("AHI"))
|
||||
.arg(ahitxt)
|
||||
.arg(calcAHI(lastcpap,lastcpap),0,'f',3)
|
||||
.arg(calcAHI(cpapweek,lastcpap),0,'f',3)
|
||||
.arg(calcAHI(cpapmonth,lastcpap),0,'f',3)
|
||||
.arg(calcAHI(cpap6month,lastcpap),0,'f',3)
|
||||
.arg(calcAHI(cpapyear,lastcpap),0,'f',3);
|
||||
html+="<tr><td colspan=6>Note, these are different to overview calcs.. Overview shows a simple average AHI, this shows combined counts divide by combined hours</td></tr>";
|
||||
|
||||
html+=QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td><td>%5</td><td>%6</td></tr>")
|
||||
.arg(tr("Usage (Average)"))
|
||||
.arg(tr("Hours per Night"))
|
||||
.arg(formatTime(p_profile->calcHours(MT_CPAP)))
|
||||
.arg(formatTime(p_profile->calcHours(MT_CPAP,cpapweek,lastcpap)/float(cpapweekdays)))
|
||||
.arg(formatTime(p_profile->calcHours(MT_CPAP,cpapmonth,lastcpap)/float(cpapmonthdays)))
|
||||
.arg(formatTime(p_profile->calcHours(MT_CPAP,cpap6month,lastcpap)/float(cpap6monthdays)))
|
||||
.arg(formatTime(p_profile->calcHours(MT_CPAP,cpapyear,lastcpap)/float(cpapyeardays)));
|
||||
|
||||
if (cpapmode<MODE_BIPAP) {
|
||||
html+=QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td><td>%5</td><td>%6</td></tr>")
|
||||
.arg(tr("Average Pressure"))
|
||||
.arg(p_profile->calcWavg(CPAP_Pressure,MT_CPAP),0,'f',3)
|
||||
@ -563,12 +579,42 @@ void MainWindow::on_summaryButton_clicked()
|
||||
|
||||
if (cpapmode>MODE_CPAP) {
|
||||
html+=QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td><td>%5</td><td>%6</td></tr>")
|
||||
.arg(tr("90% Pressure"))
|
||||
.arg(p_profile->calcPercentile(CPAP_Pressure,0.9,MT_CPAP),0,'f',3)
|
||||
.arg(p_profile->calcPercentile(CPAP_Pressure,0.9,MT_CPAP,cpapweek,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcPercentile(CPAP_Pressure,0.9,MT_CPAP,cpapmonth,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcPercentile(CPAP_Pressure,0.9,MT_CPAP,cpap6month,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcPercentile(CPAP_Pressure,0.9,MT_CPAP,cpapyear,lastcpap),0,'f',3);
|
||||
.arg(tr("95% Pressure"))
|
||||
.arg(p_profile->calcPercentile(CPAP_Pressure,percentile,MT_CPAP),0,'f',3)
|
||||
.arg(p_profile->calcPercentile(CPAP_Pressure,percentile,MT_CPAP,cpapweek,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcPercentile(CPAP_Pressure,percentile,MT_CPAP,cpapmonth,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcPercentile(CPAP_Pressure,percentile,MT_CPAP,cpap6month,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcPercentile(CPAP_Pressure,percentile,MT_CPAP,cpapyear,lastcpap),0,'f',3);
|
||||
}
|
||||
} else {
|
||||
html+=QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td><td>%5</td><td>%6</td></tr>")
|
||||
.arg(tr("Min EPAP"))
|
||||
.arg(p_profile->calcMin(CPAP_EPAP,MT_CPAP),0,'f',3)
|
||||
.arg(p_profile->calcMin(CPAP_EPAP,MT_CPAP,cpapweek,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcMin(CPAP_EPAP,MT_CPAP,cpapmonth,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcMin(CPAP_EPAP,MT_CPAP,cpap6month,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcMin(CPAP_EPAP,MT_CPAP,cpapyear,lastcpap),0,'f',3);
|
||||
html+=QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td><td>%5</td><td>%6</td></tr>")
|
||||
.arg(tr("95% EPAP"))
|
||||
.arg(p_profile->calcPercentile(CPAP_EPAP,percentile,MT_CPAP),0,'f',3)
|
||||
.arg(p_profile->calcPercentile(CPAP_EPAP,percentile,MT_CPAP,cpapweek,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcPercentile(CPAP_EPAP,percentile,MT_CPAP,cpapmonth,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcPercentile(CPAP_EPAP,percentile,MT_CPAP,cpap6month,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcPercentile(CPAP_EPAP,percentile,MT_CPAP,cpapyear,lastcpap),0,'f',3);
|
||||
html+=QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td><td>%5</td><td>%6</td></tr>")
|
||||
.arg(tr("Max IPAP"))
|
||||
.arg(p_profile->calcMax(CPAP_IPAP,MT_CPAP),0,'f',3)
|
||||
.arg(p_profile->calcMax(CPAP_IPAP,MT_CPAP,cpapweek,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcMax(CPAP_IPAP,MT_CPAP,cpapmonth,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcMax(CPAP_IPAP,MT_CPAP,cpap6month,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcMax(CPAP_IPAP,MT_CPAP,cpapyear,lastcpap),0,'f',3);
|
||||
html+=QString("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td><td>%5</td><td>%6</td></tr>")
|
||||
.arg(tr("95% IPAP"))
|
||||
.arg(p_profile->calcPercentile(CPAP_IPAP,percentile,MT_CPAP),0,'f',3)
|
||||
.arg(p_profile->calcPercentile(CPAP_IPAP,percentile,MT_CPAP,cpapweek,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcPercentile(CPAP_IPAP,percentile,MT_CPAP,cpapmonth,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcPercentile(CPAP_IPAP,percentile,MT_CPAP,cpap6month,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcPercentile(CPAP_IPAP,percentile,MT_CPAP,cpapyear,lastcpap),0,'f',3);
|
||||
}
|
||||
//html+="<tr><td colspan=6>TODO: 90% pressure.. Any point showing if this is all CPAP?</td></tr>";
|
||||
|
||||
@ -588,6 +634,7 @@ void MainWindow::on_summaryButton_clicked()
|
||||
.arg(p_profile->calcPercentile(CPAP_Leak,0.5,MT_CPAP,cpap6month,lastcpap),0,'f',3)
|
||||
.arg(p_profile->calcPercentile(CPAP_Leak,0.5,MT_CPAP,cpapyear,lastcpap),0,'f',3);
|
||||
html+="<tr><td colspan=6>What about median leak values? 90% Leaks?</td></tr>";
|
||||
html+="<tr><td colspan=6>Note, AHI calcs here are different to overview calcs.. Overview shows a average of the dialy AHI's, this shows combined counts divide by combined hours</td></tr>";
|
||||
}
|
||||
if (oximeters.size()>0) {
|
||||
QDate lastoxi=p_profile->LastDay(MT_OXIMETER);
|
||||
@ -698,7 +745,13 @@ void MainWindow::on_summaryButton_clicked()
|
||||
rx.mode=cmode;
|
||||
rx.min=cmin;
|
||||
rx.max=cmax;
|
||||
rx.p90=p_profile->calcPercentile(CPAP_Pressure,0.9,MT_CPAP,first,last);
|
||||
if (mode<MODE_BIPAP) {
|
||||
rx.per1=p_profile->calcPercentile(CPAP_Pressure,percentile,MT_CPAP,first,last);
|
||||
rx.per2=0;
|
||||
} else {
|
||||
rx.per1=p_profile->calcPercentile(CPAP_EPAP,percentile,MT_CPAP,first,last);
|
||||
rx.per2=p_profile->calcPercentile(CPAP_IPAP,percentile,MT_CPAP,first,last);
|
||||
}
|
||||
rx.weighted=float(rx.days)/float(cpapdays)*rx.ahi;
|
||||
rxchange.push_back(rx);
|
||||
}
|
||||
@ -724,7 +777,13 @@ void MainWindow::on_summaryButton_clicked()
|
||||
rx.mode=mode;
|
||||
rx.min=min;
|
||||
rx.max=max;
|
||||
rx.p90=p_profile->calcPercentile(CPAP_Pressure,0.9,MT_CPAP,first,last);
|
||||
if (mode<MODE_BIPAP) {
|
||||
rx.per1=p_profile->calcPercentile(CPAP_Pressure,0.9,MT_CPAP,first,last);
|
||||
rx.per2=0;
|
||||
} else {
|
||||
rx.per1=p_profile->calcPercentile(CPAP_EPAP,0.9,MT_CPAP,first,last);
|
||||
rx.per2=p_profile->calcPercentile(CPAP_IPAP,0.9,MT_CPAP,first,last);
|
||||
}
|
||||
rx.weighted=float(rx.days)/float(cpapdays);
|
||||
//rx.weighted=float(days)*rx.ahi;
|
||||
rxchange.push_back(rx);
|
||||
@ -752,9 +811,12 @@ void MainWindow::on_summaryButton_clicked()
|
||||
html+=QString("<br/><b>Changes to Prescription Settings</b>");
|
||||
html+=QString("<table cellpadding=2 cellspacing=0 border=1 width=90%>");
|
||||
QString extratxt;
|
||||
if (cpapmode>MODE_CPAP) {
|
||||
if (cpapmode>=MODE_BIPAP) {
|
||||
extratxt=QString("<td><b>%1</b></td><td><b>%2</b></td><td><b>%3</b></td><td><b>%4</b></td>")
|
||||
.arg(tr("EPAP")).arg(tr("EPAP")).arg(tr("%1% EPAP").arg(percentile*100.0)).arg(tr("%1% IPAP").arg(percentile*100.0));
|
||||
} else if (cpapmode>MODE_CPAP) {
|
||||
extratxt=QString("<td><b>%1</b></td><td><b>%2</b></td><td><b>%3</b></td>")
|
||||
.arg(tr("Min Pressure")).arg(tr("Max Pressure")).arg(tr("90% Pressure"));
|
||||
.arg(tr("Min Pressure")).arg(tr("Max Pressure")).arg(tr("%1% Pressure").arg(percentile*100.0));
|
||||
} else {
|
||||
extratxt=QString("<td><b>%1</b></td>")
|
||||
.arg(tr("Pressure"));
|
||||
@ -763,7 +825,7 @@ void MainWindow::on_summaryButton_clicked()
|
||||
.arg(tr("First"))
|
||||
.arg(tr("Last"))
|
||||
.arg(tr("Days"))
|
||||
.arg(tr("AHI"))
|
||||
.arg(ahitxt)
|
||||
.arg(tr("Mode"))
|
||||
.arg(extratxt);
|
||||
|
||||
@ -779,16 +841,18 @@ void MainWindow::on_summaryButton_clicked()
|
||||
} else if (rx.highlight==4) {
|
||||
color=" bgcolor='#ffc0c0'";
|
||||
} else color="";
|
||||
if (cpapmode>MODE_CPAP)
|
||||
extratxt=QString("<td>%1</td><td>%2</td>").arg(rx.max).arg(rx.p90);
|
||||
else extratxt="";
|
||||
if (cpapmode>=MODE_BIPAP) {
|
||||
extratxt=QString("<td>%1</td><td>%2</td><td>%3</td>").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("<td>%1</td><td>%2</td>").arg(rx.max,0,'f',2).arg(rx.per1,0,'f',2);
|
||||
} else extratxt="";
|
||||
html+=QString("<tr"+color+"><td>%1</td><td>%2</td><td>%3</td><td>%4</td><td>%5</td><td>%6</td>%7</tr>")
|
||||
.arg(rx.first.toString(Qt::SystemLocaleShortDate))
|
||||
.arg(rx.last.toString(Qt::SystemLocaleShortDate))
|
||||
.arg(rx.days)
|
||||
.arg(rx.ahi,0,'f',2)
|
||||
.arg(schema::channel[CPAP_Mode].option(int(rx.mode)-1))
|
||||
.arg(rx.min)
|
||||
.arg(rx.min,0,'f',2)
|
||||
.arg(extratxt);
|
||||
}
|
||||
html+="</table>";
|
||||
@ -1238,7 +1302,9 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
|
||||
else if (mode==MODE_BIPAP) cpapinfo+=tr("Bi-Level %1-%2cmH2O").arg(min).arg(max);
|
||||
else if (mode==MODE_ASV) cpapinfo+=tr("ASV");
|
||||
|
||||
float ahi=(cpap->count(CPAP_Obstructive)+cpap->count(CPAP_Hypopnea)+cpap->count(CPAP_ClearAirway)+cpap->count(CPAP_Apnea))/cpap->hours();
|
||||
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);
|
||||
ahi/=cpap->hours();
|
||||
float csr=(100.0/cpap->hours())*(cpap->sum(CPAP_CSR)/3600.0);
|
||||
float uai=cpap->count(CPAP_Apnea)/cpap->hours();
|
||||
float oai=cpap->count(CPAP_Obstructive)/cpap->hours();
|
||||
@ -1264,7 +1330,10 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
|
||||
|
||||
QString stats;
|
||||
painter.setFont(medium_font);
|
||||
stats=tr("AHI\t%1\n").arg(ahi,0,'f',2);
|
||||
if (PROFILE.general->calculateRDI())
|
||||
stats=tr("RDI\t%1\n").arg(ahi,0,'f',2);
|
||||
else
|
||||
stats=tr("AHI\t%1\n").arg(ahi,0,'f',2);
|
||||
QRectF bounds=painter.boundingRect(QRectF(0,0,virt_width,0),stats,QTextOption(Qt::AlignRight));
|
||||
painter.drawText(bounds,stats,QTextOption(Qt::AlignRight));
|
||||
|
||||
@ -1340,7 +1409,7 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (g=gv->findGraph(tr("Event Flags"))) {
|
||||
if ((g=gv->findGraph(tr("Event Flags")))!=NULL) {
|
||||
if ((!g->isEmpty()) && (g->visible())) {
|
||||
start.push_back(st);
|
||||
start.push_back(et);
|
||||
|
22
overview.cpp
22
overview.cpp
@ -90,8 +90,11 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
|
||||
// TODO: Automate graph creation process
|
||||
|
||||
// The following code (to the closing marker) is crap --->
|
||||
AHI=createGraph("AHI","Apnea\nHypopnea\nIndex");
|
||||
UC=createGraph("Usage","Usage\n(hours)");
|
||||
if (PROFILE.general->calculateRDI())
|
||||
AHI=createGraph(tr("RDI"),"Respiratory\nDisturbance\nIndex");
|
||||
else
|
||||
AHI=createGraph(tr("AHI"),tr("Apnea\nHypopnea\nIndex"));
|
||||
UC=createGraph(tr("Usage"),tr("Usage\n(hours)"));
|
||||
|
||||
|
||||
US=createGraph(tr("Session Times"),tr("Session Times\n(hours)"),YT_Time);
|
||||
@ -159,11 +162,17 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
|
||||
ses->addSlice(NoChannel,QColor("blue"),ST_SESSIONS,true);
|
||||
SES->AddLayer(ses);
|
||||
|
||||
bc=new SummaryChart(tr("AHI"),GT_BAR);
|
||||
if (PROFILE.general->calculateRDI())
|
||||
bc=new SummaryChart(tr("RDI"),GT_BAR);
|
||||
else
|
||||
bc=new SummaryChart(tr("AHI"),GT_BAR);
|
||||
bc->addSlice(CPAP_Hypopnea,QColor("blue"),ST_CPH,false);
|
||||
bc->addSlice(CPAP_Apnea,QColor("dark green"),ST_CPH,false);
|
||||
bc->addSlice(CPAP_Obstructive,QColor("#40c0ff"),ST_CPH,false);
|
||||
bc->addSlice(CPAP_ClearAirway,QColor("purple"),ST_CPH,false);
|
||||
if (PROFILE.general->calculateRDI()) {
|
||||
bc->addSlice(CPAP_RERA,QColor("gold"),ST_CPH,false);
|
||||
}
|
||||
AHI->AddLayer(bc);
|
||||
|
||||
set=new SummaryChart("",GT_LINE);
|
||||
@ -208,8 +217,11 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
|
||||
pr->addSlice(CPAP_Pressure,QColor("orange"),ST_MIN,true);
|
||||
pr->addSlice(CPAP_Pressure,QColor("red"),ST_MAX,true);
|
||||
pr->addSlice(CPAP_Pressure,QColor("grey"),ST_90P,true);
|
||||
pr->addSlice(CPAP_EPAP,QColor("light green"),ST_MIN,true);
|
||||
pr->addSlice(CPAP_IPAP,QColor("light blue"),ST_MAX,true);
|
||||
pr->addSlice(CPAP_EPAP,QColor("green"),ST_MIN,true);
|
||||
pr->addSlice(CPAP_EPAP,QColor("light green"),ST_90P,true);
|
||||
|
||||
pr->addSlice(CPAP_IPAP,QColor("blue"),ST_MAX,true);
|
||||
pr->addSlice(CPAP_IPAP,QColor("light blue"),ST_90P,true);
|
||||
PR->AddLayer(pr);
|
||||
|
||||
lk=new SummaryChart(tr("Avg Leak"),GT_LINE);
|
||||
|
@ -1027,6 +1027,10 @@ void Oximetry::on_RunButton_toggled(bool checked)
|
||||
GraphView->setEmptyText(tr("Please Wait"));
|
||||
GraphView->redraw();
|
||||
|
||||
PLETHY->setVisible(true);
|
||||
SPO2->setVisible(true);
|
||||
PULSE->setVisible(true);
|
||||
|
||||
PLETHY->setRecMinY(0);
|
||||
PLETHY->setRecMaxY(128);
|
||||
PULSE->setRecMinY(60);
|
||||
@ -1183,6 +1187,7 @@ void Oximetry::on_ImportButton_clicked()
|
||||
connect(oximeter,SIGNAL(importAborted()),this,SLOT(import_aborted()));
|
||||
connect(oximeter,SIGNAL(updateProgress(float)),this,SLOT(update_progress(float)));
|
||||
|
||||
PLETHY->setVisible(false);
|
||||
day->getSessions().clear();
|
||||
GraphView->setDay(day);
|
||||
GraphView->setEmptyText("Make Sure Oximeter Is Ready");
|
||||
|
@ -107,6 +107,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent,Profile * _profile) :
|
||||
ui->pulseChange->setValue(profile->oxi->pulseChangeBPM());
|
||||
ui->pulseChangeTime->setValue(profile->oxi->pulseChangeDuration());
|
||||
ui->oxiDiscardThreshold->setValue(profile->oxi->oxiDiscardThreshold());
|
||||
ui->AddRERAtoAHI->setChecked(profile->general->calculateRDI());
|
||||
|
||||
ui->timeEdit->setTime(profile->session->daySplitTime());
|
||||
int val=profile->session->combineCloseSessions();
|
||||
@ -300,6 +301,11 @@ void PreferencesDialog::Save()
|
||||
needs_restart=true;
|
||||
} else profile->session->setTrashDayCache(false);
|
||||
|
||||
if (profile->general->calculateRDI() != ui->AddRERAtoAHI->isChecked()) {
|
||||
profile->general->setCalculateRDI(ui->AddRERAtoAHI->isChecked());
|
||||
needs_restart=true;
|
||||
}
|
||||
|
||||
profile->session->setCombineCloseSessions(ui->combineSlider->value());
|
||||
profile->session->setIgnoreShortSessions(ui->IgnoreSlider->value());
|
||||
profile->session->setDaySplitTime(ui->timeEdit->time());
|
||||
|
@ -38,7 +38,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>7</number>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="importTab">
|
||||
<attribute name="title">
|
||||
@ -1235,6 +1235,13 @@ this application to be unstable with this feature enabled.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="AddRERAtoAHI">
|
||||
<property name="text">
|
||||
<string>Use RDI instead of AHI (PRS1 only)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user