From ade38c44f73635708480bb5f944feddf1222b19a Mon Sep 17 00:00:00 2001 From: AaronStephenson Date: Wed, 12 Jun 2019 16:14:54 -0500 Subject: [PATCH] Include ext_pos_dna_missing, ext_pos_dna_positive, ext_pos_rna_rt_missing, and ext_pos_rna_rta_positive values in the PCRReplicate invalid_reasons array --- code.json | 2 +- lideservices/models.py | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/code.json b/code.json index 51d0b52..9e5f937 100644 --- a/code.json +++ b/code.json @@ -3,7 +3,7 @@ "name": "lide", "organization": "U.S. Geological Survey", "description": "Web services for LILI (LIDE (Laboratory for Infectious Disease and the Environment) Information Management System)", - "version": "v0.104.1", + "version": "v0.104.2", "status": "Release Candidate", "permissions": { diff --git a/lideservices/models.py b/lideservices/models.py index 909fa20..500c1ad 100644 --- a/lideservices/models.py +++ b/lideservices/models.py @@ -1081,6 +1081,30 @@ def invalid_reasons(self): else: reasons["peg_neg_missing"] = False reasons["peg_neg_missing_replicates"] = "" + if pcrreplicate_batch.extraction_batch.ext_pos_dna_cq_value is None: + reasons["ext_pos_dna_missing"] = True + else: + reasons["ext_pos_dna_missing"] = False + if (pcrreplicate_batch.extraction_batch.ext_pos_dna_cq_value is not None + and pcrreplicate_batch.extraction_batch.ext_pos_dna_cq_value > Decimal('0')): + reasons["ext_pos_dna_positive"] = True + else: + reasons["ext_pos_dna_positive"] = False + # ext_pos_rt_rna_positive is a special case that only applies if the target of the pcrreplicate_batch is RNA + if pcrreplicate_batch.target.nucleic_acid_type.name == 'RNA': + rt = ReverseTranscription.objects.filter( + extraction_batch=pcrreplicate_batch.extraction_batch.id, re_rt=None).first() + if rt.ext_pos_rna_rt_cq_value is None: + reasons["ext_pos_rna_rt_missing"] = True + else: + reasons["ext_pos_rna_rt_missing"] = False + if rt.ext_pos_rna_rt_cq_value is not None and rt.ext_pos_rna_rt_cq_value > Decimal('0'): + reasons["ext_pos_rna_rt_positive"] = True + else: + reasons["ext_pos_rna_rta_positive"] = False + else: + reasons["ext_pos_rna_rt_missing"] = False + reasons["ext_pos_rna_rta_positive"] = False if pcrreplicate_batch.ext_neg_cq_value is None: reasons["ext_neg_missing"] = True else: @@ -1121,6 +1145,8 @@ def invalid_reasons(self): else: reasons = { "peg_neg_invalid": False, "peg_neg_missing_replicates": False, + "ext_pos_dna_missing": False, "ext_pos_dna_positive": False, + "ext_pos_rna_rt_missing": False, "ext_pos_rna_rt_positive": False, "ext_neg_missing": False, "ext_neg_positive": False, "rt_neg_missing": False, "rt_neg_positive": False, "pcr_neg_missing": False, "pcr_neg_positive": False,