mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-07 11:40:42 +00:00
ResMed Loader Rework
This commit is contained in:
parent
53addb62e7
commit
b1e81fc8b1
@ -1174,13 +1174,18 @@ EventDataType Day::count(ChannelID code)
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Day::summaryOnly()
|
bool Day::summaryOnly(Machine * mach)
|
||||||
{
|
{
|
||||||
QList<Session *>::iterator end = sessions.end();
|
QList<Session *>::iterator end = sessions.end();
|
||||||
for (QList<Session *>::iterator it = sessions.begin(); it != end; ++it) {
|
for (QList<Session *>::iterator it = sessions.begin(); it != end; ++it) {
|
||||||
Session & sess = *(*it);
|
Session & sess = *(*it);
|
||||||
if (sess.summaryOnly())
|
if ((mach == nullptr) && sess.summaryOnly()) {
|
||||||
|
// If this day generally has just summary data.
|
||||||
return true;
|
return true;
|
||||||
|
} else if ((mach == sess.machine()) && sess.summaryOnly()) {
|
||||||
|
// Focus only on machine mach
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1467,6 +1472,14 @@ bool Day::searchMachine(MachineType mt) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Day::hasMachine(Machine * mach)
|
||||||
|
{
|
||||||
|
for (int i=0; i < sessions.size(); ++i) {
|
||||||
|
if (sessions.at(i)->machine() == mach)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
QString Day::getCPAPMode()
|
QString Day::getCPAPMode()
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* SleepLib Day Class Header
|
/* SleepLib Day Class Header
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011-2018 Mark Watkins <mark@jedimark.net>
|
* Copyright (C) 2011-2018 Mark Watkins <mark@jedimark.net>
|
||||||
*
|
*
|
||||||
@ -91,8 +91,13 @@ class Day
|
|||||||
//! \brief Returns if the cache contains SummaryType information about the requested code
|
//! \brief Returns if the cache contains SummaryType information about the requested code
|
||||||
bool hasData(ChannelID code, SummaryType type);
|
bool hasData(ChannelID code, SummaryType type);
|
||||||
|
|
||||||
|
//! \brief Returns true if Day has specific machine type
|
||||||
inline bool hasMachine(MachineType mt) const { return machines.contains(mt); }
|
inline bool hasMachine(MachineType mt) const { return machines.contains(mt); }
|
||||||
|
|
||||||
|
//! \brief Returns true if Day has specific machine record
|
||||||
|
bool hasMachine(Machine * mach);
|
||||||
|
|
||||||
|
//! \brief Returns true if any sessions have records matching specific machine type
|
||||||
bool searchMachine(MachineType mt);
|
bool searchMachine(MachineType mt);
|
||||||
|
|
||||||
//! \brief Returns the Average of all Sessions setting 'code' for this day
|
//! \brief Returns the Average of all Sessions setting 'code' for this day
|
||||||
@ -183,7 +188,7 @@ class Day
|
|||||||
QList<Session *>::iterator end() { return sessions.end(); }
|
QList<Session *>::iterator end() { return sessions.end(); }
|
||||||
|
|
||||||
//! \brief Check if day contains SummaryOnly records
|
//! \brief Check if day contains SummaryOnly records
|
||||||
bool summaryOnly();
|
bool summaryOnly(Machine * mach = nullptr);
|
||||||
|
|
||||||
//! \brief Finds and returns the index of a session, otherwise -1 if it's not there
|
//! \brief Finds and returns the index of a session, otherwise -1 if it's not there
|
||||||
int find(Session *sess) { return sessions.indexOf(sess); }
|
int find(Session *sess) { return sessions.indexOf(sess); }
|
||||||
|
@ -88,22 +88,21 @@ bool EDFParser::Parse()
|
|||||||
serialnumber += recordingident[i];
|
serialnumber += recordingident[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
QDateTime startDate = QDateTime::fromString(QString::fromLatin1(header.datetime, 16), "dd.MM.yyHH.mm.ss");
|
startdate_orig = QDateTime::fromString(QString::fromLatin1(header.datetime, 16), "dd.MM.yyHH.mm.ss");
|
||||||
//startDate.toTimeSpec(Qt::UTC);
|
|
||||||
|
|
||||||
QDate d2 = startDate.date();
|
QDate d2 = startdate_orig.date();
|
||||||
|
|
||||||
if (d2.year() < 2000) {
|
if (d2.year() < 2000) {
|
||||||
d2.setDate(d2.year() + 100, d2.month(), d2.day());
|
d2.setDate(d2.year() + 100, d2.month(), d2.day());
|
||||||
startDate.setDate(d2);
|
startdate_orig.setDate(d2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!startDate.isValid()) {
|
if (!startdate_orig.isValid()) {
|
||||||
qDebug() << "Invalid date time retreieved parsing EDF File " << filename;
|
qDebug() << "Invalid date time retreieved parsing EDF File " << filename;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
startdate = qint64(startDate.toTime_t()) * 1000L;
|
startdate = qint64(startdate_orig.toTime_t()) * 1000L;
|
||||||
//startdate-=timezoneOffset();
|
//startdate-=timezoneOffset();
|
||||||
|
|
||||||
//qDebug() << startDate.toString("yyyy-MM-dd HH:mm:ss");
|
//qDebug() << startDate.toString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
@ -159,6 +159,7 @@ class EDFParser
|
|||||||
QString patientident;
|
QString patientident;
|
||||||
QString recordingident;
|
QString recordingident;
|
||||||
QString serialnumber;
|
QString serialnumber;
|
||||||
|
QDateTime startdate_orig;
|
||||||
qint64 startdate;
|
qint64 startdate;
|
||||||
qint64 enddate;
|
qint64 enddate;
|
||||||
QString reserved44;
|
QString reserved44;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -36,14 +36,15 @@ public:
|
|||||||
ResMedEDFParser(QString filename = "");
|
ResMedEDFParser(QString filename = "");
|
||||||
~ResMedEDFParser();
|
~ResMedEDFParser();
|
||||||
EDFSignal *lookupSignal(ChannelID ch);
|
EDFSignal *lookupSignal(ChannelID ch);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct STRRecord
|
struct STRRecord
|
||||||
{
|
{
|
||||||
STRRecord() {
|
STRRecord() {
|
||||||
maskon = 0;
|
maskon.clear();
|
||||||
maskoff = 0;
|
maskoff.clear();
|
||||||
maskdur = 0;
|
maskdur = 0;
|
||||||
maskevents = -1;
|
maskevents = -1;
|
||||||
mode = -1;
|
mode = -1;
|
||||||
@ -127,6 +128,10 @@ struct STRRecord
|
|||||||
leak95 = copy.leak95;
|
leak95 = copy.leak95;
|
||||||
leakmax = copy.leakmax;
|
leakmax = copy.leakmax;
|
||||||
leakgain = copy.leakgain;
|
leakgain = copy.leakgain;
|
||||||
|
s_EPREnable = copy.s_EPREnable;
|
||||||
|
s_EPR_ClinEnable = copy.s_EPREnable;
|
||||||
|
s_RampEnable = copy.s_RampEnable;
|
||||||
|
s_RampTime = copy.s_RampTime;
|
||||||
|
|
||||||
s_SmartStart = copy.s_SmartStart;
|
s_SmartStart = copy.s_SmartStart;
|
||||||
s_PtAccess = copy.s_PtAccess;
|
s_PtAccess = copy.s_PtAccess;
|
||||||
@ -141,8 +146,9 @@ struct STRRecord
|
|||||||
s_Temp = copy.s_Temp;
|
s_Temp = copy.s_Temp;
|
||||||
ramp_pressure = copy.ramp_pressure;
|
ramp_pressure = copy.ramp_pressure;
|
||||||
}
|
}
|
||||||
quint32 maskon;
|
QVector<quint32> maskon;
|
||||||
quint32 maskoff;
|
QVector<quint32> maskoff;
|
||||||
|
|
||||||
EventDataType maskdur;
|
EventDataType maskdur;
|
||||||
EventDataType maskevents;
|
EventDataType maskevents;
|
||||||
EventDataType mode;
|
EventDataType mode;
|
||||||
@ -218,7 +224,47 @@ struct EDFGroup {
|
|||||||
QString SAD;
|
QString SAD;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ResmedImport:public ImportTask
|
struct EDFduration {
|
||||||
|
EDFduration() { start = end = 0; type = EDF_UNKNOWN; }
|
||||||
|
EDFduration(const EDFduration & copy) {
|
||||||
|
path = copy.path;
|
||||||
|
start = copy.start;
|
||||||
|
end = copy.end;
|
||||||
|
type = copy.type;
|
||||||
|
filename = copy.filename;
|
||||||
|
}
|
||||||
|
EDFduration(quint32 start, quint32 end, QString path) :
|
||||||
|
start(start), end(end), path(path) {}
|
||||||
|
quint32 start;
|
||||||
|
quint32 end;
|
||||||
|
QString path;
|
||||||
|
QString filename;
|
||||||
|
EDFType type;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ResMedDay {
|
||||||
|
QDate date;
|
||||||
|
STRRecord str;
|
||||||
|
QHash<QString, QString> files;
|
||||||
|
// QHash<QString, EDFduration> durations;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class ResDayTask:public ImportTask
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ResDayTask(ResmedLoader * l, Machine * m, ResMedDay * d): loader(l), mach(m), resday(d) {}
|
||||||
|
virtual ~ResDayTask() {}
|
||||||
|
virtual void run();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
ResmedLoader * loader;
|
||||||
|
Machine * mach;
|
||||||
|
ResMedDay * resday;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*class ResmedImport:public ImportTask
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ResmedImport(ResmedLoader * l, SessionID s, QHash<EDFType, QStringList> grp, Machine * m): loader(l), sessionid(s), files(grp), mach(m) {}
|
ResmedImport(ResmedLoader * l, SessionID s, QHash<EDFType, QStringList> grp, Machine * m): loader(l), sessionid(s), files(grp), mach(m) {}
|
||||||
@ -243,7 +289,9 @@ protected:
|
|||||||
ResmedLoader * loader;
|
ResmedLoader * loader;
|
||||||
STRRecord R;
|
STRRecord R;
|
||||||
Machine * mach;
|
Machine * mach;
|
||||||
};
|
}; */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*! \class ResmedLoader
|
/*! \class ResmedLoader
|
||||||
@ -317,10 +365,12 @@ class ResmedLoader : public CPAPLoader
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
volatile int sessionCount;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void ParseSTR(Machine *mach, const QStringList & strfiles);
|
void ParseSTR(Machine *mach, const QStringList & strfiles);
|
||||||
|
|
||||||
|
|
||||||
//! \brief Scan for new files to import, group into sessions and add to task que
|
//! \brief Scan for new files to import, group into sessions and add to task que
|
||||||
int scanFiles(Machine * mach, const QString & datalog_path);
|
int scanFiles(Machine * mach, const QString & datalog_path);
|
||||||
|
|
||||||
@ -329,6 +379,7 @@ protected:
|
|||||||
QMap<SessionID, QStringList> sessfiles;
|
QMap<SessionID, QStringList> sessfiles;
|
||||||
QMap<quint32, STRRecord> strsess;
|
QMap<quint32, STRRecord> strsess;
|
||||||
QMap<QDate, QList<STRRecord *> > strdate;
|
QMap<QDate, QList<STRRecord *> > strdate;
|
||||||
|
QHash<QDate, ResMedDay> resdayList;
|
||||||
|
|
||||||
#ifdef DEBUG_EFFICIENCY
|
#ifdef DEBUG_EFFICIENCY
|
||||||
QHash<ChannelID, qint64> channel_efficiency;
|
QHash<ChannelID, qint64> channel_efficiency;
|
||||||
|
@ -185,7 +185,7 @@ void MachineLoader::runTasks(bool threaded)
|
|||||||
float f = float(m_currenttask) / float(m_totaltasks) * 100.0;
|
float f = float(m_currenttask) / float(m_totaltasks) * 100.0;
|
||||||
|
|
||||||
m_currenttask++;
|
m_currenttask++;
|
||||||
if ((m_currenttask % 50)==0) {
|
if ((m_currenttask % 10)==0) {
|
||||||
qprogress->setValue(f);
|
qprogress->setValue(f);
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
}
|
}
|
||||||
@ -207,7 +207,7 @@ void MachineLoader::runTasks(bool threaded)
|
|||||||
|
|
||||||
// update progress bar
|
// update progress bar
|
||||||
m_currenttask++;
|
m_currenttask++;
|
||||||
if ((m_currenttask % 50) == 0) {
|
if ((m_currenttask % 10) == 0) {
|
||||||
qprogress->setValue(m_currenttask);
|
qprogress->setValue(m_currenttask);
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user