def validateStep(self):
        self.validationErrors.pop(SavePlanFieldNames.NO_BARCODE, None)
        self.validationErrors.pop(SavePlanFieldNames.BAD_BARCODES, None)

        samplesTable = json.loads(
            self.savedFields[SavePlanFieldNames.SAMPLES_TABLE])

        barcodeSet = self.savedFields[SavePlanFieldNames.BARCODE_SET]
        selectedBarcodes = []

        endBarcodeSet = self.savedFields[SavePlanFieldNames.END_BARCODE_SET]
        selectedEndBarcodes = []

        for row in samplesTable:
            sample_name = row.get(SavePlanFieldNames.SAMPLE_NAME, '').strip()
            if sample_name:
                if barcodeSet:
                    selectedBarcodes.append(
                        row.get(SavePlanFieldNames.
                                BARCODE_SAMPLE_BARCODE_ID_UI_KEY))
                    if endBarcodeSet:
                        endBarcode_id_value = row.get(
                            SavePlanFieldNames.
                            BARCODE_SAMPLE_END_BARCODE_ID_UI_KEY)
                        if endBarcode_id_value:
                            selectedEndBarcodes.append(endBarcode_id_value)

        if barcodeSet:
            errors = validate_barcode_sample_association(
                selectedBarcodes, barcodeSet)

            myErrors = convert(errors)
            if myErrors.get("MISSING_BARCODE", ""):
                self.validationErrors[
                    SavePlanFieldNames.NO_BARCODE] = myErrors.get(
                        "MISSING_BARCODE", "")
            if myErrors.get("DUPLICATE_BARCODE", ""):
                self.validationErrors[
                    SavePlanFieldNames.BAD_BARCODES] = myErrors.get(
                        "DUPLICATE_BARCODE", "")

        if selectedEndBarcodes:
            applProduct = self.savedObjects[SavePlanFieldNames.APPL_PRODUCT]
            if applProduct and applProduct.dualBarcodingRule == "no_reuse":
                errors = validate_barcode_sample_association(
                    selectedEndBarcodes,
                    endBarcodeSet,
                    isEndBarcodeExists=True)

                myErrors = convert(errors)
                if myErrors.get("DUPLICATE_BARCODE", ""):
                    self.validationErrors[
                        SavePlanFieldNames.BAD_BARCODES] = myErrors.get(
                            "DUPLICATE_BARCODE", "")

        self.prepopulatedFields[SavePlanFieldNames.FIRE_VALIDATION] = "0"
Beispiel #2
0
    def validateStep(self):
        self.validationErrors.pop(SavePlanFieldNames.NO_BARCODE,None)
        self.validationErrors.pop(SavePlanFieldNames.BAD_BARCODES,None)
                
        samplesTable = json.loads(self.savedFields[SavePlanFieldNames.SAMPLES_TABLE])
        barcodeSet = self.savedFields[SavePlanFieldNames.BARCODE_SET]

        selectedBarcodes = []

        for row in samplesTable:
            sample_name = row.get(SavePlanFieldNames.SAMPLE_NAME,'').strip()
            if sample_name:
                if barcodeSet:
                    selectedBarcodes.append(row.get('barcodeId'))

        if barcodeSet:
            errors = validate_barcode_sample_association(selectedBarcodes, barcodeSet)
            
            myErrors = convert(errors)
            if myErrors.get("MISSING_BARCODE", ""):
                self.validationErrors[SavePlanFieldNames.NO_BARCODE] = myErrors.get("MISSING_BARCODE", "")
            if myErrors.get("DUPLICATE_BARCODE", ""):
                self.validationErrors[SavePlanFieldNames.BAD_BARCODES] = myErrors.get("DUPLICATE_BARCODE", "")
 
        self.prepopulatedFields[SavePlanFieldNames.FIRE_VALIDATION] = "0"
    def validateStep(self):
        self.validationErrors.pop(SavePlanFieldNames.NO_BARCODE, None)
        self.validationErrors.pop(SavePlanFieldNames.BAD_BARCODES, None)

        samplesTable = json.loads(self.savedFields['samplesTable'])
        barcodeSet = self.savedFields[SavePlanFieldNames.BARCODE_SET]

        selectedBarcodes = []

        for row in samplesTable:
            sample_name = row.get(SavePlanFieldNames.SAMPLE_NAME, '').strip()
            if sample_name:
                if barcodeSet:
                    selectedBarcodes.append(row.get('barcodeId'))

        if barcodeSet:
            errors = validate_barcode_sample_association(
                selectedBarcodes, barcodeSet)

            myErrors = convert(errors)
            if myErrors.get("MISSING_BARCODE", ""):
                self.validationErrors[
                    SavePlanFieldNames.NO_BARCODE] = myErrors.get(
                        "MISSING_BARCODE", "")
            if myErrors.get("DUPLICATE_BARCODE", ""):
                self.validationErrors[
                    SavePlanFieldNames.BAD_BARCODES] = myErrors.get(
                        "DUPLICATE_BARCODE", "")

        self.prepopulatedFields['fireValidation'] = "0"
    def validateStep(self):
        self.validationErrors.pop(SavePlanFieldNames.NO_BARCODE, None)
        self.validationErrors.pop(SavePlanFieldNames.BAD_BARCODES, None)

        samplesTable = json.loads(self.savedFields[SavePlanFieldNames.SAMPLES_TABLE])

        barcodeSet = self.savedFields[SavePlanFieldNames.BARCODE_SET]
        selectedBarcodes = []

        endBarcodeSet = self.savedFields[SavePlanFieldNames.END_BARCODE_SET]
        selectedEndBarcodes = []

        for row in samplesTable:
            sample_name = row.get(SavePlanFieldNames.SAMPLE_NAME, '').strip()
            if sample_name:
                if barcodeSet:
                    selectedBarcodes.append(row.get(SavePlanFieldNames.BARCODE_SAMPLE_BARCODE_ID_UI_KEY))
                    if endBarcodeSet:
                        endBarcode_id_value = row.get(SavePlanFieldNames.BARCODE_SAMPLE_END_BARCODE_ID_UI_KEY)
                        if endBarcode_id_value:
                            selectedEndBarcodes.append(endBarcode_id_value)

        if barcodeSet:
            errors = validate_barcode_sample_association(selectedBarcodes, barcodeSet)

            myErrors = convert(errors)
            if myErrors.get("MISSING_BARCODE", ""):
                self.validationErrors[SavePlanFieldNames.NO_BARCODE] = myErrors.get("MISSING_BARCODE", "")
            if myErrors.get("DUPLICATE_BARCODE", ""):
                self.validationErrors[SavePlanFieldNames.BAD_BARCODES] = myErrors.get("DUPLICATE_BARCODE", "")

        if selectedEndBarcodes:
            applProduct = self.savedObjects[SavePlanFieldNames.APPL_PRODUCT]
            if applProduct and applProduct.dualBarcodingRule == "no_reuse":
                errors = validate_barcode_sample_association(selectedEndBarcodes, endBarcodeSet, isEndBarcodeExists = True)

                myErrors = convert(errors)
                if myErrors.get("DUPLICATE_BARCODE", ""):
                    self.validationErrors[SavePlanFieldNames.BAD_BARCODES] = myErrors.get("DUPLICATE_BARCODE", "")


        self.prepopulatedFields[SavePlanFieldNames.FIRE_VALIDATION] = "0"
Beispiel #5
0
    def validateStep(self):
        any_samples = False
        self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_NAME] = []
        self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_EXTERNAL_ID] = []
        self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_DESCRIPTION] = []
        self.validationErrors[SavePlanFieldNames.BAD_TUBE_LABEL] = []
        self.validationErrors[SavePlanFieldNames.BAD_CHIP_BARCODE] = []
        self.validationErrors[SavePlanFieldNames.BAD_IR_SET_ID] = []

        self.validationErrors.pop(SavePlanFieldNames.NO_BARCODE, None)
        self.validationErrors.pop(SavePlanFieldNames.BAD_BARCODES, None)

        barcodeSet = self.savedFields[SavePlanFieldNames.BARCODE_SET]
        selectedBarcodes = []

        endBarcodeSet = self.savedFields[SavePlanFieldNames.END_BARCODE_SET]
        selectedEndBarcodes = []

        samplesTable = json.loads(self.savedFields[SavePlanFieldNames.SAMPLES_TABLE])
        # logger.debug("save_plan_step_data - anySamples? samplesTable=%s" %(samplesTable))

        for row in samplesTable:
            sample_name = row.get(SavePlanFieldNames.SAMPLE_NAME, '').strip()

            # logger.debug("save_plan_step_data - anySamples? sampleName=%s" %(sample_name))

            if sample_name:
                any_samples = True
                if validate_sample_name(sample_name):
                    self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_NAME].append(sample_name)

                external_id = row.get(SavePlanFieldNames.SAMPLE_EXTERNAL_ID, '')
                if external_id:
                    self.validate_field(external_id, self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_EXTERNAL_ID])

                description = row.get(SavePlanFieldNames.SAMPLE_DESCRIPTION, '')
                if description:
                    self.validate_field(description, self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_DESCRIPTION], False,
                                        MAX_LENGTH_SAMPLE_DESCRIPTION)

                ir_set_id = row.get('irSetId', '')
                if ir_set_id and not (str(ir_set_id).isdigit()):
                    self.validationErrors[SavePlanFieldNames.BAD_IR_SET_ID].append(ir_set_id)

                tube_label = row.get('tubeLabel', '')
                if validate_sample_tube_label(tube_label):
                    self.validationErrors[SavePlanFieldNames.BAD_TUBE_LABEL].append(tube_label)
                chip_barcode = row.get('chipBarcode', '')
                if validate_chipBarcode(chip_barcode):
                    self.validationErrors[SavePlanFieldNames.BAD_CHIP_BARCODE].append(chip_barcode)
                if barcodeSet:
                    selectedBarcodes.append(row.get(SavePlanFieldNames.BARCODE_SAMPLE_BARCODE_ID_UI_KEY))
                    if endBarcodeSet:
                        endBarcode_id_value = row.get(SavePlanFieldNames.BARCODE_SAMPLE_END_BARCODE_ID_UI_KEY)
                        if endBarcode_id_value:
                            selectedEndBarcodes.append(endBarcode_id_value)

        if any_samples:
            self.validationErrors.pop(SavePlanFieldNames.NO_SAMPLES, None)
        else:
            self.validationErrors[SavePlanFieldNames.NO_SAMPLES] = "You must enter at least one sample"

        if not self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_NAME]:
            self.validationErrors.pop(SavePlanFieldNames.BAD_SAMPLE_NAME, None)

        if not self.validationErrors[SavePlanFieldNames.BAD_TUBE_LABEL]:
            self.validationErrors.pop(SavePlanFieldNames.BAD_TUBE_LABEL, None)
        if not self.validationErrors[SavePlanFieldNames.BAD_CHIP_BARCODE]:
            self.validationErrors.pop(SavePlanFieldNames.BAD_CHIP_BARCODE, None)

        if not self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_EXTERNAL_ID]:
            self.validationErrors.pop(SavePlanFieldNames.BAD_SAMPLE_EXTERNAL_ID, None)

        if not self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_DESCRIPTION]:
            self.validationErrors.pop(SavePlanFieldNames.BAD_SAMPLE_DESCRIPTION, None)

        if not self.validationErrors[SavePlanFieldNames.BAD_IR_SET_ID]:
            self.validationErrors.pop(SavePlanFieldNames.BAD_IR_SET_ID, None)

        #20170928-TODO-WIP
        if barcodeSet:
            errors = validate_barcode_sample_association(selectedBarcodes, barcodeSet)

            myErrors = convert(errors)
            if myErrors.get("MISSING_BARCODE", ""):
                self.validationErrors[SavePlanFieldNames.NO_BARCODE] = myErrors.get("MISSING_BARCODE", "")
            if myErrors.get("DUPLICATE_BARCODE", ""):
                self.validationErrors[SavePlanFieldNames.BAD_BARCODES] = myErrors.get("DUPLICATE_BARCODE", "")

        if selectedEndBarcodes:
            applProduct = self.savedObjects[SavePlanFieldNames.APPL_PRODUCT]
            if applProduct and applProduct.dualBarcodingRule == "no_reuse":
                errors = validate_barcode_sample_association(selectedEndBarcodes, endBarcodeSet, isEndBarcodeExists = True)

                myErrors = convert(errors)
                if myErrors.get("DUPLICATE_BARCODE", ""):
                    self.validationErrors[SavePlanFieldNames.BAD_BARCODES] = myErrors.get("DUPLICATE_BARCODE", "")
Beispiel #6
0
    def validateStep(self):
        any_samples = False
        self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_NAME] = []
        self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_EXTERNAL_ID] = []
        self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_DESCRIPTION] = []
        self.validationErrors[SavePlanFieldNames.BAD_TUBE_LABEL] = []
        self.validationErrors[SavePlanFieldNames.BAD_IR_SET_ID] = []

        self.validationErrors.pop(SavePlanFieldNames.NO_BARCODE, None)
        self.validationErrors.pop(SavePlanFieldNames.BAD_BARCODES, None)

        barcodeSet = self.savedFields[SavePlanFieldNames.BARCODE_SET]
        selectedBarcodes = []

        samplesTable = json.loads(self.savedFields[SavePlanFieldNames.SAMPLES_TABLE])

        # logger.debug("save_plan_step_data - anySamples? samplesTable=%s" %(samplesTable))

        for row in samplesTable:
            sample_name = row.get(SavePlanFieldNames.SAMPLE_NAME, "").strip()

            # logger.debug("save_plan_step_data - anySamples? sampleName=%s" %(sample_name))

            if sample_name:
                any_samples = True
                if validate_sample_name(sample_name):
                    self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_NAME].append(sample_name)

                external_id = row.get(SavePlanFieldNames.SAMPLE_EXTERNAL_ID, "")
                if external_id:
                    self.validate_field(external_id, self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_EXTERNAL_ID])

                description = row.get(SavePlanFieldNames.SAMPLE_DESCRIPTION, "")
                if description:
                    self.validate_field(
                        description,
                        self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_DESCRIPTION],
                        False,
                        MAX_LENGTH_SAMPLE_DESCRIPTION,
                    )

                ir_set_id = row.get("irSetId", "")
                if ir_set_id and not (str(ir_set_id).isdigit()):
                    self.validationErrors[SavePlanFieldNames.BAD_IR_SET_ID].append(ir_set_id)

                tube_label = row.get("tubeLabel", "")
                if validate_sample_tube_label(tube_label):
                    self.validationErrors[SavePlanFieldNames.BAD_TUBE_LABEL].append(tube_label)

                if barcodeSet:
                    selectedBarcodes.append(row.get("barcodeId"))

        if any_samples:
            self.validationErrors.pop(SavePlanFieldNames.NO_SAMPLES, None)
        else:
            self.validationErrors[SavePlanFieldNames.NO_SAMPLES] = "You must enter at least one sample"

        if not self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_NAME]:
            self.validationErrors.pop(SavePlanFieldNames.BAD_SAMPLE_NAME, None)

        if not self.validationErrors[SavePlanFieldNames.BAD_TUBE_LABEL]:
            self.validationErrors.pop(SavePlanFieldNames.BAD_TUBE_LABEL, None)

        if not self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_EXTERNAL_ID]:
            self.validationErrors.pop(SavePlanFieldNames.BAD_SAMPLE_EXTERNAL_ID, None)

        if not self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_DESCRIPTION]:
            self.validationErrors.pop(SavePlanFieldNames.BAD_SAMPLE_DESCRIPTION, None)

        if not self.validationErrors[SavePlanFieldNames.BAD_IR_SET_ID]:
            self.validationErrors.pop(SavePlanFieldNames.BAD_IR_SET_ID, None)

        if barcodeSet:
            errors = validate_barcode_sample_association(selectedBarcodes, barcodeSet)

            myErrors = convert(errors)
            if myErrors.get("MISSING_BARCODE", ""):
                self.validationErrors[SavePlanFieldNames.NO_BARCODE] = myErrors.get("MISSING_BARCODE", "")
            if myErrors.get("DUPLICATE_BARCODE", ""):
                self.validationErrors[SavePlanFieldNames.BAD_BARCODES] = myErrors.get("DUPLICATE_BARCODE", "")
Beispiel #7
0
    def validateStep(self):
        any_samples = False
        self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_NAME] = []
        self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_EXTERNAL_ID] = []
        self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_DESCRIPTION] = []
        self.validationErrors[SavePlanFieldNames.BAD_TUBE_LABEL] = []
        self.validationErrors[SavePlanFieldNames.BAD_IR_SET_ID] = []

        self.validationErrors.pop(SavePlanFieldNames.NO_BARCODE, None)
        self.validationErrors.pop(SavePlanFieldNames.BAD_BARCODES, None)

        barcodeSet = self.savedFields[SavePlanFieldNames.BARCODE_SET]
        selectedBarcodes = []

        samplesTable = json.loads(
            self.savedFields[SavePlanFieldNames.SAMPLES_TABLE])

        #logger.debug("save_plan_step_data - anySamples? samplesTable=%s" %(samplesTable))

        for row in samplesTable:
            sample_name = row.get(SavePlanFieldNames.SAMPLE_NAME, '').strip()

            #logger.debug("save_plan_step_data - anySamples? sampleName=%s" %(sample_name))

            if sample_name:
                any_samples = True
                if validate_sample_name(sample_name):
                    self.validationErrors[
                        SavePlanFieldNames.BAD_SAMPLE_NAME].append(sample_name)

                external_id = row.get(SavePlanFieldNames.SAMPLE_EXTERNAL_ID,
                                      '')
                if external_id:
                    self.validate_field(
                        external_id, self.validationErrors[
                            SavePlanFieldNames.BAD_SAMPLE_EXTERNAL_ID])

                description = row.get(SavePlanFieldNames.SAMPLE_DESCRIPTION,
                                      '')
                if description:
                    self.validate_field(
                        description, self.validationErrors[
                            SavePlanFieldNames.BAD_SAMPLE_DESCRIPTION], False,
                        MAX_LENGTH_SAMPLE_DESCRIPTION)

                ir_set_id = row.get('irSetId', '')
                if ir_set_id and not (str(ir_set_id).isdigit()):
                    self.validationErrors[
                        SavePlanFieldNames.BAD_IR_SET_ID].append(ir_set_id)

                tube_label = row.get('tubeLabel', '')
                if validate_sample_tube_label(tube_label):
                    self.validationErrors[
                        SavePlanFieldNames.BAD_TUBE_LABEL].append(tube_label)

                if barcodeSet:
                    selectedBarcodes.append(row.get('barcodeId'))

        if any_samples:
            self.validationErrors.pop(SavePlanFieldNames.NO_SAMPLES, None)
        else:
            self.validationErrors[
                SavePlanFieldNames.
                NO_SAMPLES] = "You must enter at least one sample"

        if not self.validationErrors[SavePlanFieldNames.BAD_SAMPLE_NAME]:
            self.validationErrors.pop(SavePlanFieldNames.BAD_SAMPLE_NAME, None)

        if not self.validationErrors[SavePlanFieldNames.BAD_TUBE_LABEL]:
            self.validationErrors.pop(SavePlanFieldNames.BAD_TUBE_LABEL, None)

        if not self.validationErrors[
                SavePlanFieldNames.BAD_SAMPLE_EXTERNAL_ID]:
            self.validationErrors.pop(
                SavePlanFieldNames.BAD_SAMPLE_EXTERNAL_ID, None)

        if not self.validationErrors[
                SavePlanFieldNames.BAD_SAMPLE_DESCRIPTION]:
            self.validationErrors.pop(
                SavePlanFieldNames.BAD_SAMPLE_DESCRIPTION, None)

        if not self.validationErrors[SavePlanFieldNames.BAD_IR_SET_ID]:
            self.validationErrors.pop(SavePlanFieldNames.BAD_IR_SET_ID, None)

        if barcodeSet:
            errors = validate_barcode_sample_association(
                selectedBarcodes, barcodeSet)

            myErrors = convert(errors)
            if myErrors.get("MISSING_BARCODE", ""):
                self.validationErrors[
                    SavePlanFieldNames.NO_BARCODE] = myErrors.get(
                        "MISSING_BARCODE", "")
            if myErrors.get("DUPLICATE_BARCODE", ""):
                self.validationErrors[
                    SavePlanFieldNames.BAD_BARCODES] = myErrors.get(
                        "DUPLICATE_BARCODE", "")