mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-09 04:30:43 +00:00
Added Target Vent overview graph. Trialing nth_element for Perecentile calcs.
This commit is contained in:
parent
4027304aea
commit
8996ec33cc
@ -6,6 +6,7 @@
|
||||
|
||||
#include "day.h"
|
||||
#include "profiles.h"
|
||||
#include <algorithm>
|
||||
|
||||
Day::Day(Machine *m)
|
||||
:machine(m)
|
||||
@ -146,11 +147,15 @@ EventDataType Day::settings_wavg(ChannelID code)
|
||||
tmp=(s1/s2);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EventDataType Day::percentile(ChannelID code,EventDataType percentile)
|
||||
{
|
||||
// Cache this calculation
|
||||
|
||||
|
||||
//if (percentile>=1) return 0; // probably better to crash and burn.
|
||||
|
||||
QVector<Session *>::iterator s;
|
||||
@ -174,21 +179,28 @@ EventDataType Day::percentile(ChannelID code,EventDataType percentile)
|
||||
if (!size)
|
||||
return 0;
|
||||
size--;
|
||||
qSort(ar);
|
||||
int p=EventDataType(size)*percentile;
|
||||
float p2=EventDataType(size)*percentile;
|
||||
float diff=p2-p;
|
||||
EventDataType val=ar[p];
|
||||
if (diff>0) {
|
||||
int s=p+1;
|
||||
if (s>size-1) s=size-1;
|
||||
EventDataType v2=ar[s];
|
||||
EventDataType v3=v2-val;
|
||||
if (v3>0) {
|
||||
val+=v3*diff;
|
||||
}
|
||||
|
||||
}
|
||||
QVector<EventDataType>::iterator first=ar.begin();
|
||||
QVector<EventDataType>::iterator last=ar.end();
|
||||
QVector<EventDataType>::iterator middle = first + int((last-first) * percentile);
|
||||
std::nth_element(first,middle,last);
|
||||
EventDataType val=*middle;
|
||||
|
||||
// qSort(ar);
|
||||
// int p=EventDataType(size)*percentile;
|
||||
// float p2=EventDataType(size)*percentile;
|
||||
// float diff=p2-p;
|
||||
// EventDataType val=ar[p];
|
||||
// if (diff>0) {
|
||||
// int s=p+1;
|
||||
// if (s>size-1) s=size-1;
|
||||
// EventDataType v2=ar[s];
|
||||
// EventDataType v3=v2-val;
|
||||
// if (v3>0) {
|
||||
// val+=v3*diff;
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
return val;
|
||||
}
|
||||
|
@ -762,20 +762,20 @@ int ResmedLoader::Open(QString & path,Profile *profile)
|
||||
if (stredf.lookup.contains("Tid Vol Med")) {
|
||||
sig=stredf.lookup["Tid Vol Med"];
|
||||
valmed=sig->data[dn];
|
||||
sess->setMedian(CPAP_TidalVolume,valmed*sig->gain);
|
||||
sess->m_gain[CPAP_TidalVolume]=sig->gain;
|
||||
sess->setMedian(CPAP_TidalVolume,valmed*sig->gain*1000.0);
|
||||
sess->m_gain[CPAP_TidalVolume]=sig->gain*1000.0;
|
||||
sess->m_valuesummary[CPAP_TidalVolume][valmed]=51;
|
||||
}
|
||||
if (stredf.lookup.contains("Tid Vol 95")) {
|
||||
sig=stredf.lookup["Tid Vol 95"];
|
||||
val95=sig->data[dn];
|
||||
sess->set95p(CPAP_TidalVolume,val95*sig->gain);
|
||||
sess->set95p(CPAP_TidalVolume,val95*sig->gain*1000.0);
|
||||
sess->m_valuesummary[CPAP_TidalVolume][val95]=45;
|
||||
}
|
||||
if (stredf.lookup.contains("Tid Vol Max")) {
|
||||
sig=stredf.lookup["Tid Vol Max"];
|
||||
valmax=sig->data[dn];
|
||||
sess->setMax(CPAP_TidalVolume,valmax*sig->gain);
|
||||
sess->setMax(CPAP_TidalVolume,valmax*sig->gain*1000.0);
|
||||
sess->m_valuesummary[CPAP_TidalVolume][valmax]=4;
|
||||
}
|
||||
|
||||
|
@ -845,28 +845,34 @@ EventDataType Profile::calcPercentile(ChannelID code, EventDataType percent, Mac
|
||||
if (idx>array.size()-1) idx=array.size()-1;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
QVector<EventDataType>::iterator first=array.begin();
|
||||
QVector<EventDataType>::iterator last=array.end();
|
||||
QVector<EventDataType>::iterator middle = first + int((last-first) * percent);
|
||||
std::nth_element(first,middle,last);
|
||||
val=*middle;
|
||||
|
||||
return val;
|
||||
// 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;
|
||||
// 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;
|
||||
|
||||
}
|
||||
|
||||
|
@ -567,8 +567,7 @@ void Session::updateCountSummary(ChannelID code)
|
||||
qint32 len;
|
||||
for (int i=0;i<ev.value().size();i++) {
|
||||
EventList & e=*(ev.value()[i]);
|
||||
if (e.type()==EVL_Waveform) continue;
|
||||
|
||||
//if (e.type()==EVL_Waveform) continue;
|
||||
|
||||
for (unsigned j=0;j<e.count();j++) {
|
||||
raw=e.raw(j);
|
||||
@ -614,9 +613,8 @@ void Session::UpdateSummaries()
|
||||
EventList * el=c.value()[0];
|
||||
EventDataType gain=el->gain();
|
||||
m_gain[id]=gain;
|
||||
} else m_gain[id]=0;
|
||||
|
||||
if ((id!=CPAP_FlowRate) && (id!=CPAP_MaskPressure))
|
||||
}
|
||||
if (!((id==CPAP_FlowRate) || (id==CPAP_MaskPressure)))
|
||||
updateCountSummary(id);
|
||||
|
||||
Min(id);
|
||||
|
@ -934,6 +934,9 @@ void Daily::Load(QDate date)
|
||||
|
||||
ChannelID code=chans[i];
|
||||
if (cpap && cpap->channelHasData(code)) {
|
||||
if (code==CPAP_RespRate) {
|
||||
int i=5;
|
||||
}
|
||||
//if (code==CPAP_LeakTotal) suboffset=PROFILEIntentionalLeak"].toDouble(); else suboffset=0;
|
||||
QString tooltip=schema::channel[code].description();
|
||||
if (!schema::channel[code].units().isEmpty()) tooltip+=" ("+schema::channel[code].units()+")";
|
||||
|
@ -45,11 +45,11 @@ Important: One id code per item, DO NOT CHANGE ID NUMBERS!!!
|
||||
<channel id="0x110d" class="data" name="IPAP" details="Inspiratory Pressure" label="IPAP" unit="cmH20" color="orange"/>
|
||||
<channel id="0x110e" class="data" name="EPAP" details="Expiratory Pressure" label="EPAP" unit="cmH20" color="light blue"/>
|
||||
<channel id="0x110f" class="data" name="PS" details="Pressure Support" label="PS" unit="cmH20" color="dark blue"/>
|
||||
<channel id="0x1110" class="data" name="IPAPLo" details="Inspiratory Pressure Lo" label="IPAP Lo" unit="cmH20" color="grey"/>
|
||||
<channel id="0x1111" class="data" name="IPAPHi" details="Inspiratory Pressure Hi" label="IPAP Hi" unit="cmH20" color="grey"/>
|
||||
<channel id="0x1110" class="data" name="IPAPLo" details="Inspiratory Pressure Lo" label="IPAP" unit="cmH20" color="grey"/>
|
||||
<channel id="0x1111" class="data" name="IPAPHi" details="Inspiratory Pressure Hi" label="IPAP" unit="cmH20" color="grey"/>
|
||||
<channel id="0x1112" class="data" name="RespEvent" details="Respiratory Events" label="Resp Events" unit="" color="black"/>
|
||||
<channel id="0x1113" class="data" name="FLG" details="Flow Limit Graph" label="Flow Limit" unit="0<n<1" color="dark grey"/>
|
||||
<channel id="0x1114" class="data" name="TgMV" details="Target Minute Ventilation" label="Trgt Min Vent." unit="" color="dark cyan"/>
|
||||
<channel id="0x1114" class="data" name="TgMV" details="Target Minute Ventilation" label="Target Vent." unit="" color="dark cyan"/>
|
||||
<channel id="0x1115" class="data" name="MaxLeak" details="Maximum Leak" label="MaxLeaks" unit="L/min" color="dark red"/>
|
||||
<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"/>
|
||||
|
20
overview.cpp
20
overview.cpp
@ -107,6 +107,7 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
|
||||
RR=createGraph(tr("Resp. Rate"),tr("Respiratory\nRate\n(breaths/min)"));
|
||||
TV=createGraph(tr("Tidal Volume"),tr("Tidal\nVolume\n(ml)"));
|
||||
MV=createGraph(tr("Minute Vent."),tr("Minute\nVentilation\n(L/min)"));
|
||||
TGMV=createGraph(tr("Target Vent."),tr("Target\nVentilation\n(L/min)"));
|
||||
PTB=createGraph(tr("Pat. Trig. Br."),tr("Patient\nTriggered\nBreaths\n(%)"));
|
||||
SES=createGraph(tr("Sessions"),tr("Sessions\n(count)"));
|
||||
PULSE=createGraph(tr("Pulse Rate"),tr("Pulse Rate\n(bpm)"));
|
||||
@ -146,7 +147,7 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
|
||||
spo2=new SummaryChart(STR_TR_SpO2,GT_LINE);
|
||||
spo2->setMachineType(MT_OXIMETER);
|
||||
spo2->addSlice(OXI_SPO2,QColor("cyan"),ST_WAVG,true);
|
||||
spo2->addSlice(OXI_SPO2,QColor("light blue"),ST_90P,true,0.95);
|
||||
spo2->addSlice(OXI_SPO2,QColor("light blue"),ST_PERC,true,0.95);
|
||||
spo2->addSlice(OXI_SPO2,QColor("blue"),ST_MIN,true);
|
||||
SPO2->AddLayer(spo2);
|
||||
|
||||
@ -190,21 +191,32 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
|
||||
rr->addSlice(CPAP_RespRate,QColor("light blue"),ST_MIN,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("green"),ST_MAX,true);
|
||||
rr->addSlice(CPAP_RespRate,QColor("green"),ST_PERC,true,0.999);
|
||||
// rr->addSlice(CPAP_RespRate,QColor("green"),ST_MAX,true);
|
||||
RR->AddLayer(rr);
|
||||
|
||||
tv=new SummaryChart(tr("L/b"),GT_LINE);
|
||||
tv->addSlice(CPAP_TidalVolume,QColor("light blue"),ST_MIN,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("green"),ST_PERC,true,0.999);
|
||||
TV->AddLayer(tv);
|
||||
|
||||
mv=new SummaryChart(tr("L/m"),GT_LINE);
|
||||
mv->addSlice(CPAP_MinuteVent,QColor("light blue"),ST_MIN,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("green"),ST_PERC,true,0.999);
|
||||
MV->AddLayer(mv);
|
||||
|
||||
tgmv=new SummaryChart(tr("L/m"),GT_LINE);
|
||||
tgmv->addSlice(CPAP_TgMV,QColor("light blue"),ST_MIN,true);
|
||||
tgmv->addSlice(CPAP_TgMV,QColor("light green"),ST_PERC,true,0.95);
|
||||
tgmv->addSlice(CPAP_TgMV,QColor("blue"),ST_WAVG,true);
|
||||
tgmv->addSlice(CPAP_TgMV,QColor("green"),ST_PERC,true,0.999);
|
||||
TGMV->AddLayer(tgmv);
|
||||
|
||||
|
||||
|
||||
ptb=new SummaryChart(tr("%PTB"),GT_LINE);
|
||||
ptb->addSlice(CPAP_PTB,QColor("yellow"),ST_MIN,true);
|
||||
@ -238,10 +250,10 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
|
||||
|
||||
lk=new SummaryChart(tr("Avg Leak"),GT_LINE);
|
||||
lk->addSlice(CPAP_Leak,QColor("dark grey"),ST_PERC,false,0.95);
|
||||
lk->addSlice(CPAP_Leak,QColor("light blue"),ST_PERC,false,0.5);
|
||||
lk->addSlice(CPAP_Leak,QColor("dark blue"),ST_WAVG,false);
|
||||
lk->addSlice(CPAP_Leak,QColor("grey"),ST_MAX,false);
|
||||
lk->addSlice(CPAP_Leak,QColor("grey"),ST_PERC,false,0.999);
|
||||
//lk->addSlice(CPAP_Leak,QColor("dark yellow"));
|
||||
//pr->addSlice(CPAP_IPAP,QColor("red"));
|
||||
LK->AddLayer(lk);
|
||||
|
||||
NPB->AddLayer(npb=new SummaryChart(tr("% PB"),GT_BAR));
|
||||
|
@ -58,8 +58,8 @@ public:
|
||||
\param QString units The units of measurements to show in the popup */
|
||||
gGraph * createGraph(QString name,QString units="",YTickerType yttype=YT_Number);
|
||||
|
||||
gGraph *AHI, *AHIHR, *UC, *US, *PR,*LK,*NPB,*SET,*SES,*RR,*MV,*TV,*PTB,*PULSE,*SPO2,*WEIGHT,*ZOMBIE, *BMI;
|
||||
SummaryChart *bc,*uc, *us, *pr,*lk,*npb,*set,*ses,*rr,*mv,*tv,*ptb,*pulse,*spo2,*weight,*zombie, *bmi, *ahihr;
|
||||
gGraph *AHI, *AHIHR, *UC, *US, *PR,*LK,*NPB,*SET,*SES,*RR,*MV,*TV,*PTB,*PULSE,*SPO2,*WEIGHT,*ZOMBIE, *BMI, *TGMV;
|
||||
SummaryChart *bc,*uc, *us, *pr,*lk,*npb,*set,*ses,*rr,*mv,*tv,*ptb,*pulse,*spo2,*weight,*zombie, *bmi, *ahihr, *tgmv;
|
||||
|
||||
//! \breif List of SummaryCharts shown on the overview page
|
||||
QVector<SummaryChart *> OverviewCharts;
|
||||
|
Loading…
Reference in New Issue
Block a user