mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 02:30:44 +00:00
Added on demand Event & Wave data loading
This commit is contained in:
parent
02d0ba7ca2
commit
288911ed15
@ -7785,7 +7785,7 @@
|
||||
"wx/progdlg.h"
|
||||
"wx/dialog.h"
|
||||
|
||||
1306858490 source:/home/mark/projects/git/sleepyhead/GUIFrame.cpp
|
||||
1306939868 source:/home/mark/projects/git/sleepyhead/GUIFrame.cpp
|
||||
"wx/wxprec.h"
|
||||
<wx/wx.h>
|
||||
"GUIFrame.h"
|
||||
@ -7838,7 +7838,7 @@
|
||||
"sleeplib/machine.h"
|
||||
"graphs/graph.h"
|
||||
|
||||
1306839039 /home/mark/projects/git/sleepyhead/libs/sleeplib/machine.h
|
||||
1306942290 /home/mark/projects/git/sleepyhead/libs/sleeplib/machine.h
|
||||
<wx/string.h>
|
||||
<wx/variant.h>
|
||||
<wx/dir.h>
|
||||
@ -7876,7 +7876,7 @@
|
||||
<sleeplib/machine.h>
|
||||
<list>
|
||||
|
||||
1306933584 /home/mark/projects/git/sleepyhead/version.h
|
||||
1306942431 /home/mark/projects/git/sleepyhead/version.h
|
||||
|
||||
1306724655 /home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.h
|
||||
"machine.h"
|
||||
@ -7893,7 +7893,7 @@
|
||||
"preferences.h"
|
||||
"tinyxml/tinyxml.h"
|
||||
|
||||
1306933486 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp
|
||||
1306942373 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp
|
||||
"wx_pch.h"
|
||||
"version.h"
|
||||
<wx/app.h>
|
||||
@ -7912,7 +7912,7 @@
|
||||
"sleeplib/profiles.h"
|
||||
"sleeplib/machine_loader.h"
|
||||
|
||||
1306931755 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp
|
||||
1306940744 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp
|
||||
<wx/settings.h>
|
||||
<wx/dcbuffer.h>
|
||||
<wx/log.h>
|
||||
@ -7927,7 +7927,7 @@
|
||||
<wx/ffile.h>
|
||||
<wx/utils.h>
|
||||
|
||||
1306842369 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/machine.cpp
|
||||
1306942428 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/machine.cpp
|
||||
<tr1/random>
|
||||
<wx/colour.h>
|
||||
<wx/log.h>
|
||||
@ -7960,7 +7960,7 @@
|
||||
"machine_loader.h"
|
||||
"tinyxml/tinyxml.h"
|
||||
|
||||
1306926301 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.cpp
|
||||
1306941094 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.cpp
|
||||
<wx/dir.h>
|
||||
<wx/filename.h>
|
||||
<wx/ffile.h>
|
||||
|
@ -385,16 +385,18 @@ Summary::~Summary()
|
||||
void Summary::ResetProfile(Profile *p)
|
||||
{
|
||||
profile=p;
|
||||
for (auto h=Data.begin();h!=Data.end();h++) {
|
||||
(*h)->SetProfile(p);
|
||||
(*h)->ResetDateRange();
|
||||
}
|
||||
|
||||
if (profile->FirstDay().IsValid()) {
|
||||
StartDatePicker->SetRange(profile->FirstDay()+wxTimeSpan::Day(),profile->LastDay()+wxTimeSpan::Day());
|
||||
EndDatePicker->SetRange(profile->FirstDay()+wxTimeSpan::Day(),profile->LastDay()+wxTimeSpan::Day());
|
||||
StartDatePicker->SetValue(profile->FirstDay()+wxTimeSpan::Day());
|
||||
EndDatePicker->SetValue(profile->LastDay()+wxTimeSpan::Day());
|
||||
for (auto h=Data.begin();h!=Data.end();h++) {
|
||||
(*h)->SetProfile(p);
|
||||
(*h)->ResetDateRange();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
void Summary::RefreshData()
|
||||
{
|
||||
@ -479,7 +481,7 @@ void Summary::OnRBSelect( wxCommandEvent& event )
|
||||
EndDatePicker->SetValue(end);
|
||||
|
||||
for (auto h=Data.begin();h!=Data.end();h++) {
|
||||
(*h)->SetDateRange(start,end);
|
||||
(*h)->SetDateRange(start-wxTimeSpan::Day(),end);
|
||||
}
|
||||
}
|
||||
|
||||
@ -688,6 +690,14 @@ void Daily::RefreshData()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (d) {
|
||||
for (auto s=d->begin();s!=d->end();s++) {
|
||||
(*s)->OpenEvents();
|
||||
(*s)->OpenWaveforms();
|
||||
}
|
||||
|
||||
}
|
||||
UpdateGraphs(d);
|
||||
|
||||
if (d) {
|
||||
@ -722,7 +732,6 @@ void Daily::RefreshData()
|
||||
float iap90=d->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())
|
||||
|
@ -1844,7 +1844,7 @@ void HistoryData::ResetDateRange()
|
||||
}
|
||||
double HistoryData::Calc(Day *day)
|
||||
{
|
||||
return (day->count(CPAP_Obstructive)+day->count(CPAP_Hypopnea)+day->count(CPAP_ClearAirway))/day->hours();
|
||||
return (day->summary_sum(CPAP_Obstructive) + day->summary_sum(CPAP_Hypopnea) + day->summary_sum(CPAP_ClearAirway)) / day->hours();
|
||||
}
|
||||
|
||||
void HistoryData::Reload(Day *day)
|
||||
|
@ -238,8 +238,11 @@ bool Machine::Load()
|
||||
//sess->SetWaveformFile(sessfiles[sess->id()][1]);
|
||||
//wxString sx=sess->first().Format()+wxT(" ")+sess->last().Format();
|
||||
// wxPrintf(s+wxT(" O=%i H=%i CA=%i \n"),sess->summary[CPAP_Obstructive].GetLong(),sess->summary[CPAP_Hypopnea].GetLong(),sess->summary[CPAP_ClearAirway].GetLong());
|
||||
sess->LoadEvents(s->second[1]);
|
||||
sess->LoadWaveforms(s->second[2]);
|
||||
// sess->LoadEvents(s->second[1]);
|
||||
// sess->LoadWaveforms(s->second[2]);
|
||||
sess->SetEventFile(s->second[1]);
|
||||
sess->SetWaveFile(s->second[2]);
|
||||
|
||||
AddSession(sess,profile);
|
||||
} else {
|
||||
delete sess;
|
||||
@ -298,6 +301,19 @@ void Day::AddSession(Session *s)
|
||||
}
|
||||
sessions.push_back(s);
|
||||
}
|
||||
|
||||
EventDataType Day::summary_sum(MachineCode code)
|
||||
{
|
||||
EventDataType val=0;
|
||||
for (auto s=sessions.begin();s!=sessions.end();s++) {
|
||||
Session & sess=*(*s);
|
||||
if (sess.summary.find(code)!=sess.summary.end()) {
|
||||
val+=sess.summary[code].GetDouble();
|
||||
}
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
EventDataType Day::summary_max(MachineCode code)
|
||||
{
|
||||
EventDataType val=0,tmp;
|
||||
@ -618,6 +634,10 @@ Session::Session(Machine * m,SessionID session)
|
||||
s_machine=m;
|
||||
s_session=session;
|
||||
s_changed=false;
|
||||
s_events_loaded=false;
|
||||
s_waves_loaded=false;
|
||||
s_wavefile=wxEmptyString;
|
||||
s_eventfile=wxEmptyString;
|
||||
}
|
||||
Session::~Session()
|
||||
{
|
||||
|
@ -106,6 +106,7 @@ public:
|
||||
|
||||
// Note, the following convert to doubles without considering the consequences fully.
|
||||
EventDataType summary_avg(MachineCode code);
|
||||
EventDataType summary_sum(MachineCode code);
|
||||
EventDataType summary_min(MachineCode code);
|
||||
EventDataType summary_max(MachineCode code);
|
||||
|
||||
@ -277,6 +278,21 @@ public:
|
||||
bool LoadEvents(wxString filename);
|
||||
bool LoadWaveforms(wxString filename);
|
||||
|
||||
bool OpenEvents() {
|
||||
if(s_events_loaded)
|
||||
return true;
|
||||
bool b=LoadEvents(s_eventfile);
|
||||
s_events_loaded=b;
|
||||
return b;
|
||||
};
|
||||
bool OpenWaveforms() {
|
||||
if (s_waves_loaded)
|
||||
return true;
|
||||
bool b=LoadWaveforms(s_wavefile);
|
||||
s_waves_loaded=b;
|
||||
return b;
|
||||
};
|
||||
|
||||
void TrashEvents();
|
||||
void TrashWaveforms();
|
||||
|
||||
@ -319,6 +335,8 @@ public:
|
||||
map<MachineCode,wxVariant> summary;
|
||||
void SetChanged(bool val) {
|
||||
s_changed=val;
|
||||
s_events_loaded=val; // dirty hack putting this here
|
||||
s_waves_loaded=val;
|
||||
};
|
||||
bool IsChanged() {
|
||||
return s_changed;
|
||||
@ -328,6 +346,9 @@ public:
|
||||
|
||||
bool IsLoneSession() { return s_lonesession; };
|
||||
void SetLoneSession(bool b) { s_lonesession=b; };
|
||||
void SetEventFile(wxString & filename) { s_eventfile=filename; };
|
||||
void SetWaveFile(wxString & filename) { s_wavefile=filename; };
|
||||
|
||||
protected:
|
||||
SessionID s_session;
|
||||
|
||||
@ -337,6 +358,11 @@ protected:
|
||||
float s_hours;
|
||||
bool s_changed;
|
||||
bool s_lonesession;
|
||||
|
||||
bool s_events_loaded;
|
||||
bool s_waves_loaded;
|
||||
wxString s_eventfile;
|
||||
wxString s_wavefile;
|
||||
};
|
||||
|
||||
class CPAP:public Machine
|
||||
|
@ -285,13 +285,13 @@ int PRS1Loader::OpenMachine(Machine *m,wxString path,Profile *profile)
|
||||
}
|
||||
m->AddSession(sess,profile);
|
||||
|
||||
if (sess->summary.find(CPAP_Obstructive)!=sess->summary.end()) {
|
||||
//if (sess->summary.find(CPAP_Obstructive)==sess->summary.end()) {
|
||||
sess->summary[CPAP_Obstructive]=(long)sess->count_events(CPAP_Obstructive);
|
||||
sess->summary[CPAP_Hypopnea]=(long)sess->count_events(CPAP_Hypopnea);
|
||||
sess->summary[CPAP_ClearAirway]=(long)sess->count_events(CPAP_ClearAirway);
|
||||
sess->summary[CPAP_RERA]=(long)sess->count_events(CPAP_RERA);
|
||||
sess->summary[CPAP_FlowLimit]=(long)sess->count_events(CPAP_FlowLimit);
|
||||
}
|
||||
//}
|
||||
|
||||
sess->summary[CPAP_CSR]=sess->sum_event_field(CPAP_CSR,0);
|
||||
sess->summary[CPAP_VSnore]=(long)sess->count_events(CPAP_VSnore);
|
||||
|
14
version.h
14
version.h
@ -4,7 +4,7 @@
|
||||
namespace AutoVersion{
|
||||
|
||||
//Date Version Types
|
||||
static const char DATE[] = "01";
|
||||
static const char DATE[] = "02";
|
||||
static const char MONTH[] = "06";
|
||||
static const char YEAR[] = "2011";
|
||||
static const char UBUNTU_VERSION_STYLE[] = "11.06";
|
||||
@ -16,14 +16,14 @@ namespace AutoVersion{
|
||||
//Standard Version Type
|
||||
static const long MAJOR = 0;
|
||||
static const long MINOR = 7;
|
||||
static const long BUILD = 2713;
|
||||
static const long REVISION = 9489;
|
||||
static const long BUILD = 2740;
|
||||
static const long REVISION = 9616;
|
||||
|
||||
//Miscellaneous Version Types
|
||||
static const long BUILDS_COUNT = 8127;
|
||||
#define RC_FILEVERSION 0,7,2713,9489
|
||||
#define RC_FILEVERSION_STRING "0, 7, 2713, 9489\0"
|
||||
static const char FULLVERSION_STRING[] = "0.7.2713.9489";
|
||||
static const long BUILDS_COUNT = 8197;
|
||||
#define RC_FILEVERSION 0,7,2740,9616
|
||||
#define RC_FILEVERSION_STRING "0, 7, 2740, 9616\0"
|
||||
static const char FULLVERSION_STRING[] = "0.7.2740.9616";
|
||||
|
||||
//These values are to keep track of your versioning state, don't modify them.
|
||||
static const long BUILD_HISTORY = 62;
|
||||
|
Loading…
Reference in New Issue
Block a user