def checkFunction(row_index_1, field_name_1, def_field_list, metadata_list, records_list, record_id_map_list, repeating_forms_events_list, form_repetition_map_list): element_bad = False # Get values from first project. row_1 = records_list[0][row_index_1] record_id = row_1[def_field_list[0]] menin_enceph = row_1["menin_enceph"] # Get values from second project. event_2 = "acute_arm_1" instance_2 = None infectma___1, infectma___1_hidden = getEntryLR(record_id, event_2, instance_2, "infectma___1", records_list[1], record_id_map_list[1], metadata_list[1], form_repetition_map_list[1]) infectma___3, infectma___3_hidden = getEntryLR(record_id, event_2, instance_2, "infectma___3", records_list[1], record_id_map_list[1], metadata_list[1], form_repetition_map_list[1]) err1 = (menin_enceph == '1') and ((infectma___1 != '1') and (infectma___3 != '1')) err2 = (menin_enceph == '0') and ((infectma___1 != '0') or (infectma___3 != '0')) # err3 = ((infectma___1 == '0') and (infectma___3 == '0')) and (menin_enceph != '0') # do not count as error because an unchecked checkbox could be missing data. err4 = ((infectma___1 == '1') or (infectma___3 == '1')) and (menin_enceph != '1') if err1 or err2 or err4: element_bad = True return element_bad
def checkFunction(row_index_1, field_name_1, def_field_list, metadata_list, records_list, record_id_map_list, repeating_forms_events_list, form_repetition_map_list): element_bad = False # Get values from first project. row_1 = records_list[0][row_index_1] record_id = row_1[def_field_list[0]] def___1_1 = row_1["defvsposseizure___1"] def___3_1 = row_1["defvsposseizure___3"] def___4_1 = row_1["defvsposseizure___4"] def___5_1 = row_1["defvsposseizure___5"] # Get values from second project event_2 = "acute_arm_1" instance_2 = None seizind_2, hidden = getEntryLR(record_id, event_2, instance_2, "seizind", records_list[1], record_id_map_list[1], metadata_list[1], form_repetition_map_list[1]) seizinde_2, hidden = getEntryLR(record_id, event_2, instance_2, "seizinde", records_list[1], record_id_map_list[1], metadata_list[1], form_repetition_map_list[1]) # The branching logic is the same for these two fields, so assign hidden state to a single variable. if ( not hidden ): # Only perform check if the fields are not hidden by branching logic in IPSS. # defvsposseizure___1 = 1 <=> seizind = 1 if (def___1_1 == "1") and (seizind_2 != "1"): element_bad = True elif (seizind_2 == "1") and (def___1_1 != "1"): element_bad = True # defvsposseizure___3 = 1 <=> seizinde = 1 if (def___3_1 == "1") and (seizinde_2 != "1"): element_bad = True elif (seizinde_2 == "1") and (def___3_1 != "1"): element_bad = True # defvsposseizure___4 = 1 <=> seizind = 2 if (def___4_1 == "1") and (seizind_2 != "2"): element_bad = True elif (seizind_2 == "2") and (def___4_1 != "1"): element_bad = True # defvsposseizure___5 = 1 <=> seizinde = 2 if (def___5_1 == "1") and (seizinde_2 != "2"): element_bad = True elif (seizinde_2 == "2") and (def___5_1 != "1"): element_bad = True return element_bad
def checkFunction(row_index_1, field_name_1, def_field_list, metadata_list, records_list, record_id_map_list, repeating_forms_events_list, form_repetition_map_list): element_bad = False # Get values from first project. row_1 = records_list[0][row_index_1] record_id = row_1[def_field_list[0]] bpdate_v2_1 = row_1["bpdate_v2"] # Get values from second project event_2 = "acute_arm_1" instance_2 = None seizur___1_2, hidden = getEntryLR(record_id, event_2, instance_2, "seizur___1", records_list[1], record_id_map_list[1], metadata_list[1], form_repetition_map_list[1]) if (bpdate_v2_1 == "1") and (seizur___1_2 != "1"): element_bad = True elif ((bpdate_v2_1 == "0") or (bpdate_v2_1 == "")) and (seizur___1_2 == "1"): element_bad = True return element_bad
def checkFunction(row_index, field_name, def_field, metadata, records, record_id_map, repeating_forms_events, form_repetition_map): element_bad = False # Assume good until flaw found. field = metadata[field_name] row = records[row_index] record_id = row[def_field] event_name = row['redcap_event_name'] instance = row['redcap_repeat_instance'] if (instance == ''): instance = None value, hidden = getEntryLR(record_id, event_name, instance, field_name, records, record_id_map, metadata, form_repetition_map) if (hidden): if (field.field_type == "checkbox"): if (field_name == field.choices[0]): # Perform check when the first checkbox option is found. all_boxes_blank = True # Assume all blank until nonblank option found. for choice_field_name in field.choices: # Loop over the other checkbox options. if (row[choice_field_name] == '1'): all_boxes_blank = False break # WON'T WORK IF FIELD NAME IS 'foo___var_name___1'. if (not all_boxes_blank): element_bad = True elif (value != ""): element_bad = True return element_bad
def checkFunction(row_index_1, field_name_1, def_field_list, metadata_list, records_list, record_id_map_list, repeating_forms_events_list, form_repetition_map_list): element_bad = False # Get values from first project. row_1 = records_list[0][row_index_1] record_id = row_1[def_field_list[0]] vstetiol = row_1["vstetiol"] # Get values from second project. event_2 = "acute_arm_1" instance_2 = None othtreti, othtreti_hidden = getEntryLR(record_id, event_2, instance_2, "othtreti", records_list[1], record_id_map_list[1], metadata_list[1], form_repetition_map_list[1]) ster, ster_hidden = getEntryLR(record_id, event_2, instance_2, "ster", records_list[1], record_id_map_list[1], metadata_list[1], form_repetition_map_list[1]) acyclo, acyclo_hidden = getEntryLR(record_id, event_2, instance_2, "acyclo", records_list[1], record_id_map_list[1], metadata_list[1], form_repetition_map_list[1]) if (vstetiol == '1'): if (othtreti == '') or ((ster == '') and (not ster_hidden)) or ((acyclo == '') and (not acyclo_hidden)): element_bad = True return element_bad
def rowConditions(row_index, def_field, metadata, records, record_id_map, repeating_forms_events, form_repetition_map): record_id = records[row_index][def_field] event = "acute_arm_1" instance = None field_name = "substud___4" # Only check row if record is in SIPS II in_sips2, hidden = getEntryLR(record_id, event, instance, field_name, records, record_id_map, metadata, form_repetition_map) if (in_sips2 == "1"): check_row = True else: check_row = False return check_row
def checkFunction(row_index_1, field_name_1, def_field_list, metadata_list, records_list, record_id_map_list, repeating_forms_events_list, form_repetition_map_list): element_bad = False # Get values from first project. row_1 = records_list[0][row_index_1] record_id = row_1[def_field_list[0]] fhstrkyng = row_1["fhstrkyng"] # Get values from second project. event_2 = "acute_arm_1" instance_2 = None hstroke, hstroke_hidden = getEntryLR(record_id, event_2, instance_2, "hstroke", records_list[1], record_id_map_list[1], metadata_list[1], form_repetition_map_list[1]) if (fhstrkyng == '1'): if (hstroke != '1'): element_bad = True return element_bad
def checkFunction(row_index_1, field_name_1, def_field_list, metadata_list, records_list, record_id_map_list, repeating_forms_events_list, form_repetition_map_list): element_bad = False # Get values from first project. row_1 = records_list[0][row_index_1] record_id = row_1[def_field_list[0]] earinf = row_1["earinf"] # Get values from second project. event_2 = "acute_arm_1" instance_2 = None infectmi___2, infectmi___2_hidden = getEntryLR(record_id, event_2, instance_2, "infectmi___2", records_list[1], record_id_map_list[1], metadata_list[1], form_repetition_map_list[1]) err1 = (earinf == '1') and (infectmi___2 != '1') err2 = (earinf == '0') and (infectmi___2 != '0') err3 = (infectmi___2 == '1') and (earinf != '1') # err4 = (infectmi___2 == '0') and (earinf != '0') # do not count as an error because an unchecked checkbox could be missing data. if err1 or err2 or err3: element_bad = True return element_bad
def checkFunction(row_index_1, field_name_1, def_field_list, metadata_list, records_list, record_id_map_list, repeating_forms_events_list, form_repetition_map_list): element_bad = False # Get values from first project. row_1 = records_list[0][row_index_1] record_id = row_1[def_field_list[0]] medications_1 = row_1["medications"] # Get values from second project. event_2 = "acute_arm_1" instance_2 = None anticonv_2, hidden = getEntryLR(record_id, event_2, instance_2, "anticonv", records_list[1], record_id_map_list[1], metadata_list[1], form_repetition_map_list[1]) if (medications_1 == "1"): if (anticonv_2 != "1"): element_bad = True return element_bad