mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 10:40:42 +00:00
Enhance CSV output with Maximums, Flow Limitations and Session data.\nUse Preference values to select average and maximum values.
This commit is contained in:
parent
cfde6934d6
commit
d361d665aa
@ -2197,6 +2197,31 @@ EventDataType Session::wavg(ChannelID id)
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EventDataType Session::calcMiddle(ChannelID code)
|
||||||
|
{
|
||||||
|
int c = p_profile->general->prefCalcMiddle();
|
||||||
|
|
||||||
|
if (c == 0) {
|
||||||
|
return percentile(code, 0.5); // Median
|
||||||
|
} else if (c == 1 ) {
|
||||||
|
return wavg(code); // Weighted Average
|
||||||
|
} else {
|
||||||
|
return avg(code); // Average
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EventDataType Session::calcMax(ChannelID code)
|
||||||
|
{
|
||||||
|
return p_profile->general->prefCalcMax() ? percentile(code, 0.995f) : Max(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
EventDataType Session::calcPercentile(ChannelID code)
|
||||||
|
{
|
||||||
|
double p = p_profile->general->prefCalcPercentile() / 100.0;
|
||||||
|
return percentile(code, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
EventList *Session::AddEventList(ChannelID code, EventListType et, EventDataType gain,
|
EventList *Session::AddEventList(ChannelID code, EventListType et, EventDataType gain,
|
||||||
EventDataType offset, EventDataType min, EventDataType max, EventDataType rate, bool second_field)
|
EventDataType offset, EventDataType min, EventDataType max, EventDataType rate, bool second_field)
|
||||||
{
|
{
|
||||||
|
@ -346,6 +346,11 @@ class Session
|
|||||||
//! \brief Returns the amount of time (in decimal minutes) the Channel spent below the threshold
|
//! \brief Returns the amount of time (in decimal minutes) the Channel spent below the threshold
|
||||||
EventDataType timeBelowThreshold(ChannelID id, EventDataType threshold);
|
EventDataType timeBelowThreshold(ChannelID id, EventDataType threshold);
|
||||||
|
|
||||||
|
//! \brief According to preferences..
|
||||||
|
EventDataType calcMiddle(ChannelID code);
|
||||||
|
EventDataType calcMax(ChannelID code);
|
||||||
|
EventDataType calcPercentile(ChannelID code);
|
||||||
|
|
||||||
//! \brief Returns true if the channel has events loaded, or a record of a count for when they are not
|
//! \brief Returns true if the channel has events loaded, or a record of a count for when they are not
|
||||||
bool channelExists(ChannelID name);
|
bool channelExists(ChannelID name);
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ void ExportCSV::on_exportButton_clicked()
|
|||||||
// fields.append(DumpField(NoChannel,MT_CPAP,ST_SESSIONS));
|
// fields.append(DumpField(NoChannel,MT_CPAP,ST_SESSIONS));
|
||||||
|
|
||||||
|
|
||||||
QList<ChannelID> countlist, avglist, p90list;
|
QList<ChannelID> countlist, avglist, p90list, maxlist;
|
||||||
countlist.append(CPAP_Hypopnea);
|
countlist.append(CPAP_Hypopnea);
|
||||||
countlist.append(CPAP_Obstructive);
|
countlist.append(CPAP_Obstructive);
|
||||||
countlist.append(CPAP_Apnea);
|
countlist.append(CPAP_Apnea);
|
||||||
@ -180,16 +180,23 @@ void ExportCSV::on_exportButton_clicked()
|
|||||||
countlist.append(CPAP_UserFlag2);
|
countlist.append(CPAP_UserFlag2);
|
||||||
countlist.append(CPAP_PressurePulse);
|
countlist.append(CPAP_PressurePulse);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
avglist.append(CPAP_Pressure);
|
avglist.append(CPAP_Pressure);
|
||||||
avglist.append(CPAP_IPAP);
|
avglist.append(CPAP_IPAP);
|
||||||
avglist.append(CPAP_EPAP);
|
avglist.append(CPAP_EPAP);
|
||||||
|
avglist.append(CPAP_FLG); // Pholynyk, 25Aug2015, add ResMed Flow Limitation
|
||||||
|
|
||||||
p90list.append(CPAP_Pressure);
|
p90list.append(CPAP_Pressure);
|
||||||
p90list.append(CPAP_IPAP);
|
p90list.append(CPAP_IPAP);
|
||||||
p90list.append(CPAP_EPAP);
|
p90list.append(CPAP_EPAP);
|
||||||
EventDataType percent = 0.90F;
|
p90list.append(CPAP_FLG);
|
||||||
|
|
||||||
|
float percentile=p_profile->general->prefCalcPercentile()/100.0; // Pholynyk, 18Aug2015
|
||||||
|
EventDataType percent = percentile; // was 0.90F
|
||||||
|
|
||||||
|
maxlist.append(CPAP_Pressure); // Pholynyk, 18Aug2015, add maximums
|
||||||
|
maxlist.append(CPAP_IPAP);
|
||||||
|
maxlist.append(CPAP_EPAP);
|
||||||
|
maxlist.append(CPAP_FLG);
|
||||||
|
|
||||||
// Not sure this section should be translateable.. :-/
|
// Not sure this section should be translateable.. :-/
|
||||||
if (ui->rb1_details->isChecked()) {
|
if (ui->rb1_details->isChecked()) {
|
||||||
@ -208,11 +215,15 @@ void ExportCSV::on_exportButton_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < avglist.size(); i++) {
|
for (int i = 0; i < avglist.size(); i++) {
|
||||||
header += sep + schema::channel[avglist[i]].label() + " " + tr(" Avg");
|
header += sep + Day::calcMiddleLabel(avglist[i]); // Pholynyk, 18Aug2015
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < p90list.size(); i++) {
|
for (int i = 0; i < p90list.size(); i++) {
|
||||||
header += sep + schema::channel[p90list[i]].label() + tr(" %1%").arg(percent*100.0, 0, 'f', 0);
|
header += sep + tr(" %1%").arg(percent*100.0, 0, 'f', 0) + schema::channel[p90list[i]].label();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < maxlist.size(); i++) {
|
||||||
|
header += sep + Day::calcMaxLabel(maxlist[i]); // added -- Pholynyk, 18Aug2015
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,11 +267,18 @@ void ExportCSV::on_exportButton_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < avglist.size(); i++) {
|
for (int i = 0; i < avglist.size(); i++) {
|
||||||
data += sep + QString::number(day->wavg(avglist.at(i)));
|
float avg = day->calcMiddle(avglist.at(i));
|
||||||
|
data += sep + QString::number(avg); // Pholynyk, 11Aug2015
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < p90list.size(); i++) {
|
for (int i = 0; i < p90list.size(); i++) {
|
||||||
data += sep + QString::number(day->p90(p90list.at(i)));
|
float p90 = day->percentile(p90list.at(i), percent);
|
||||||
|
data += sep + QString::number(p90); // Pholynyk, 11Aug2015
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < maxlist.size(); i++) {
|
||||||
|
float max = day->calcMax(maxlist.at(i));
|
||||||
|
data += sep + QString::number(max); // added -- Pholynyk, 18Aug2015
|
||||||
}
|
}
|
||||||
|
|
||||||
data += newline;
|
data += newline;
|
||||||
@ -292,11 +310,15 @@ void ExportCSV::on_exportButton_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < avglist.size(); j++) {
|
for (int j = 0; j < avglist.size(); j++) {
|
||||||
data += sep + QString::number(day->wavg(avglist.at(j)));
|
data += sep + QString::number(sess->calcMiddle(avglist.at(j))); // Pholynyk, 11Aug2015
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < p90list.size(); j++) {
|
for (int j = 0; j < p90list.size(); j++) {
|
||||||
data += sep + QString::number(day->p90(p90list.at(j)));
|
data += sep + QString::number(sess->percentile(p90list.at(j), percent)); // Pholynyk, 11Aug2015
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < maxlist.size(); i++) {
|
||||||
|
data += sep + QString::number(sess->calcMax(maxlist.at(i))); // Pholynyk, 11Aug2015
|
||||||
}
|
}
|
||||||
|
|
||||||
data += newline;
|
data += newline;
|
||||||
|
Loading…
Reference in New Issue
Block a user