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

sample summary report expansion #106

Merged
merged 6 commits into from
Oct 29, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
changes based on feedback
ayobi committed Oct 28, 2024
commit 8a1d7c3d597ca5c6b566c12295e0a280b9251c32
25 changes: 12 additions & 13 deletions microsetta_admin/server.py
Original file line number Diff line number Diff line change
@@ -404,8 +404,8 @@ def per_sample_summary():
**build_login_variables())
else:
search_field = request.form.get('search_field')
search_value = request.form.get('text_input')
uploaded_file = request.files.get('file')
search_value = request.form.get('single_search')
uploaded_file = request.files.get('upload_list')

search_values = []

@@ -420,16 +420,7 @@ def per_sample_summary():
search_values = [search_value] if search_value else []

payload = {}
if search_field == 'sample_barcode':
payload['sample_barcodes'] = search_values
elif search_field == 'kit_id':
payload['kit_ids'] = search_values
elif search_field == 'email':
payload['emails'] = search_values
elif search_field == 'outbound_tracking':
payload['outbound_tracking_numbers'] = search_values
elif search_field == 'inbound_tracking':
payload['inbound_tracking_numbers'] = search_values
payload[search_field] = search_values

# perform the main query.
status, result = APIRequest.post('/api/admin/account_barcode_summary?'
@@ -447,7 +438,15 @@ def per_sample_summary():
order = ['sampleid', 'project', 'account-email',
cassidysymons marked this conversation as resolved.
Show resolved Hide resolved
'source-type', 'site-sampled', 'sample-date',
'sample-time', 'sample-status', 'sample-received',
'ffq-taken', 'ffq-complete', 'vioscreen_username']
'first-scan-status', 'first-scan-timestamp',
'latest-scan-status', 'latest-scan-timestamp',
'sample-has-inconsistencies', 'sample-is-valid',
'no-associated-source', 'no-collection-info',
'no-registered-account', 'received-unknown-validity',
'ffq-taken', 'ffq-complete', 'vioscreen_username',
'kit-id', 'outbound-tracking',
'inbound-tracking'
]
order.extend(sorted(set(resource.columns) - set(order)))
resource = resource[order]
else:
34 changes: 18 additions & 16 deletions microsetta_admin/templates/per_sample_summary.html
Original file line number Diff line number Diff line change
@@ -13,16 +13,20 @@
};

function handleFormSubmit(event) {
var fileInput = document.getElementById('file');
var textInput = document.getElementById('text_input');
var fileInput = document.getElementById('upload_list');
var textInput = document.getElementById('single_search');

if (fileInput.files.length > 0 || textInput.value.trim() !== "") {
remove_error_messages();
return true;
} else {
alert('Please provide either a file or text input.');
if (fileInput.files.length > 0 && textInput.value.trim() !== "") {
alert("Please provide either a text input or a file, not both.");
event.preventDefault();
return false;
} else if (fileInput.files.length === 0 && textInput.value.trim() === "") {
alert("Please provide either a text input or a file.");
event.preventDefault();
return false;
} else {
remove_error_messages();
return true;
}
}

@@ -55,22 +59,22 @@ <h5>Retrieve summary for a sample</h5>
<td colspan=3 style="text-align:left;padding:4px">
cassidysymons marked this conversation as resolved.
Show resolved Hide resolved
<label for="search_field">Select search field:</label>
<select id="search_field" name="search_field">
<option value="sample_barcode">Barcode</option>
<option value="kit_id">Kit ID</option>
<option value="email">Email</option>
<option value="outbound_tracking">Outbound Tracking Number</option>
<option value="inbound_tracking">Inbound Tracking Number</option>
<option value="sample_barcodes">Barcode</option>
<option value="kit_ids">Kit ID</option>
<option value="emails">Email</option>
<option value="outbound_tracking_numbers">Outbound Tracking Number</option>
<option value="inbound_tracking_numbers">Inbound Tracking Number</option>
</select>
</td>
</tr>
<tr>
cassidysymons marked this conversation as resolved.
Show resolved Hide resolved
<td colspan=3 style="text-align:left;padding:4px">
cassidysymons marked this conversation as resolved.
Show resolved Hide resolved
<input type="text" name="text_input" placeholder="Enter value here" id="text_input">
<input type="text" name="single_search" placeholder="Enter value here" id="single_search">
cassidysymons marked this conversation as resolved.
Show resolved Hide resolved
</td>
</tr>
<tr>
cassidysymons marked this conversation as resolved.
Show resolved Hide resolved
<td colspan=3 style="text-align:left;padding:4px">
cassidysymons marked this conversation as resolved.
Show resolved Hide resolved
<input type="file" name="file" id="file">
<input type="file" name="upload_list" id="upload_list">
cassidysymons marked this conversation as resolved.
Show resolved Hide resolved
</td>
</tr>
<tr>
@@ -79,8 +83,6 @@ <h5>Retrieve summary for a sample</h5>
</td>
</tr>
<tr><td colspan=4></td></tr>
<tr><td colspan=4 style="text-align:center;padding:4px"><i>The selected search field must be in column "<span id="csv_column_name">sample_name</span>"<br>(max: 1000)</i> </td></tr>
<tr><td colspan=4></td></tr>
<tr>
<td colspan=3><label for="strip_sampleid">Check to remove sample IDs from summary</label></td>
<td colspan=1 style="text-align:center;padding:4px">