Skip to content

Commit

Permalink
Analysis Report log
Browse files Browse the repository at this point in the history
Added patient/run log to the monitor report
  • Loading branch information
Ryan Herbert committed Jun 27, 2016
1 parent b251ff0 commit b862008
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
26 changes: 26 additions & 0 deletions browser/js/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Report.prototype = {
.addGraph()
.readsStat()
.cloneList()
.sampleLog()

self.m.resize()
self.m.resume()
Expand Down Expand Up @@ -565,6 +566,31 @@ Report.prototype = {
}

return clone
},

sampleLog: function() {
var log = this.container("Report Log")

var table = $('<table/>', {'class': 'log-table flex'}).appendTo(log);
for (var i=0; i < this.m["logs"].length; i++ ){
line = this.logLine(m["logs"][i]);
if(i % 2 == 0)
line.addClass('even');
else
line.addClass('odd');
line.appendTo(table);
}
return this
},

logLine: function(log_line) {
var line = $('<tr/>', {'class': 'log-row'});
console.log(log_line)
console.log(log_line["message"])
$('<td/>', {'class': 'log-date', 'text': log_line['created']}).appendTo(line);
$('<td/>', {'class': 'log-message', 'text': log_line['message']}).appendTo(line);

return line;
}

}
Expand Down
8 changes: 8 additions & 0 deletions browser/report.html
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@
text-align: center;
width: 50px;
}
.log-date{
width: 150px;
opacity: 0.8;
padding-right: 10px;
}
.odd{
background-color: #ddd;
}
</style>

<!-- graph style-->
Expand Down
13 changes: 12 additions & 1 deletion server/web2py/applications/vidjil/controllers/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,11 @@ def get_data():
run_name = ""
config_name = db.config[request.vars["config"]].name
command = db.config[request.vars["config"]].command


log_reference_id = request.vars["sample_set_id"]
if (sample_set.sample_type == "patient") :
for row in db( db.patient.sample_set_id == request.vars["sample_set_id"] ).select() :
log_reference_id = row.id
patient_name = vidjil_utils.anon_ids(row.id)
data["dataFileName"] = patient_name + " (" + config_name + ")"
data["info"] = db.patient[row.id].info
Expand All @@ -260,12 +262,21 @@ def get_data():

if (sample_set.sample_type == "run") :
for row in db( db.run.sample_set_id == request.vars["sample_set_id"] ).select() :
log_reference_id = row.id
run_name = db.run[row.id].name
data["dataFileName"] = run_name + " (" + config_name + ")"
data["info"] = db.run[row.id].info
data["run_id"] = row.id
data["run_name"] = run_name

log_query = db( ( db.user_log.record_id == log_reference_id )
& ( db.user_log.table_name == sample_set.sample_type )
).select(db.user_log.ALL, orderby=db.user_log.created)

data["logs"] = []
for row in log_query:
data["logs"].append({'message': row.msg, 'created': str(row.created)})

## récupération des infos stockées sur la base de données
query = db( ( db.sample_set.id == request.vars["sample_set_id"] )
& ( db.sample_set.id == db.sample_set_membership.sample_set_id )
Expand Down

0 comments on commit b862008

Please sign in to comment.