Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instructions file nih tables and fixes #1986

Merged
merged 3 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/assets/javascripts/components/box_batches_form.js.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ var BoxBatchForm = React.createClass({
</div>
<div className="items-concentration">
<input type="text" name={this.fieldFor("concentrations", item.key , "concentration")} value={item.concentration} onChange={set("concentration")}/>
copies/ml
copies/mL
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ var SamplesReportsBarChart = React.createClass({
ref={function(ref) { if (ref) { d3.select(ref.getDOMNode()).call(xAxis); rotateLabels(ref); }}}>
</g>
<text transform={"translate(" + (chartWidth) + ", "+(chartHeight+this.props.margin.bottom-10)+")"}
y="6" dy=".1em" style={{textAnchor: 'end'}}>CONCENTRATION (copies/ml)</text>
y="6" dy=".1em" style={{textAnchor: 'end'}}>CONCENTRATION (copies/mL)</text>


{/* Y Axis */}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ var SamplesReportsLineChart = React.createClass({
ref={function(ref) { if (ref) { d3.select(ref.getDOMNode()).call(xAxis); rotateLabels(ref); }}}>
</g>
<text transform={"translate(" + (chartWidth) + ", "+(chartHeight+this.props.margin.bottom-10)+")"}
y="6" dy=".1em" style={{textAnchor: 'end'}}>CONCENTRATION (copies/ml)</text>
y="6" dy=".1em" style={{textAnchor: 'end'}}>CONCENTRATION (copies/mL)</text>

{/* Y Axis */}
<g className="y axis"
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/components/samples_selector.js.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var SamplesSelector = React.createClass({
</div>
<div className="items-item">{sample.uuid}&nbsp;<span>{sample.batch_number}</span></div>
</div>
<div className="items-concentration">{sample.concentration} copies/ml</div>
<div className="items-concentration">{sample.concentration} copies/mL</div>
</div>
</div>);
} else {
Expand Down
14 changes: 7 additions & 7 deletions app/views/nih_tables/nih_challenge.csv.csvbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ csv << [
'pango_lineage',
'who_label',
'non_clinical_cutoff_min',
'non_clinical_cutoff_unit',
'non_clinical_cutoff_min_unit',
'true_positives',
'false_positives',
'true_negatives',
Expand All @@ -35,19 +35,19 @@ csv << [
@target_sample.target_organism_taxonomy_id,
@target_sample.pango_lineage,
@target_sample.who_label,
@samples_report.threshold,
'copies/ml',
params[:threshold],
'copies/mL',
params[:true_positives],
params[:false_positives],
params[:true_negatives],
params[:false_negatives],
params[:tpr],
params[:sensitivity],
nil,
nil,
params[:fpr],
params[:specificity],
nil,
nil,
params[:auc],
params[:roc_x_values],
params[:roc_y_values]
params[:roc_x_values].to_s.gsub(",","|"),
params[:roc_y_values].to_s.gsub(",","|")
]
2 changes: 1 addition & 1 deletion app/views/nih_tables/nih_results.csv.csvbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ csv << [

@samples_report.samples.each do |sample|
csv << [
sample.id,
sample.uuid,
sample.box.uuid,
"#{sample.box.purpose}-panel",
nil,
Expand Down
2 changes: 1 addition & 1 deletion app/views/nih_tables/nih_samples.csv.csvbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ csv << [
nil,
nil,
sample.concentration,
'copies/ml',
'copies/mL',
sample.reference_gene,
sample.uuid,
sample.batch_number,
Expand Down
2 changes: 1 addition & 1 deletion app/views/samples/_form.haml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
- @sample_form.blinded_attribute(:concentration) do
.row.input-unit
= f.text_field :concentration, min:0, readonly: !@can_update, :class=> "input-medium", :value => humanize_concentration(@sample_form.concentration), :pattern => "[\\d.]+(?:[eE]\\+?\\d+)?", :title => "(examples: 120, 12e1, 1.2e2, 1.2e+2, 1.2E2, 1.2E+2, 1.2E+02)"
.span.unit (copies/ml)
.span.unit (copies/mL)

= f.form_field :replicate do
- @sample_form.blinded_attribute(:replicate) do
Expand Down
11 changes: 6 additions & 5 deletions app/views/samples_reports/show.haml
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,12 @@
true_negatives: ret.confusion_matrix.true_negative || 0,
false_positives: ret.confusion_matrix.false_positive || 0,
false_negatives: ret.confusion_matrix.false_negative || 0,
tpr: (ret.confusion_matrix.true_positive || 0) / ((ret.confusion_matrix.true_positive || 0) + (ret.confusion_matrix.false_negative || 0)),
fpr: (ret.confusion_matrix.false_positive || 0) / ((ret.confusion_matrix.false_positive || 0) + (ret.confusion_matrix.true_negative || 0)),
auc: #{auc(roc_curve(@samples_report))},
roc_x_values: #{roc_curve(@samples_report).map{|x| x[0]}},
roc_y_values: #{roc_curve(@samples_report).map{|x| x[1]}},
sensitivity: ((ret.confusion_matrix.true_positive || 0) / ((ret.confusion_matrix.true_positive || 0) + (ret.confusion_matrix.false_negative || 0))).toFixed(3),
specificity: 1-((ret.confusion_matrix.false_positive || 0) / ((ret.confusion_matrix.false_positive || 0) + (ret.confusion_matrix.true_negative || 0))).toFixed(3),
auc: #{auc(roc_curve(@samples_report)).round(3)},
roc_x_values: #{roc_curve(@samples_report).map{|x| x[0].round(3)}},
roc_y_values: #{roc_curve(@samples_report).map{|x| x[1].round(3)}},
threshold: parseFloat(threshold).toFixed(3),
};

// create url params with the params dictionary
Expand Down
27 changes: 26 additions & 1 deletion public/templates/Instructions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,27 @@
Instructions for the use of NIH tables.
This compressed file contains three tables containing data elements for the RADx-rad Data Hub. The tables
contain pre-filled data based on the information available to the CDx LIMS system. The tables are provided
to the user to fill in the missing information. Please note that you need to maintain the same format as
the one provided in the tables (CSV file format, with identical columns and rows).

The three provided tables are as follows:

1. <report_name>_samples.csv
2. <report_name>_samples_results.csv
3. <report_name>_<purpose>.csv

The first table contains one row per sample with general information about each sample.

The second table contains one row per sample result, providing information about the results obtained for
each sample by the user, including the readout, measurement units, used technology, etc.

The third table contains one row per panel and provides information about the aggregated results obtained
after the tests were performed. The <purpose> can be either "LOD" or "Challenge" depending on the type of
test performed.

Once the developer completes the missing data, these files are ready to be submitted to the RADx-rad
Data Core (https://www.radxrad.org/) for quality assurance. For more information, please contact
Dr. Peter Rose ([email protected]). The Data Core administrator will review the data for completeness
and consistency and will reach out to the developer if any issues arise.

After the data passes the quality check, the Data Core administrator uploads the data files, common data
element dictionaries, and metadata files to the NIH COVID RADx-rad Data Hub (https://radx-hub.nih.gov/).
8 changes: 4 additions & 4 deletions public/templates/upload_box.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Batch,Concentration,Distractor,Instructions,Replicates
borrar,100,no,Add 175 ml of media,2
borrar,1000,no,Add 175 ml of media,2
Blank,2,yes,Add 250 ml of media,4
Blank,200,yes,Add 100 ml of media,4
batch1,100,no,Add 175 ml of media,2
batch1,1000,no,Add 175 ml of media,2
batch2,2,yes,Add 250 ml of media,4
batch2,200,yes,Add 100 ml of media,4
2 changes: 1 addition & 1 deletion spec/controllers/nih_tables_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
samples_table = CSV.parse(Zip::File.open_buffer(response.body).entries.find{|e| e.name == "Test_results.csv"}.get_input_stream.read, headers: true)

expect(samples_table.count).to eq(@samples_report.samples_report_samples.count)
expect(samples_table["sample_id"]).to eq(@samples_report.samples_report_samples.map{|srs| srs.sample.id.to_s})
expect(samples_table["sample_id"]).to eq(@samples_report.samples_report_samples.map{|srs| srs.sample.uuid.to_s})
end

it "should contain the LOD table for if the box purpose is LOD" do
Expand Down