mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 02:30:44 +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;
|
||||
}
|
||||
|
||||
bool Day::summaryOnly()
|
||||
bool Day::summaryOnly(Machine * mach)
|
||||
{
|
||||
QList<Session *>::iterator end = sessions.end();
|
||||
for (QList<Session *>::iterator it = sessions.begin(); it != end; ++it) {
|
||||
Session & sess = *(*it);
|
||||
if (sess.summaryOnly())
|
||||
if ((mach == nullptr) && sess.summaryOnly()) {
|
||||
// If this day generally has just summary data.
|
||||
return true;
|
||||
} else if ((mach == sess.machine()) && sess.summaryOnly()) {
|
||||
// Focus only on machine mach
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1460,13 +1465,21 @@ bool Day::removeSession(Session *sess)
|
||||
return b;
|
||||
}
|
||||
bool Day::searchMachine(MachineType mt) {
|
||||
for (int i=0; i < sessions.size(); ++i) {
|
||||
for (int i=0; i < sessions.size(); ++i) {
|
||||
if (sessions.at(i)->type() == mt)
|
||||
return true;
|
||||
}
|
||||
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()
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* SleepLib Day Class Header
|
||||
/* SleepLib Day Class Header
|
||||
*
|
||||
* 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
|
||||
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); }
|
||||
|
||||
//! \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);
|
||||
|
||||
//! \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(); }
|
||||
|
||||
//! \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
|
||||
int find(Session *sess) { return sessions.indexOf(sess); }
|
||||
|
@ -88,22 +88,21 @@ bool EDFParser::Parse()
|
||||
serialnumber += recordingident[i];
|
||||
}
|
||||
|
||||
QDateTime startDate = QDateTime::fromString(QString::fromLatin1(header.datetime, 16), "dd.MM.yyHH.mm.ss");
|
||||
//startDate.toTimeSpec(Qt::UTC);
|
||||
startdate_orig = QDateTime::fromString(QString::fromLatin1(header.datetime, 16), "dd.MM.yyHH.mm.ss");
|
||||
|
||||
QDate d2 = startDate.date();
|
||||
QDate d2 = startdate_orig.date();
|
||||
|
||||
if (d2.year() < 2000) {
|
||||
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;
|
||||
return false;
|
||||
}
|
||||
|
||||
startdate = qint64(startDate.toTime_t()) * 1000L;
|
||||
startdate = qint64(startdate_orig.toTime_t()) * 1000L;
|
||||
//startdate-=timezoneOffset();
|
||||
|
||||
//qDebug() << startDate.toString("yyyy-MM-dd HH:mm:ss");
|
||||
|
@ -159,6 +159,7 @@ class EDFParser
|
||||
QString patientident;
|
||||
QString recordingident;
|
||||
QString serialnumber;
|
||||
QDateTime startdate_orig;
|
||||
qint64 startdate;
|
||||
qint64 enddate;
|
||||
QString reserved44;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -36,14 +36,15 @@ public:
|
||||
ResMedEDFParser(QString filename = "");
|
||||
~ResMedEDFParser();
|
||||
EDFSignal *lookupSignal(ChannelID ch);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct STRRecord
|
||||
{
|
||||
STRRecord() {
|
||||
maskon = 0;
|
||||
maskoff = 0;
|
||||
maskon.clear();
|
||||
maskoff.clear();
|
||||
maskdur = 0;
|
||||
maskevents = -1;
|
||||
mode = -1;
|
||||
@ -127,6 +128,10 @@ struct STRRecord
|
||||
leak95 = copy.leak95;
|
||||
leakmax = copy.leakmax;
|
||||
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_PtAccess = copy.s_PtAccess;
|
||||
@ -141,8 +146,9 @@ struct STRRecord
|
||||
s_Temp = copy.s_Temp;
|
||||
ramp_pressure = copy.ramp_pressure;
|
||||
}
|
||||
quint32 maskon;
|
||||
quint32 maskoff;
|
||||
QVector<quint32> maskon;
|
||||
QVector<quint32> maskoff;
|
||||
|
||||
EventDataType maskdur;
|
||||
EventDataType maskevents;
|
||||
EventDataType mode;
|
||||
@ -218,7 +224,47 @@ struct EDFGroup {
|
||||
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:
|
||||
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;
|
||||
STRRecord R;
|
||||
Machine * mach;
|
||||
};
|
||||
}; */
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \class ResmedLoader
|
||||
@ -317,10 +365,12 @@ class ResmedLoader : public CPAPLoader
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
volatile int sessionCount;
|
||||
|
||||
protected:
|
||||
void ParseSTR(Machine *mach, const QStringList & strfiles);
|
||||
|
||||
|
||||
//! \brief Scan for new files to import, group into sessions and add to task que
|
||||
int scanFiles(Machine * mach, const QString & datalog_path);
|
||||
|
||||
@ -329,6 +379,7 @@ protected:
|
||||
QMap<SessionID, QStringList> sessfiles;
|
||||
QMap<quint32, STRRecord> strsess;
|
||||
QMap<QDate, QList<STRRecord *> > strdate;
|
||||
QHash<QDate, ResMedDay> resdayList;
|
||||
|
||||
#ifdef DEBUG_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;
|
||||
|
||||
m_currenttask++;
|
||||
if ((m_currenttask % 50)==0) {
|
||||
if ((m_currenttask % 10)==0) {
|
||||
qprogress->setValue(f);
|
||||
QApplication::processEvents();
|
||||
}
|
||||
@ -207,7 +207,7 @@ void MachineLoader::runTasks(bool threaded)
|
||||
|
||||
// update progress bar
|
||||
m_currenttask++;
|
||||
if ((m_currenttask % 50) == 0) {
|
||||
if ((m_currenttask % 10) == 0) {
|
||||
qprogress->setValue(m_currenttask);
|
||||
QApplication::processEvents();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user