Fix Oximetry rebuild datetime glitch

This commit is contained in:
Mark Watkins 2011-12-28 16:27:26 +10:00
parent e85883a37b
commit 381209716b
2 changed files with 25 additions and 15 deletions

View File

@ -776,6 +776,13 @@ void MainWindow::on_summaryButton_clicked()
.arg(p_profile->calcMax(OXI_Pulse,MT_OXIMETER,oximonth,lastoxi),0,'f',3) .arg(p_profile->calcMax(OXI_Pulse,MT_OXIMETER,oximonth,lastoxi),0,'f',3)
.arg(p_profile->calcMax(OXI_Pulse,MT_OXIMETER,oxi6month,lastoxi),0,'f',3) .arg(p_profile->calcMax(OXI_Pulse,MT_OXIMETER,oxi6month,lastoxi),0,'f',3)
.arg(p_profile->calcMax(OXI_Pulse,MT_OXIMETER,oxiyear,lastoxi),0,'f',3); .arg(p_profile->calcMax(OXI_Pulse,MT_OXIMETER,oxiyear,lastoxi),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("Pulse Change Events / Hour"))
.arg(p_profile->calcCount(OXI_PulseChange,MT_OXIMETER)/p_profile->calcHours(MT_OXIMETER),0,'f',3)
.arg(p_profile->calcCount(OXI_PulseChange,MT_OXIMETER,oxiweek,lastoxi)/p_profile->calcHours(MT_OXIMETER,oxiweek,lastoxi),0,'f',3)
.arg(p_profile->calcCount(OXI_PulseChange,MT_OXIMETER,oximonth,lastoxi)/p_profile->calcHours(MT_OXIMETER,oximonth,lastoxi),0,'f',3)
.arg(p_profile->calcCount(OXI_PulseChange,MT_OXIMETER,oxi6month,lastoxi)/p_profile->calcHours(MT_OXIMETER,oxi6month,lastoxi),0,'f',3)
.arg(p_profile->calcCount(OXI_PulseChange,MT_OXIMETER,oxiyear,lastoxi)/p_profile->calcHours(MT_OXIMETER,oxiyear,lastoxi),0,'f',3);
} }
} }
@ -1905,19 +1912,29 @@ void MainWindow::on_action_Rebuild_Oximetry_Index_triggered()
for (int z=0;z<machines.size();z++) { for (int z=0;z<machines.size();z++) {
m=machines.at(z); m=machines.at(z);
//m->sessionlist.erase(m->sessionlist.find(0)); //m->sessionlist.erase(m->sessionlist.find(0));
// For each Session
for (QHash<SessionID,Session *>::iterator s=m->sessionlist.begin();s!=m->sessionlist.end();s++) { for (QHash<SessionID,Session *>::iterator s=m->sessionlist.begin();s!=m->sessionlist.end();s++) {
Session *sess=s.value(); Session *sess=s.value();
if (!sess) continue; if (!sess) continue;
sess->OpenEvents(); sess->OpenEvents();
// For each EventList contained in session
invalid.clear(); invalid.clear();
f=0;
l=0;
for (QHash<ChannelID,QVector<EventList *> >::iterator e=sess->eventlist.begin();e!=sess->eventlist.end();e++) { for (QHash<ChannelID,QVector<EventList *> >::iterator e=sess->eventlist.begin();e!=sess->eventlist.end();e++) {
// Discard any non data events.
if (!valid.contains(e.key())) { if (!valid.contains(e.key())) {
// delete and push aside for later to clean up
for (int i=0;i<e.value().size();i++) { for (int i=0;i<e.value().size();i++) {
delete e.value()[i]; delete e.value()[i];
} }
e.value().clear(); e.value().clear();
invalid.push_back(e.key()); invalid.push_back(e.key());
} else { } else {
// Valid event
QVector<EventList *> newlist; QVector<EventList *> newlist;
for (int i=0;i<e.value().size();i++) { for (int i=0;i<e.value().size();i++) {
if (e.value()[i]->count() > (unsigned)discard_threshold) { if (e.value()[i]->count() > (unsigned)discard_threshold) {
@ -1929,13 +1946,6 @@ void MainWindow::on_action_Rebuild_Oximetry_Index_triggered()
for (int i=0;i<newlist.size();i++) { for (int i=0;i<newlist.size();i++) {
packEventList(newlist[i],8); packEventList(newlist[i],8);
/*EventList *nev=packEventList(newlist[i]);
if (nev->count()!=e.value()[i]->count() ) {
delete newlist[i];
newlist[i]=nev;
} else {
delete nev;
}*/
EventList * el=newlist[i]; EventList * el=newlist[i];
if (!f || f > el->first()) f=el->first(); if (!f || f > el->first()) f=el->first();
if (!l || l < el->last()) l=el->last(); if (!l || l < el->last()) l=el->last();

View File

@ -146,7 +146,7 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
spo2=new SummaryChart(STR_TR_SpO2,GT_LINE); spo2=new SummaryChart(STR_TR_SpO2,GT_LINE);
spo2->setMachineType(MT_OXIMETER); spo2->setMachineType(MT_OXIMETER);
spo2->addSlice(OXI_SPO2,QColor("cyan"),ST_WAVG,true); spo2->addSlice(OXI_SPO2,QColor("cyan"),ST_WAVG,true);
spo2->addSlice(OXI_SPO2,QColor("light blue"),ST_90P,true); spo2->addSlice(OXI_SPO2,QColor("light blue"),ST_90P,true,0.95);
spo2->addSlice(OXI_SPO2,QColor("blue"),ST_MIN,true); spo2->addSlice(OXI_SPO2,QColor("blue"),ST_MIN,true);
SPO2->AddLayer(spo2); SPO2->AddLayer(spo2);
@ -188,26 +188,26 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
rr=new SummaryChart(tr("breaths/min"),GT_LINE); rr=new SummaryChart(tr("breaths/min"),GT_LINE);
rr->addSlice(CPAP_RespRate,QColor("light blue"),ST_MIN,true); rr->addSlice(CPAP_RespRate,QColor("light blue"),ST_MIN,true);
rr->addSlice(CPAP_RespRate,QColor("light green"),ST_90P,true); rr->addSlice(CPAP_RespRate,QColor("light green"),ST_PERC,true,0.95);
rr->addSlice(CPAP_RespRate,QColor("blue"),ST_WAVG,true); rr->addSlice(CPAP_RespRate,QColor("blue"),ST_WAVG,true);
RR->AddLayer(rr); RR->AddLayer(rr);
tv=new SummaryChart(tr("L/b"),GT_LINE); tv=new SummaryChart(tr("L/b"),GT_LINE);
tv->addSlice(CPAP_TidalVolume,QColor("light blue"),ST_MIN,true); tv->addSlice(CPAP_TidalVolume,QColor("light blue"),ST_MIN,true);
tv->addSlice(CPAP_TidalVolume,QColor("light green"),ST_90P,true); tv->addSlice(CPAP_TidalVolume,QColor("light green"),ST_PERC,true,0.95);
tv->addSlice(CPAP_TidalVolume,QColor("blue"),ST_WAVG,true); tv->addSlice(CPAP_TidalVolume,QColor("blue"),ST_WAVG,true);
TV->AddLayer(tv); TV->AddLayer(tv);
mv=new SummaryChart(tr("L/m"),GT_LINE); mv=new SummaryChart(tr("L/m"),GT_LINE);
mv->addSlice(CPAP_MinuteVent,QColor("light blue"),ST_MIN,true); mv->addSlice(CPAP_MinuteVent,QColor("light blue"),ST_MIN,true);
mv->addSlice(CPAP_MinuteVent,QColor("light green"),ST_90P,true); mv->addSlice(CPAP_MinuteVent,QColor("light green"),ST_PERC,true,0.95);
mv->addSlice(CPAP_MinuteVent,QColor("blue"),ST_WAVG,true); mv->addSlice(CPAP_MinuteVent,QColor("blue"),ST_WAVG,true);
MV->AddLayer(mv); MV->AddLayer(mv);
ptb=new SummaryChart(tr("%PTB"),GT_LINE); ptb=new SummaryChart(tr("%PTB"),GT_LINE);
ptb->addSlice(CPAP_PTB,QColor("yellow"),ST_MIN,true); ptb->addSlice(CPAP_PTB,QColor("yellow"),ST_MIN,true);
ptb->addSlice(CPAP_PTB,QColor("light gray"),ST_90P,true); ptb->addSlice(CPAP_PTB,QColor("light gray"),ST_PERC,true,0.95);
ptb->addSlice(CPAP_PTB,QColor("orange"),ST_WAVG,true); ptb->addSlice(CPAP_PTB,QColor("orange"),ST_WAVG,true);
PTB->AddLayer(ptb); PTB->AddLayer(ptb);
@ -219,10 +219,10 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
if (mode>=MODE_BIPAP) { if (mode>=MODE_BIPAP) {
pr->addSlice(CPAP_EPAP,QColor("green"),ST_MIN,true); pr->addSlice(CPAP_EPAP,QColor("green"),ST_MIN,true);
pr->addSlice(CPAP_EPAP,QColor("light green"),ST_90P,true); pr->addSlice(CPAP_EPAP,QColor("light green"),ST_PERC,true,0.95);
pr->addSlice(CPAP_IPAP,QColor("light blue"),ST_PERC,true,0.95);
pr->addSlice(CPAP_IPAP,QColor("blue"),ST_MAX,true); pr->addSlice(CPAP_IPAP,QColor("blue"),ST_MAX,true);
pr->addSlice(CPAP_IPAP,QColor("light blue"),ST_90P,true);
} else if (mode>MODE_CPAP) { } else if (mode>MODE_CPAP) {
pr->addSlice(CPAP_Pressure,QColor("dark green"),ST_WAVG,true); pr->addSlice(CPAP_Pressure,QColor("dark green"),ST_WAVG,true);
pr->addSlice(CPAP_Pressure,QColor("orange"),ST_MIN,true); pr->addSlice(CPAP_Pressure,QColor("orange"),ST_MIN,true);
@ -236,7 +236,7 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
PR->AddLayer(pr); PR->AddLayer(pr);
lk=new SummaryChart(tr("Avg Leak"),GT_LINE); lk=new SummaryChart(tr("Avg Leak"),GT_LINE);
lk->addSlice(CPAP_Leak,QColor("dark grey"),ST_PERC,false,0.8); lk->addSlice(CPAP_Leak,QColor("dark grey"),ST_PERC,false,0.95);
lk->addSlice(CPAP_Leak,QColor("dark blue"),ST_WAVG,false); lk->addSlice(CPAP_Leak,QColor("dark blue"),ST_WAVG,false);
//lk->addSlice(CPAP_Leak,QColor("dark yellow")); //lk->addSlice(CPAP_Leak,QColor("dark yellow"));
//pr->addSlice(CPAP_IPAP,QColor("red")); //pr->addSlice(CPAP_IPAP,QColor("red"));