mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-18 03:30:48 +00:00
Oximeter min,max and avg cleanup
This commit is contained in:
parent
6970b7890c
commit
336ac05302
@ -8201,7 +8201,7 @@
|
|||||||
"wx/treebase.h"
|
"wx/treebase.h"
|
||||||
"wx/hashmap.h"
|
"wx/hashmap.h"
|
||||||
|
|
||||||
1307245704 source:/home/mark/projects/git/sleepyhead/src/GUIFrame.cpp
|
1307332633 source:/home/mark/projects/git/sleepyhead/src/GUIFrame.cpp
|
||||||
"wx/wxprec.h"
|
"wx/wxprec.h"
|
||||||
<wx/wx.h>
|
<wx/wx.h>
|
||||||
"GUIFrame.h"
|
"GUIFrame.h"
|
||||||
@ -8312,7 +8312,7 @@
|
|||||||
"preferences.h"
|
"preferences.h"
|
||||||
"tinyxml/tinyxml.h"
|
"tinyxml/tinyxml.h"
|
||||||
|
|
||||||
1307331240 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadMain.cpp
|
1307333457 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadMain.cpp
|
||||||
"wx_pch.h"
|
"wx_pch.h"
|
||||||
"version.h"
|
"version.h"
|
||||||
<wx/app.h>
|
<wx/app.h>
|
||||||
@ -8331,7 +8331,7 @@
|
|||||||
"sleeplib/profiles.h"
|
"sleeplib/profiles.h"
|
||||||
"sleeplib/machine_loader.h"
|
"sleeplib/machine_loader.h"
|
||||||
|
|
||||||
1307331318 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp
|
1307332921 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp
|
||||||
<wx/settings.h>
|
<wx/settings.h>
|
||||||
<wx/dcbuffer.h>
|
<wx/dcbuffer.h>
|
||||||
<wx/log.h>
|
<wx/log.h>
|
||||||
@ -8412,7 +8412,7 @@
|
|||||||
1307287644 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/loader_plugins/cms50_loader.h
|
1307287644 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/loader_plugins/cms50_loader.h
|
||||||
"sleeplib/machine_loader.h"
|
"sleeplib/machine_loader.h"
|
||||||
|
|
||||||
1307289931 source:/home/mark/projects/git/sleepyhead/src/libs/sleeplib/loader_plugins/cms50_loader.cpp
|
1307334532 source:/home/mark/projects/git/sleepyhead/src/libs/sleeplib/loader_plugins/cms50_loader.cpp
|
||||||
<wx/log.h>
|
<wx/log.h>
|
||||||
<wx/progdlg.h>
|
<wx/progdlg.h>
|
||||||
"cms50_loader.h"
|
"cms50_loader.h"
|
||||||
|
@ -27,7 +27,7 @@ GUIFrame::GUIFrame( wxWindow* parent, wxWindowID id, const wxString& title, cons
|
|||||||
menubar = new wxMenuBar( 0 );
|
menubar = new wxMenuBar( 0 );
|
||||||
FileMenu = new wxMenu();
|
FileMenu = new wxMenu();
|
||||||
wxMenuItem* FileMenuImportSD;
|
wxMenuItem* FileMenuImportSD;
|
||||||
FileMenuImportSD = new wxMenuItem( FileMenu, wxID_ANY, wxString( _("&Import SD") ) + wxT('\t') + wxT("F9"), wxEmptyString, wxITEM_NORMAL );
|
FileMenuImportSD = new wxMenuItem( FileMenu, wxID_ANY, wxString( _("&Import Data") ) + wxT('\t') + wxT("F9"), wxEmptyString, wxITEM_NORMAL );
|
||||||
FileMenu->Append( FileMenuImportSD );
|
FileMenu->Append( FileMenuImportSD );
|
||||||
|
|
||||||
wxMenuItem* FileMenuPreferences;
|
wxMenuItem* FileMenuPreferences;
|
||||||
|
@ -577,16 +577,16 @@ Daily::Daily(wxWindow *win,Profile *p)
|
|||||||
G_AHI->AddLayer(l);
|
G_AHI->AddLayer(l);
|
||||||
|
|
||||||
AddOXIData(pulse=new SkipZeroData(OXI_Pulse,0,32768));
|
AddOXIData(pulse=new SkipZeroData(OXI_Pulse,0,32768));
|
||||||
pulse->ForceMinY(40);
|
//pulse->ForceMinY(40);
|
||||||
pulse->ForceMaxY(120);
|
//pulse->ForceMaxY(120);
|
||||||
|
|
||||||
PULSE=new gGraphWindow(ScrolledWindow,-1,wxT("Pulse"),wxPoint(0,0), wxSize(600,130), wxNO_BORDER);
|
PULSE=new gGraphWindow(ScrolledWindow,-1,wxT("Pulse"),wxPoint(0,0), wxSize(600,130), wxNO_BORDER);
|
||||||
PULSE->AddLayer(new gLineChart(pulse,wxRED,32768,false,false,true));
|
PULSE->AddLayer(new gLineChart(pulse,wxRED,32768,false,false,true));
|
||||||
PULSE->AddLayer(new gXAxis(wxBLACK));
|
PULSE->AddLayer(new gXAxis(wxBLACK));
|
||||||
|
|
||||||
AddOXIData(spo2=new SkipZeroData(OXI_SPO2,0,32768));
|
AddOXIData(spo2=new SkipZeroData(OXI_SPO2,0,32768));
|
||||||
spo2->ForceMinY(60);
|
//spo2->ForceMinY(60);
|
||||||
spo2->ForceMaxY(100);
|
//spo2->ForceMaxY(100);
|
||||||
SPO2=new gGraphWindow(ScrolledWindow,-1,wxT("SpO2"),wxPoint(0,0), wxSize(600,130), wxNO_BORDER);
|
SPO2=new gGraphWindow(ScrolledWindow,-1,wxT("SpO2"),wxPoint(0,0), wxSize(600,130), wxNO_BORDER);
|
||||||
SPO2->AddLayer(new gLineChart(spo2,wxBLUE,32768,false,false,true));
|
SPO2->AddLayer(new gLineChart(spo2,wxBLUE,32768,false,false,true));
|
||||||
SPO2->AddLayer(new gXAxis(wxBLACK));
|
SPO2->AddLayer(new gXAxis(wxBLACK));
|
||||||
@ -858,12 +858,12 @@ void Daily::RefreshData()
|
|||||||
|
|
||||||
if (oxi) {
|
if (oxi) {
|
||||||
html=html+wxT("<tr><td colspan=2 align=center><i>")+_("Oximeter Information")+wxT("</i></td></tr>\n");
|
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"),d->summary_avg(OXI_PulseAverage))+wxT("</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"),d->summary_min(OXI_PulseMin))+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"),d->summary_max(OXI_PulseMax))+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"),d->summary_avg(OXI_SPO2Average))+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"),d->summary_min(OXI_SPO2Min))+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"),d->summary_max(OXI_SPO2Max))+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);
|
PULSE->Show(true);
|
||||||
SPO2->Show(true);
|
SPO2->Show(true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -208,7 +208,7 @@
|
|||||||
<property name="help"></property>
|
<property name="help"></property>
|
||||||
<property name="id">wxID_ANY</property>
|
<property name="id">wxID_ANY</property>
|
||||||
<property name="kind">wxITEM_NORMAL</property>
|
<property name="kind">wxITEM_NORMAL</property>
|
||||||
<property name="label">&Import SD</property>
|
<property name="label">&Import Data</property>
|
||||||
<property name="name">FileMenuImportSD</property>
|
<property name="name">FileMenuImportSD</property>
|
||||||
<property name="permission">none</property>
|
<property name="permission">none</property>
|
||||||
<property name="shortcut">F9</property>
|
<property name="shortcut">F9</property>
|
||||||
|
@ -1601,6 +1601,9 @@ void FlowData::Reload(Day *day)
|
|||||||
m_ready=true;
|
m_ready=true;
|
||||||
//graph->Refresh(false);
|
//graph->Refresh(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// This can be merged back in with PressureData (and can be renamed while we are at it)
|
||||||
SkipZeroData::SkipZeroData(MachineCode _code,int _field,int _size)
|
SkipZeroData::SkipZeroData(MachineCode _code,int _field,int _size)
|
||||||
:gPointData(_size),code(_code),field(_field)
|
:gPointData(_size),code(_code),field(_field)
|
||||||
{
|
{
|
||||||
@ -1622,7 +1625,7 @@ void SkipZeroData::Reload(Day *day)
|
|||||||
min_y=max_y=0;
|
min_y=max_y=0;
|
||||||
int tt=0;
|
int tt=0;
|
||||||
bool first=true;
|
bool first=true;
|
||||||
EventDataType lastp;
|
EventDataType lastp=0;
|
||||||
for (vector<Session *>::iterator s=day->begin();s!=day->end(); s++) {
|
for (vector<Session *>::iterator s=day->begin();s!=day->end(); s++) {
|
||||||
if ((*s)->events.find(code)==(*s)->events.end()) continue;
|
if ((*s)->events.find(code)==(*s)->events.end()) continue;
|
||||||
if (vc>=(int)point.size()) {
|
if (vc>=(int)point.size()) {
|
||||||
@ -1630,7 +1633,7 @@ void SkipZeroData::Reload(Day *day)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int t=0;
|
int t=0;
|
||||||
EventDataType p; //,lastp=-1;
|
EventDataType p;
|
||||||
for (vector<Event *>::iterator ev=(*s)->events[code].begin(); ev!=(*s)->events[code].end(); ev++) {
|
for (vector<Event *>::iterator ev=(*s)->events[code].begin(); ev!=(*s)->events[code].end(); ev++) {
|
||||||
p=(*(*ev))[field];
|
p=(*(*ev))[field];
|
||||||
if (p!=0) {
|
if (p!=0) {
|
||||||
@ -1639,6 +1642,7 @@ void SkipZeroData::Reload(Day *day)
|
|||||||
assert(t<max_points);
|
assert(t<max_points);
|
||||||
if (first) {
|
if (first) {
|
||||||
max_y=min_y=r.y;
|
max_y=min_y=r.y;
|
||||||
|
//lastp=p;
|
||||||
first=false;
|
first=false;
|
||||||
} else {
|
} else {
|
||||||
if (r.y<min_y) min_y=r.y;
|
if (r.y<min_y) min_y=r.y;
|
||||||
@ -1668,7 +1672,6 @@ void SkipZeroData::Reload(Day *day)
|
|||||||
if (min_y>1) min_y-=1;
|
if (min_y>1) min_y-=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//}
|
|
||||||
if (force_min_y!=force_max_y) {
|
if (force_min_y!=force_max_y) {
|
||||||
min_y=force_min_y;
|
min_y=force_min_y;
|
||||||
max_y=force_max_y;
|
max_y=force_max_y;
|
||||||
|
@ -127,35 +127,62 @@ bool CMS50Loader::OpenSPORFile(wxString path,Machine *mach,Profile *profile)
|
|||||||
if (br!=num_records) {
|
if (br!=num_records) {
|
||||||
wxLogDebug(wxT("Short .spoR File: ")+path);
|
wxLogDebug(wxT("Short .spoR File: ")+path);
|
||||||
}
|
}
|
||||||
char last_pulse=buffer[0];
|
|
||||||
char last_spo2=buffer[1];
|
|
||||||
EventDataType data[2];
|
|
||||||
wxDateTime last_pulse_time=date;
|
wxDateTime last_pulse_time=date;
|
||||||
wxDateTime last_spo2_time=date;
|
wxDateTime last_spo2_time=date;
|
||||||
data[0]=last_pulse;
|
|
||||||
data[1]=last_spo2;
|
EventDataType last_pulse=buffer[0];
|
||||||
|
EventDataType last_spo2=buffer[1];
|
||||||
|
EventDataType cp,cs;
|
||||||
|
|
||||||
Session *sess=new Session(mach,sessid);
|
Session *sess=new Session(mach,sessid);
|
||||||
sess->set_first(date);
|
sess->set_first(date);
|
||||||
sess->AddEvent(new Event(date,OXI_Pulse,data,1));
|
sess->AddEvent(new Event(date,OXI_Pulse,&last_pulse,1));
|
||||||
sess->AddEvent(new Event(date,OXI_SPO2,&data[1],1));
|
sess->AddEvent(new Event(date,OXI_SPO2,&last_spo2,1));
|
||||||
|
|
||||||
|
EventDataType PMin,PMax=0,SMin,SMax=0,PAvg=0,SAvg=0;
|
||||||
|
int PCnt=0,SCnt=0;
|
||||||
//wxDateTime
|
//wxDateTime
|
||||||
wxDateTime tt=date;
|
wxDateTime tt=date;
|
||||||
|
bool first_p=true,first_s=true;
|
||||||
|
|
||||||
for (int i=2;i<num_records;i+=2) {
|
for (int i=2;i<num_records;i+=2) {
|
||||||
if (last_pulse!=buffer[i]) {
|
cp=buffer[i];
|
||||||
data[0]=buffer[i];
|
cs=buffer[i+1];
|
||||||
sess->AddEvent(new Event(tt,OXI_Pulse,data,1));
|
if (last_pulse!=cp) {
|
||||||
|
sess->AddEvent(new Event(tt,OXI_Pulse,&cp,1));
|
||||||
|
if (cp>0) {
|
||||||
|
if (first_p) {
|
||||||
|
PMin=cp;
|
||||||
|
first_p=false;
|
||||||
|
} else {
|
||||||
|
if (PMin>cp) PMin=cp;
|
||||||
|
}
|
||||||
|
PAvg+=cp;
|
||||||
|
PCnt++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (last_spo2!=buffer[i+1]) {
|
if (last_spo2!=cs) {
|
||||||
data[1]=buffer[i+1];
|
sess->AddEvent(new Event(tt,OXI_SPO2,&cs,1));
|
||||||
sess->AddEvent(new Event(tt,OXI_SPO2,&data[1],1));
|
if (cs>0) {
|
||||||
|
if (first_s) {
|
||||||
|
SMin=cs;
|
||||||
|
first_s=false;
|
||||||
|
} else {
|
||||||
|
if (SMin>cs) SMin=cs;
|
||||||
|
}
|
||||||
|
SAvg+=cs;
|
||||||
|
SCnt++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
last_pulse=buffer[i];
|
last_pulse=cp;
|
||||||
last_spo2=buffer[i+1];
|
last_spo2=cs;
|
||||||
|
if (PMax<cp) PMax=cp;
|
||||||
|
if (SMax<cs) SMax=cs;
|
||||||
tt+=wxTimeSpan::Seconds(1);
|
tt+=wxTimeSpan::Seconds(1);
|
||||||
}
|
}
|
||||||
sess->AddEvent(new Event(tt,OXI_Pulse,data,1));
|
sess->AddEvent(new Event(tt,OXI_Pulse,&cp,1));
|
||||||
sess->AddEvent(new Event(tt,OXI_SPO2,&data[1],1));
|
sess->AddEvent(new Event(tt,OXI_SPO2,&cs,1));
|
||||||
|
|
||||||
sess->set_last(tt);
|
sess->set_last(tt);
|
||||||
wxTimeSpan t=sess->last()-sess->first();
|
wxTimeSpan t=sess->last()-sess->first();
|
||||||
@ -163,12 +190,15 @@ bool CMS50Loader::OpenSPORFile(wxString path,Machine *mach,Profile *profile)
|
|||||||
double hours=(t.GetSeconds().GetLo()/3600.0);
|
double hours=(t.GetSeconds().GetLo()/3600.0);
|
||||||
sess->set_hours(hours);
|
sess->set_hours(hours);
|
||||||
|
|
||||||
sess->summary[OXI_PulseAverage]=sess->weighted_avg_event_field(OXI_Pulse,0);
|
EventDataType pa=0,sa=0;
|
||||||
sess->summary[OXI_PulseMin]=sess->min_event_field(OXI_Pulse,0);
|
if (PCnt>0) pa=PAvg/double(PCnt);
|
||||||
sess->summary[OXI_PulseMax]=sess->max_event_field(OXI_Pulse,0);
|
if (SCnt>0) sa=SAvg/double(SCnt);
|
||||||
sess->summary[OXI_SPO2Average]=sess->weighted_avg_event_field(OXI_SPO2,0);
|
sess->summary[OXI_PulseAverage]=pa;
|
||||||
sess->summary[OXI_SPO2Min]=sess->min_event_field(OXI_SPO2,0);
|
sess->summary[OXI_PulseMin]=PMin;
|
||||||
sess->summary[OXI_SPO2Max]=sess->max_event_field(OXI_SPO2,0);
|
sess->summary[OXI_PulseMax]=PMax;
|
||||||
|
sess->summary[OXI_SPO2Average]=sa;
|
||||||
|
sess->summary[OXI_SPO2Min]=SMin;
|
||||||
|
sess->summary[OXI_SPO2Max]=SMax;
|
||||||
|
|
||||||
mach->AddSession(sess,profile);
|
mach->AddSession(sess,profile);
|
||||||
sess->SetChanged(true);
|
sess->SetChanged(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user