Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
246 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,3 +49,4 @@ def configure_app(app, config=None): | |
toolbar = DebugToolbarExtension(app) | ||
|
||
return app | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
{% extends 'layout/layout.html' %} | ||
{% block body %} | ||
{% include 'layout/navigation.html' %} | ||
<div class="container-fluid"> | ||
<div class="jumbotron vertical-center"> | ||
<div class="row"> | ||
<div class="col-lg-12"> | ||
<h1 class="page-header"><strong>Quality Control/QC </strong></h1> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
</div> | ||
<ul class="nav nav-tabs" id="myTab"> | ||
{% for plot in box_plots %} | ||
<li><a href="#{{plot}}" data-toggle="tab">{{plot}}</a></li> | ||
{% endfor %} | ||
{% for plot in scatter_plots %} | ||
<li><a href="#{{plot}}" data-toggle="tab">{{plot}}</a></li> | ||
{% endfor %} | ||
</ul> | ||
<div class="tab-content"> | ||
{% for plot in box_plots %} | ||
<div class="tab-pane fade in active" id='{{plot}}'> | ||
<div id="{{plot}}" style="min-width:1000px; height:600px; "></div> | ||
</div> | ||
{% endfor %} | ||
{% for plot in scatter_plots %} | ||
<div class="tab-pane fade in active" id='{{plot}}'> | ||
<div id="{{plot}}" style="min-width:1000px; height:600px; "></div> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
{% endblock %} | ||
|
||
{% block scripts %} | ||
|
||
<script> | ||
|
||
////////////////// Box Plots ////////////////// | ||
{% for plot_name in box_plots %} | ||
var XY_plot = document.getElementById('') | ||
var data = [] | ||
var layout = { | ||
title: '{{plot_name}} - ({{nr_batches}} most recent batches)', | ||
hovermode: 'closest', | ||
margin: { b: 100 }, | ||
xaxis: { | ||
showline: true, | ||
tickvals: {{ ticks }}, | ||
ticktext: {{ batch_ids | tojson }}, | ||
tickangle: 40, | ||
zeroline: false, | ||
linecolor: '#636363', | ||
linewidth: 5, | ||
gridcolor: '#bdbdbd'}, | ||
yaxis: { | ||
zeroline: false, | ||
showline: true, | ||
showgrid: false, | ||
linecolor: '#636363', | ||
linewidth: 5, | ||
title : "{{plot_name}}" | ||
}}; | ||
|
||
{% for batch in box_stat %} | ||
var box = { | ||
y: {{ batch[plot_name] }}, | ||
x: Array({{ nr_batches }}).fill({{ loop.index }}), | ||
type: 'box', | ||
showlegend: false, | ||
boxpoints: 'suspectedoutliers', | ||
}; | ||
data.push(box); | ||
{% endfor %} | ||
|
||
Plotly.newPlot("{{plot_name}}", data, layout); | ||
{% endfor %} | ||
</script> | ||
|
||
<script> | ||
jQuery(function () { | ||
jQuery('#myTab a:first').tab('show') | ||
}) | ||
</script> | ||
|
||
<script> | ||
////////////////// Scatter plots ////////////////// | ||
{% for plot_name in scatter_plots %} | ||
var XY_plot = document.getElementById('') | ||
var data = [] | ||
|
||
var layout = { | ||
title: '{{plot_name}} - ({{nr_batches}} most recent batches)', | ||
hovermode: 'closest', | ||
margin: { b: 100 }, | ||
xaxis: { | ||
showline: true, | ||
tickvals: {{ ticks }}, | ||
ticktext: {{ batch_ids| tojson }}, | ||
tickangle: 40, | ||
zeroline: false, | ||
linecolor: '#636363', | ||
linewidth: 5, | ||
gridcolor: '#bdbdbd',}, | ||
yaxis: { | ||
zeroline: false, | ||
showline: true, | ||
showgrid: false, | ||
linecolor: '#636363', | ||
linewidth: 5, | ||
title : "{{plot_name}}"} | ||
} | ||
|
||
|
||
{% for batch_id in scatter_stat %} | ||
var batch = { | ||
y: [{{ scatter_stat[batch_id][plot_name] }}], | ||
x: [{{ loop.index }}], | ||
type: 'scatter', | ||
mode: 'markers', | ||
showlegend: false, | ||
name: "{{batch_id}}", | ||
text: "Date Run: {{scatter_stat[batch_id]['date']}}"}; | ||
data.push(batch); | ||
{% endfor %} | ||
|
||
Plotly.newPlot("{{plot_name}}", data, layout); | ||
{% endfor %} | ||
</script> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
from NIPTool.server import create_app | ||
from NIPTool.server.utils import get_last_batches | ||
from NIPTool.adapter.plugin import NiptAdapter | ||
from datetime import datetime | ||
|
||
|
||
app = create_app(test= True) | ||
|
||
|
||
def test_get_last_batches(database): | ||
app.db = database | ||
app.adapter = NiptAdapter(database.client, db_name = database.name) | ||
|
||
# GIVEN a database with four batch documents: | ||
batch1 = {"_id":"201860", "SequencingDate":"2022-03-10"} | ||
batch2 = {"_id":"201862", "SequencingDate":"2022-02-10"} | ||
batch3 = {"_id":"201830", "SequencingDate":"2022-02-09"} | ||
batch4 = {"_id":"101830", "SequencingDate":"2021-03-10"} | ||
|
||
database.batch.insert_many([batch4, batch1, batch3, batch2]) | ||
|
||
# WHEN running get_last_batches with nr=2 | ||
results = get_last_batches(adapter=app.adapter, nr=2) | ||
|
||
# THEN the results should contain the two batches with the latest SequencingDate | ||
assert results == [batch1, batch2] |