From f0dabbe5c022881b597649aa68970c8e8ea808e8 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Tue, 26 May 2020 09:01:19 +0200 Subject: [PATCH] filtering by serology added --- smash/web/api_views/subject.py | 24 ++++++++++++++++++++++-- smash/web/static/js/smash.js | 3 +++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/smash/web/api_views/subject.py b/smash/web/api_views/subject.py index 57ed007f..3e136b4f 100644 --- a/smash/web/api_views/subject.py +++ b/smash/web/api_views/subject.py @@ -109,12 +109,12 @@ def get_subject_columns(request, subject_list_type): "Visit {} IgA Status".format(virus_visit_number), "virus_test_{}_iga_status".format(one_based_idx), study_subject_columns, - None, study.columns) + 'serology_filter', study.columns) add_column(result, "Visit {} IgG Status".format(virus_visit_number), "virus_test_{}_igg_status".format(one_based_idx), study_subject_columns, - None, study.columns) + 'serology_filter', study.columns) add_column(result, "Type", "type", study_subject_columns, "type_filter", study.columns) add_column(result, "Edit", "edit", None, None, sortable=False) @@ -399,6 +399,26 @@ def get_subjects_filtered(subjects_to_be_filtered, filters): result = result.filter(virus_test_5__isnull=True, virus_test_5_updated__isnull=False) else: result = result.filter(virus_test_5=(value == "true")) + elif column == "virus_test_1_iga_status": + result = result.filter( virus_test_1_iga_status=value) + elif column == "virus_test_1_igg_status": + result = result.filter( virus_test_1_igg_status=value) + elif column == "virus_test_2_iga_status": + result = result.filter( virus_test_2_iga_status=value) + elif column == "virus_test_2_igg_status": + result = result.filter( virus_test_2_igg_status=value) + elif column == "virus_test_3_iga_status": + result = result.filter( virus_test_3_iga_status=value) + elif column == "virus_test_3_igg_status": + result = result.filter( virus_test_3_igg_status=value) + elif column == "virus_test_4_iga_status": + result = result.filter( virus_test_4_iga_status=value) + elif column == "virus_test_4_igg_status": + result = result.filter( virus_test_4_igg_status=value) + elif column == "virus_test_5_iga_status": + result = result.filter( virus_test_5_iga_status=value) + elif column == "virus_test_5_igg_status": + result = result.filter( virus_test_5_igg_status=value) elif column == "brain_donation_agreement": result = result.filter(brain_donation_agreement=(value == "true")) elif column == "postponed": diff --git a/smash/web/static/js/smash.js b/smash/web/static/js/smash.js index e49418ae..4737d473 100644 --- a/smash/web/static/js/smash.js +++ b/smash/web/static/js/smash.js @@ -306,6 +306,9 @@ function createTable(params) { $(tableElement).find('tfoot div[name="yes_no_null_inconclusive_filter"]').each(function () { $(this).html('<select style="width:100px" ><option value selected="selected">---</option><option value="true">Positive</option><option value="false">Negative</option><option value="null">N/A</option><option value="inconclusive">Inconclusive</option></select>'); }); + $(tableElement).find('tfoot div[name="serology_filter"]').each(function () { + $(this).html('<select style="width:100px" ><option value selected="selected">---</option><option value="Positive">Positive</option><option value="Negative">Negative</option><option value="Borderline">Borderline</option></select>'); + }); //make columns of virus test date wider $(tableElement).find('tfoot div[name="virus_test_date"]').each(function () { -- GitLab