Daily Summary cleanup, added profile GetDay function

This commit is contained in:
Mark Watkins 2011-06-07 01:05:46 +10:00
parent 21034ae004
commit 6dc96ade43
6 changed files with 140 additions and 115 deletions

View File

@ -8295,7 +8295,7 @@
<sleeplib/machine.h>
<list>
1307370363 /home/mark/projects/git/sleepyhead/src/version.h
1307372542 /home/mark/projects/git/sleepyhead/src/version.h
1307358939 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/prs1_loader.h
"machine.h"
@ -8305,14 +8305,14 @@
1307358939 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/machine_loader.h
"profiles.h"
1307358939 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/profiles.h
1307371998 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/profiles.h
<wx/string.h>
<map>
"machine.h"
"preferences.h"
"tinyxml/tinyxml.h"
1307358939 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadMain.cpp
1307372397 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadMain.cpp
"wx_pch.h"
"version.h"
<wx/app.h>
@ -8368,7 +8368,7 @@
<wx/stdpaths.h>
"preferences.h"
1307358939 source:/home/mark/projects/git/sleepyhead/src/libs/sleeplib/profiles.cpp
1307372029 source:/home/mark/projects/git/sleepyhead/src/libs/sleeplib/profiles.cpp
<wx/filefn.h>
<wx/filename.h>
<wx/utils.h>
@ -8413,7 +8413,7 @@
1307358939 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/loader_plugins/cms50_loader.h
"sleeplib/machine_loader.h"
1307370285 source:/home/mark/projects/git/sleepyhead/src/libs/sleeplib/loader_plugins/cms50_loader.cpp
1307372542 source:/home/mark/projects/git/sleepyhead/src/libs/sleeplib/loader_plugins/cms50_loader.cpp
<wx/log.h>
<wx/progdlg.h>
"cms50_loader.h"

View File

@ -731,40 +731,22 @@ void Daily::RefreshData()
date.SetHour(0);
date-=wxTimeSpan::Days(1);
Day *d=NULL;
Day *oxi=NULL;
if (profile->daylist.find(date)!=profile->daylist.end()) {
vector<Day *>::iterator di;
for (di=profile->daylist[date].begin();di!=profile->daylist[date].end();di++) {
if (!d && ((*di)->machine_type()==MT_CPAP)) {
d=(*di);
UpdateCPAPGraphs(d);
}
if ((*di)->machine_type()==MT_OXIMETER) {
oxi=(*di);
UpdateOXIGraphs(oxi);
}
Day *cpap=profile->GetDay(date,MT_CPAP);
Day *oxi=profile->GetDay(date,MT_OXIMETER);
if (cpap) UpdateCPAPGraphs(cpap);
if (oxi) UpdateOXIGraphs(oxi);
}
}
wxString html=wxT("<html><body leftmargin=0 rightmargin=0 topmargin=0 marginwidth=0 marginheight=0><table cellspacing=2 cellpadding=0>\n");
if (d) {
CPAPMode mode=(CPAPMode)d->summary_max(CPAP_Mode);
if (mode!=MODE_BIPAP) {
TAP_EAP->Show(false);
TAP_IAP->Show(false);
TAP->Show(true);
} else {
TAP->Show(false);
TAP_IAP->Show(true);
TAP_EAP->Show(true);
}
CPAPMode mode;
if (cpap) {
mode=(CPAPMode)cpap->summary_max(CPAP_Mode);
EventTree->DeleteAllItems();
wxTreeItemId root=EventTree->AddRoot(wxT("Events"));
map<MachineCode,wxTreeItemId> mcroot;
for (vector<Session *>::iterator s=d->begin();s!=d->end();s++) {
for (vector<Session *>::iterator s=cpap->begin();s!=cpap->end();s++) {
map<MachineCode,vector<Event *> >::iterator m;
@ -790,7 +772,7 @@ void Daily::RefreshData()
if (code==CPAP_CSR) {
t-=wxTimeSpan::Seconds((*(*e))[0]/2);
}
EventTree->AppendItem(mcr,t.Format(wxT("%Y-%m-%d %H:%M:%S")),-1,-1);
EventTree->AppendItem(mcr,t.Format(wxT("%Y-%m-%cpap %H:%M:%S")),-1,-1);
}
}
}
@ -798,37 +780,37 @@ void Daily::RefreshData()
EventTree->Expand(root);
PRTypes pr=(PRTypes)d->summary_max(CPAP_PressureReliefType);
wxString epr=PressureReliefNames[pr]+wxString::Format(wxT(" x%i"),(int)d->summary_max(CPAP_PressureReliefSetting));
PRTypes pr=(PRTypes)cpap->summary_max(CPAP_PressureReliefType);
wxString epr=PressureReliefNames[pr]+wxString::Format(wxT(" x%i"),(int)cpap->summary_max(CPAP_PressureReliefSetting));
wxString modestr=CPAPModeNames[mode];
float ahi=(d->count(CPAP_Obstructive)+d->count(CPAP_Hypopnea)+d->count(CPAP_ClearAirway))/d->hours();
float csr=(100.0/d->hours())*(d->sum(CPAP_CSR)/3600.0);
float oai=d->count(CPAP_Obstructive)/d->hours();
float hi=d->count(CPAP_Hypopnea)/d->hours();
float cai=d->count(CPAP_ClearAirway)/d->hours();
float rei=d->count(CPAP_RERA)/d->hours();
float vsi=d->count(CPAP_VSnore)/d->hours();
float fli=d->count(CPAP_FlowLimit)/d->hours();
// float p90=d->percentile(CPAP_Pressure,0,0.9);
float eap90=d->percentile(CPAP_EAP,0,0.9);
float iap90=d->percentile(CPAP_IAP,0,0.9);
float ahi=(cpap->count(CPAP_Obstructive)+cpap->count(CPAP_Hypopnea)+cpap->count(CPAP_ClearAirway))/cpap->hours();
float csr=(100.0/cpap->hours())*(cpap->sum(CPAP_CSR)/3600.0);
float oai=cpap->count(CPAP_Obstructive)/cpap->hours();
float hi=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 p90=cpap->percentile(CPAP_Pressure,0,0.9);
float eap90=cpap->percentile(CPAP_EAP,0,0.9);
float iap90=cpap->percentile(CPAP_IAP,0,0.9);
wxString submodel=_("Unknown Model");
wxString html=wxT("<html><body leftmargin=0 rightmargin=0 topmargin=0 marginwidth=0 marginheight=0><table cellspacing=2 cellpadding=0>\n");
html=html+wxT("<tr><td colspan=2 align=center><i>")+_("Machine Information")+wxT("</i></td></tr>\n");
if (d->machine->properties.find(wxT("SubModel"))!=d->machine->properties.end())
submodel=wxT(" <br>")+d->machine->properties[wxT("SubModel")];
html=html+wxT("<tr><td colspan=2 align=center><b>")+d->machine->properties[wxT("Brand")]+wxT("</b> <br>")+d->machine->properties[wxT("Model")]+wxT(" ")+d->machine->properties[wxT("ModelNumber")]+submodel+wxT("</td></tr>\n");
if (cpap->machine->properties.find(wxT("SubModel"))!=cpap->machine->properties.end())
submodel=wxT(" <br>")+cpap->machine->properties[wxT("SubModel")];
html=html+wxT("<tr><td colspan=2 align=center><b>")+cpap->machine->properties[wxT("Brand")]+wxT("</b> <br>")+cpap->machine->properties[wxT("Model")]+wxT(" ")+cpap->machine->properties[wxT("ModelNumber")]+submodel+wxT("</td></tr>\n");
if (pref.Exists("ShowSerialNumbers") && pref["ShowSerialNumbers"]) {
html=html+wxT("<tr><td colspan=2 align=center>")+d->machine->properties[wxT("Serial")]+wxT("</td></tr>\n");
html=html+wxT("<tr><td colspan=2 align=center>")+cpap->machine->properties[wxT("Serial")]+wxT("</td></tr>\n");
}
html=html+wxT("<tr><td>&nbsp;</td><td>&nbsp;</td></tr>\n");
html=html+wxT("<tr><td colspan=2 align=center><i>")+_("Sleep Times")+wxT("</i></td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Date")+wxT("</b></td><td>")+d->first().Format(wxT("%x"))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Sleep")+wxT("</b></td><td>")+d->first().Format(wxT("%H:%M"))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Wake")+wxT("</b></td><td>")+d->last().Format(wxT("%H:%M"))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Total Time")+wxT("</b></td><td><i>")+d->total_time().Format(wxT("%H:%M&nbsp;hours"))+wxT("</i></td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Date")+wxT("</b></td><td>")+cpap->first().Format(wxT("%x"))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Sleep")+wxT("</b></td><td>")+cpap->first().Format(wxT("%H:%M"))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Wake")+wxT("</b></td><td>")+cpap->last().Format(wxT("%H:%M"))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Total Time")+wxT("</b></td><td><i>")+cpap->total_time().Format(wxT("%H:%M&nbsp;hours"))+wxT("</i></td></tr>\n");
html=html+wxT("<tr><td>&nbsp;</td><td>&nbsp;</td></tr>\n");
html=html+wxT("<tr><td colspan=2 align=center><i>")+_("Indices")+wxT("</i></td></tr>\n");
html=html+wxT("<tr><td><b>")+_("AHI")+wxT("</b></td><td>")+wxString::Format(wxT("%0.2f"),ahi)+wxT("</td></tr>\n");
@ -845,95 +827,121 @@ void Daily::RefreshData()
html=html+wxT("<tr><td><b>")+_("Mode")+wxT("</b></td><td>")+modestr+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Relief")+wxT("</b></td><td>")+epr+wxT("</td></tr>\n");
if (mode==MODE_CPAP) {
html=html+wxT("<tr><td><b>")+_("Pressure")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),d->summary_min(CPAP_PressureMin))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Pressure")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_min(CPAP_PressureMin))+wxT("</td></tr>\n");
} else if (mode==MODE_APAP) {
html=html+wxT("<tr><td><b>")+_("90%&nbsp;Pressure")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),d->summary_weighted_avg(CPAP_PressurePercentValue))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Avg&nbsp;Pressure")+wxT("</b></td><td>")+wxString::Format(wxT("%.2fcmH2O"),d->summary_weighted_avg(CPAP_PressureAverage))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Min&nbsp;Reached")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),d->summary_min(CPAP_PressureMinAchieved))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Max&nbsp;Reached")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),d->summary_max(CPAP_PressureMaxAchieved))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("90%&nbsp;Pressure")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_weighted_avg(CPAP_PressurePercentValue))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Avg&nbsp;Pressure")+wxT("</b></td><td>")+wxString::Format(wxT("%.2fcmH2O"),cpap->summary_weighted_avg(CPAP_PressureAverage))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Min&nbsp;Reached")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_min(CPAP_PressureMinAchieved))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Max&nbsp;Reached")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_max(CPAP_PressureMaxAchieved))+wxT("</td></tr>\n");
// html=html+wxT("<tr><td><b>")+_("90%&nbsp;Pressure")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),p90)+wxT("</td></tr>\n");
} else if (mode==MODE_BIPAP) {
html=html+wxT("<tr><td><b>")+_("Avg IPAP")+wxT("</b></td><td>")+wxString::Format(wxT("%.2fcmH2O"),d->summary_avg(BIPAP_IAPAverage))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Avg EPAP")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),d->summary_avg(BIPAP_EAPAverage))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Min IPAP")+wxT("</b></td><td>")+wxString::Format(wxT("%.2fcmH2O"),d->summary_min(BIPAP_IAPMin))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Max IPAP")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),d->summary_max(BIPAP_IAPMax))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Min EPAP")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),d->summary_min(BIPAP_EAPMin))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Max EPAP")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),d->summary_max(BIPAP_EAPMax))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Avg IPAP")+wxT("</b></td><td>")+wxString::Format(wxT("%.2fcmH2O"),cpap->summary_avg(BIPAP_IAPAverage))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Avg EPAP")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_avg(BIPAP_EAPAverage))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Min IPAP")+wxT("</b></td><td>")+wxString::Format(wxT("%.2fcmH2O"),cpap->summary_min(BIPAP_IAPMin))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Max IPAP")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_max(BIPAP_IAPMax))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Min EPAP")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_min(BIPAP_EAPMin))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Max EPAP")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_max(BIPAP_EAPMax))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("90%&nbsp;IPAP")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),iap90)+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("90%&nbsp;EPAP")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),eap90)+wxT("</td></tr>\n");
}
html=html+wxT("<tr><td><b>")+_("Avg Leak")+wxT("</b></td><td>")+wxString::Format(wxT("%.2f"),d->summary_weighted_avg(CPAP_LeakAverage))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Avg Leak")+wxT("</b></td><td>")+wxString::Format(wxT("%.2f"),cpap->summary_weighted_avg(CPAP_LeakAverage))+wxT("</td></tr>\n");
html=html+wxT("<tr><td>&nbsp;</td><td>&nbsp;</td></tr>\n");
if (oxi) {
html=html+wxT("<tr><td colspan=2 align=center><i>")+_("Oximeter Information")+wxT("</i></td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Pulse Avg")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),oxi->summary_avg(OXI_PulseAverage))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Pulse Min")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),oxi->summary_min(OXI_PulseMin))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Pulse Max")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),oxi->summary_max(OXI_PulseMax))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("SpO2 Avg")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),oxi->summary_avg(OXI_SPO2Average))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("SpO2 Min")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),oxi->summary_min(OXI_SPO2Min))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("SpO2 Max")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),oxi->summary_max(OXI_SPO2Max))+wxT("</td></tr>\n");
PULSE->Show(true);
SPO2->Show(true);
if (mode!=MODE_BIPAP) {
TAP_EAP->Show(false);
TAP_IAP->Show(false);
TAP->Show(true);
} else {
PULSE->Show(false);
SPO2->Show(false);
TAP->Show(false);
TAP_IAP->Show(true);
TAP_EAP->Show(true);
}
fgSizer->Layout();
FRW->Show(true);
PRD->Show(true);
G_AHI->Show(true);
LEAK->Show(true);
TAP->Show(true);
SF->Show(true);
} else {
TAP_EAP->Show(false);
TAP_IAP->Show(false);
FRW->Show(false);
PRD->Show(false);
G_AHI->Show(false);
LEAK->Show(false);
TAP->Show(false);
SF->Show(false);
}
if (oxi) {
html=html+wxT("<tr><td colspan=2 align=center><i>")+_("Oximeter Information")+wxT("</i></td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Pulse Avg")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fbpm"),oxi->summary_avg(OXI_PulseAverage))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Pulse Min")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fbpm"),oxi->summary_min(OXI_PulseMin))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Pulse Max")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fbpm"),oxi->summary_max(OXI_PulseMax))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("SpO2 Avg")+wxT("</b></td><td>")+wxString::Format(wxT("%.1f%%"),oxi->summary_avg(OXI_SPO2Average))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("SpO2 Min")+wxT("</b></td><td>")+wxString::Format(wxT("%.1f%%"),oxi->summary_min(OXI_SPO2Min))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("SpO2 Max")+wxT("</b></td><td>")+wxString::Format(wxT("%.1f%%"),oxi->summary_max(OXI_SPO2Max))+wxT("</td></tr>\n");
PULSE->Show(true);
SPO2->Show(true);
} else {
PULSE->Show(false);
SPO2->Show(false);
}
fgSizer->Layout();
ScrolledWindow->FitInside();
if (cpap) {
// fgSizer->Layout();
ScrolledWindow->FitInside();
html=html+wxT("<tr><td>&nbsp;</td><td>&nbsp;</td></tr>\n");
if (d->summary_avg(CPAP_BrokenSummary)==1) {
if (cpap->summary_avg(CPAP_BrokenSummary)==1) {
html=html+wxT("<tr><td colspan=2 align=center><i>")+_("No System Settings Recorded")+wxT("</i></td></tr>\n");
} else {
html=html+wxT("<tr><td colspan=2 align=center><i>")+_("System Settings")+wxT("</i></td></tr>\n");
if (mode==MODE_CPAP) {
html=html+wxT("<tr><td><b>")+_("Pressure")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),d->summary_min(CPAP_PressureMin))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Pressure")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_min(CPAP_PressureMin))+wxT("</td></tr>\n");
} else if (mode==MODE_APAP) {
html=html+wxT("<tr><td><b>")+_("Min&nbsp;Pressure")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),d->summary_min(CPAP_PressureMin))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Max&nbsp;Pressure")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),d->summary_max(CPAP_PressureMax))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Min&nbsp;Pressure")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_min(CPAP_PressureMin))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Max&nbsp;Pressure")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_max(CPAP_PressureMax))+wxT("</td></tr>\n");
} else if (mode==MODE_BIPAP) {
html=html+wxT("<tr><td><b>")+_("IPAP&nbsp;Pressure")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),d->summary_min(CPAP_PressureMin))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("EPAP&nbsp;Pressure")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),d->summary_max(CPAP_PressureMax))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("IPAP&nbsp;Pressure")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_min(CPAP_PressureMin))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("EPAP&nbsp;Pressure")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_max(CPAP_PressureMax))+wxT("</td></tr>\n");
}
html=html+wxT("<tr><td><b>")+_("Ramp-Time")+wxT("</b></td><td>")+wxString::Format(wxT("%imin"),(int)d->summary_max(CPAP_RampTime))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Ramp-Prs.")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),d->summary_min(CPAP_RampStartingPressure))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Ramp-Time")+wxT("</b></td><td>")+wxString::Format(wxT("%imin"),(int)cpap->summary_max(CPAP_RampTime))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Ramp-Prs.")+wxT("</b></td><td>")+wxString::Format(wxT("%.1fcmH2O"),cpap->summary_min(CPAP_RampStartingPressure))+wxT("</td></tr>\n");
// check HumidiferStatus..
wxString str;
if (bool(d->summary_max(CPAP_HumidifierStatus))) {
str=wxString::Format(wxT("x%i"),(int)d->summary_max(CPAP_HumidifierSetting));
if (bool(cpap->summary_max(CPAP_HumidifierStatus))) {
str=wxString::Format(wxT("x%i"),(int)cpap->summary_max(CPAP_HumidifierSetting));
} else str=wxT("No");
html=html+wxT("<tr><td><b>")+_("Humidifier")+wxT("</b></td><td>")+str+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("System-Lock")+wxT("</b></td><td>")+(bool(d->summary_max(PRS1_SystemLockStatus)) ? _("On") : _("Off"))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Auto-Off")+wxT("</b></td><td>")+(bool(d->summary_max(PRS1_AutoOff)) ? _("On") : _("Off"))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Mask-Alert")+wxT("</b></td><td>")+(bool(d->summary_max(PRS1_MaskAlert)) ? _("On") : _("Off"))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Show-AHI")+wxT("</b></td><td>")+(bool(d->summary_max(PRS1_ShowAHI)) ? _("On") : _("Off"))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Hose-Size")+wxT("</b></td><td>")+(bool(d->summary_max(PRS1_HoseDiameter)) ? _("22mm") : _("15mm"))+wxT("</td></tr>\n");
if (bool(d->summary_max(PRS1_SystemResistanceStatus))) {
str=wxString::Format(wxT("x%i"),(int)d->summary_max(PRS1_SystemResistanceSetting));
html=html+wxT("<tr><td><b>")+_("System-Lock")+wxT("</b></td><td>")+(bool(cpap->summary_max(PRS1_SystemLockStatus)) ? _("On") : _("Off"))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Auto-Off")+wxT("</b></td><td>")+(bool(cpap->summary_max(PRS1_AutoOff)) ? _("On") : _("Off"))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Mask-Alert")+wxT("</b></td><td>")+(bool(cpap->summary_max(PRS1_MaskAlert)) ? _("On") : _("Off"))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Show-AHI")+wxT("</b></td><td>")+(bool(cpap->summary_max(PRS1_ShowAHI)) ? _("On") : _("Off"))+wxT("</td></tr>\n");
html=html+wxT("<tr><td><b>")+_("Hose-Size")+wxT("</b></td><td>")+(bool(cpap->summary_max(PRS1_HoseDiameter)) ? _("22mm") : _("15mm"))+wxT("</td></tr>\n");
if (bool(cpap->summary_max(PRS1_SystemResistanceStatus))) {
str=wxString::Format(wxT("x%i"),(int)cpap->summary_max(PRS1_SystemResistanceSetting));
} else str=wxT("No");
html=html+wxT("<tr><td><b>")+_("Sys-Resist.")+wxT("</b></td><td>")+str+wxT("</td></tr>\n");
}
html=html+wxT("<tr><td>&nbsp;</td><td>&nbsp;</td></tr>\n");
html=html+wxT("<tr><td colspan=2 align=center><i>")+_("Session Files")+wxT("</i></td></tr>\n");
for (vector<Session *>::iterator i=d->begin();i!=d->end();i++) {
for (vector<Session *>::iterator i=cpap->begin();i!=cpap->end();i++) {
html=html+wxT("<tr><td colspan=2 align=center>")+(*i)->first().Format(wxT("%d-%m-%Y %H:%M:%S"))+wxT(" ")+wxString::Format(wxT("%05i"),(*i)->session())+wxT("</td></tr>\n");
html=html+wxT("<tr><td colspan=2 align=center>")+(*i)->last().Format(wxT("%d-%m-%Y %H:%M:%S"))+wxT(" ")+wxString::Format(wxT("%05i"),(*i)->session())+wxT("</td></tr>\n");
}
html=html+wxT("</table>");
html+=wxT("</body></html>");
HTMLInfo->SetPage(html);
} else {
HTMLInfo->SetPage(_("<i>No data available for this day</i>"));
}
if (!cpap && !oxi) {
html+=_("<tr><td colspan=2><i>No data available for this day</i></td></tr>");
}
html+=wxT("</table></body></html>");
HTMLInfo->SetPage(html);
}
void Daily::OnSelectSession( wxCommandEvent& event )

View File

@ -121,7 +121,7 @@ bool CMS50Loader::OpenSPORFile(wxString path,Machine *mach,Profile *profile)
wxDateTime date;
date.ParseFormat(datestr,wxT("%m/%d/%y %H:%M:%S"));
wxLogMessage(datestr);
//wxLogMessage(datestr);
f.Seek(data_starts,wxFromStart);
buffer=new char [num_records*2];
@ -146,6 +146,7 @@ bool CMS50Loader::OpenSPORFile(wxString path,Machine *mach,Profile *profile)
int PCnt=0,SCnt=0;
//wxDateTime
wxDateTime tt=date;
wxDateTime lasttime=date;
bool first_p=true,first_s=true;
for (int i=2;i<num_records;i+=2) {
@ -153,6 +154,7 @@ bool CMS50Loader::OpenSPORFile(wxString path,Machine *mach,Profile *profile)
cs=buffer[i+1];
if (last_pulse!=cp) {
sess->AddEvent(new Event(tt,OXI_Pulse,&cp,1));
if (tt>lasttime) lasttime=tt;
if (cp>0) {
if (first_p) {
PMin=cp;
@ -166,6 +168,7 @@ bool CMS50Loader::OpenSPORFile(wxString path,Machine *mach,Profile *profile)
}
if (last_spo2!=cs) {
sess->AddEvent(new Event(tt,OXI_SPO2,&cs,1));
if (tt>lasttime) lasttime=tt;
if (cs>0) {
if (first_s) {
SMin=cs;
@ -183,10 +186,10 @@ bool CMS50Loader::OpenSPORFile(wxString path,Machine *mach,Profile *profile)
if (SMax<cs) SMax=cs;
tt+=wxTimeSpan::Seconds(1);
}
sess->AddEvent(new Event(tt,OXI_Pulse,&cp,1));
sess->AddEvent(new Event(tt,OXI_SPO2,&cs,1));
if (cp) sess->AddEvent(new Event(tt,OXI_Pulse,&cp,1));
if (cs) sess->AddEvent(new Event(tt,OXI_SPO2,&cs,1));
sess->set_last(tt);
sess->set_last(lasttime);
wxTimeSpan t=sess->last()-sess->first();
double hours=(t.GetSeconds().GetLo()/3600.0);

View File

@ -146,6 +146,19 @@ void Profile::AddDay(wxDateTime date,Day *day,MachineType mt) {
daylist[date].push_back(day);
}
Day * Profile::GetDay(wxDateTime date,MachineType type)
{
Day *day=NULL;
if (profile->daylist.find(date)!=profile->daylist.end()) {
for (vector<Day *>::iterator di=profile->daylist[date].begin();di!=profile->daylist[date].end();di++) {
if ((*di)->machine_type()==type) {
day=(*di);
break;
}
}
}
return day;
}
/**

View File

@ -39,6 +39,7 @@ public:
void Import(wxString path);
void AddDay(wxDateTime date,Day *day,MachineType mt);
Day * GetDay(wxDateTime date,MachineType type);
vector<Machine *> GetMachines(MachineType t);
Machine * GetMachine(MachineType t,wxDateTime date);

View File

@ -16,14 +16,14 @@ namespace AutoVersion{
//Standard Version Type
static const long MAJOR = 0;
static const long MINOR = 7;
static const long BUILD = 3286;
static const long REVISION = 1070;
static const long BUILD = 3301;
static const long REVISION = 1162;
//Miscellaneous Version Types
static const long BUILDS_COUNT = 379;
#define RC_FILEVERSION 0,7,3286,1070
#define RC_FILEVERSION_STRING "0, 7, 3286, 1070\0"
static const char FULLVERSION_STRING[] = "0.7.3286.1070";
static const long BUILDS_COUNT = 418;
#define RC_FILEVERSION 0,7,3301,1162
#define RC_FILEVERSION_STRING "0, 7, 3301, 1162\0"
static const char FULLVERSION_STRING[] = "0.7.3301.1162";
//These values are to keep track of your versioning state, don't modify them.
static const long BUILD_HISTORY = 0;