Skip to content

Commit

Permalink
Merge pull request #7 from ssi-dk/hotfixfeedback
Browse files Browse the repository at this point in the history
fix AB#430
  • Loading branch information
martinbaste authored Jun 4, 2019
2 parents 5774b30 + b365b2f commit 795441b
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 26 deletions.
4 changes: 4 additions & 0 deletions reporter/assets/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -848,4 +848,8 @@ td.center {

.unset-width-table {
width: unset;
}

.qc-feedback {
color: rgb(179, 204, 193);
}
20 changes: 11 additions & 9 deletions reporter/components/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ def html_qc_expert_form():
id="feedback-button"), className="three columns")
], className="row"),
html.Div([
html.Details([
html.Summary("How it works (click to show)"),
html.P("""If you want to send a sample to resequence,
go to the sample card and select "Resequence" in
the Suplying Lab Feedback section. The admin will get
an email with the change. You can also "Accept" samples
with the "Supplying lab" warning and their data will
be used in the future to adjust QC thresholds.""")
])
html.Div(
html.Details([
html.Summary("How it works (click to show)"),
html.P("""If you want to send a sample to resequence,
go to the sample card and select "Resequence" in
the Suplying Lab Feedback section. The admin will get
an email with the change. You can also "Accept" samples
with the "Supplying lab" warning and their data will
be used in the future to adjust QC thresholds.""")
]), className="six columns"),
html.Div(id="qc-feedback", className="six columns qc-feedback")
], className="row mb-1")

])
Expand Down
5 changes: 3 additions & 2 deletions reporter/components/import_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,15 @@ def get_last_runs(run, n):
def post_stamps(stamplist):
for pair in stamplist:
sample_id, stamp = pair
sample_db = mongo_interface.get_samples([sample_id])[0]
sample_db = mongo_interface.get_samples([ObjectId(sample_id)])[0]
stamps = sample_db.get("stamps", {})
stamp_list = stamps.get("stamp_list", [])
stamp_list.append(stamp)
stamps["stamp_list"] = stamp_list
stamps[stamp["name"]] = stamp
sample_db["stamps"] = stamps
mongo_interface.save_sample(sample_db)
return "Feedback saved"

def get_run(run_name):
return mongo_interface.get_run(run_name)
Expand All @@ -191,7 +192,7 @@ def email_stamps(stamplist):
sample_id, stamp = stamp_pair
user = stamp["user"]
new_status = stamp["value"]
sample = mongo_interface.get_samples([sample_id])[0]
sample = mongo_interface.get_samples([ObjectId(sample_id)])[0]
if sample is not None:
sample_name = sample["name"]
else:
Expand Down
26 changes: 13 additions & 13 deletions reporter/components/mongo_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,21 +483,21 @@ def get_sample_QC_status(last_runs):
if qc_val == "N/A" and (not "reads" in sample_db or not "R1" in sample_db["reads"]):
qc_val = "CF(LF)"
expert_check = False
if "ssi_expert_check" in stamps and "value" in stamps["ssi_expert_check"]:
qc_val = stamps["ssi_expert_check"]["value"]
if "supplying_lab_check" in stamps and "value" in stamps["supplying_lab_check"]:
qc_val = stamps["supplying_lab_check"]["value"]
expert_check = True

if qc_val == "fail:supplying lab":
qc_val = "SL"
elif (qc_val == "fail:core facility" or
qc_val == "fail:resequence"):
qc_val = "CF"
elif qc_val == "pass:OK":
qc_val = "OK"

if expert_check:
qc_val += "*"
sample_dict[run["name"]] = qc_val
if qc_val == "fail:supplying lab":
qc_val = "SL"
elif (qc_val == "fail:core facility" or
qc_val == "fail:resequence"):
qc_val = "CF"
elif qc_val == "pass:OK" or qc_val == "pass:accepted":
qc_val = "OK"

if expert_check:
qc_val += "*"
sample_dict[run["name"]] = qc_val
samples_runs_qc[name] = sample_dict
return samples_runs_qc

Expand Down
3 changes: 2 additions & 1 deletion reporter/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ def display_confirm_feedback(button):


@app.callback(
Output("placeholder0", "children"),
Output("qc-feedback", "children"),
[Input("qc-confirm", "submit_n_clicks")],
[State("qc-user-1", "value")] + [State("sample-radio-{}".format(n), "value")
for n in range(PAGESIZE)]
Expand All @@ -1122,6 +1122,7 @@ def print_radio(n_clicks_timestamp, user, *args):
if len(stamplist) > 0:
import_data.email_stamps(stamplist)
import_data.post_stamps(stamplist)
return "Feedback saved"
return []


Expand Down
3 changes: 2 additions & 1 deletion reporter/run_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def update_run_report(store, n_intervals):
qc_val = "CF"
elif qc_val == "CF(LF)":
statusname = "status--1"
elif qc_val == "pass:OK":
elif qc_val == "pass:OK" or qc_val == "pass:accepted":
statusname = "status-ok"
qc_val = "OK"

Expand Down Expand Up @@ -358,6 +358,7 @@ def update_run_report(store, n_intervals):
className = "0"
title = "Not Run"
status = p_runs[last_runs[index]["name"]]
print(name, status)
if status.startswith("OK"):
className = "ok"
title = "OK"
Expand Down

0 comments on commit 795441b

Please sign in to comment.