def breast_symptoms(conn, cursor, file_number, table):
    from ask_y_n_statement import get_symptom, get_rb_lb, ask_y_n
    from add_update_sql import update_multiple
    from breast_cancer_tables import other_symp
    symp_state = "Pain or tenderness", "Lumps", "Nipple Discharge", "Nipple Retraction", "Dimpling", \
        "Discolouration", "Ulceration", "Eczema"
    symptoms = get_symptom(symp_state)
    rb = get_rb_lb(symptoms, 0)
    rb_symp = list(filter(None, get_rb_lb(rb, 0)))
    rb_dur = list(filter(None, get_rb_lb(rb, 1)))
    lb = get_rb_lb(symptoms, 1)
    lb_symp = list(filter(None, get_rb_lb(lb, 0)))
    lb_dur = list(filter(None, get_rb_lb(lb, 1)))
    data = [rb_symp, rb_dur, lb_symp, lb_dur]
    for index in range(0, len(data)):
        if not data[index]:
            data[index] = ["NA"]
        else:
            data[index] = ["; ".join(data[index])]
    data_flat = [item for sublist in data for item in sublist]
    new_data = tuple(data_flat)
    columns = "RB_symptoms", "RB_symptoms_duration", "LB_symptoms", "LB_symptoms_duration"
    update_multiple(conn, cursor, table, columns, file_number, new_data)
    other_symptom = ask_y_n("Other Symptoms?", True, False)
    if other_symptom:
        other_symp(conn, cursor, file_number, table)
    else:
        other_symptom = "No other symptoms"
        other_symp_dur = "NA"
        data = (other_symptom, other_symp_dur, other_symptom, other_symp_dur)
        columns = "RB_Other_Symptoms", "RB_Other_Symptoms_duration", "LB_Other_Symptoms", "RB_Other_Symptoms_duration"
        update_multiple(conn, cursor, table, columns, file_number, data)
def breast_symptoms(conn, cursor, file_number, table, symp_state):
    from ask_y_n_statement import get_symptom, get_rb_lb
    from add_update_sql import update_multiple
    from breast_cancer_tables import other_symp
    symptoms = get_symptom(symp_state)
    rb = get_rb_lb(symptoms, 0)
    rb_symp = list(filter(None, get_rb_lb(rb, 0)))
    rb_dur = list(filter(None, get_rb_lb(rb, 1)))
    lb = get_rb_lb(symptoms, 1)
    lb_symp = list(filter(None, get_rb_lb(lb, 0)))
    lb_dur = list(filter(None, get_rb_lb(lb, 1)))
    data = [rb_symp, rb_dur, lb_symp, lb_dur]
    for index in range(0, len(data)):
        if not data[index]:
            data[index] = ["NA"]
        else:
            data[index] = ["; ".join(data[index])]
    data_flat = [item for sublist in data for item in sublist]
    new_data = tuple(data_flat)
    columns = "RB_symptoms", "RB_symptoms_duration", "LB_symptoms", "LB_symptoms_duration"
    update_multiple(conn, cursor, table, columns, file_number, new_data)
    other_symptom = input("Other Symptoms? (y/n) ")
    if str.lower(other_symptom) == "y":
        other_symp(conn, cursor, file_number, table)
    else:
        other_symptom = "No other symptoms"
        other_symp_dur = "NA"
        data = (other_symptom, other_symp_dur, other_symptom, other_symp_dur)
        columns = "RB_Other_Symptoms", "RB_Other_Symptoms_duration", "LB_Other_Symptoms", "RB_Other_Symptoms_duration"
        update_multiple(conn, cursor, table, columns, file_number, data)
def other_symp(conn, cursor, file_number, table):
    from add_update_sql import update_multiple
    from ask_y_n_statement import get_rb_lb
    #data = file_number, mr_number, name
    add_symp = "y"
    all_data = []
    while str.lower(add_symp) == "y":
        other_symp = input("Type of symptom: ")
        symp_breast_right = input("Right Breast y/n: ")
        if str.lower(symp_breast_right) == "y":
            symp_breast_right = other_symp
            symp_duration_right = input(
                "Duration of symptoms in right breast: ")
        else:
            symp_breast_right = None
            symp_duration_right = None
        symp_breast_left = input("Left Breast y/n: ")
        if str.lower(symp_breast_left) == "y":
            symp_breast_left = other_symp
            symp_duration_left = input("Duration of symptoms in left breast: ")
        else:
            symp_breast_left = None
            symp_duration_left = None
        RB = [symp_breast_right, symp_duration_right]
        LB = [symp_breast_left, symp_duration_left]
        data = [RB, LB]
        all_data.append(data)
        print("Include more symptoms?")
        add_symp = input("y/n: ")
    rb = get_rb_lb(all_data, 0)
    rb_symp = list(filter(None, get_rb_lb(rb, 0)))
    rb_dur = list(filter(None, get_rb_lb(rb, 1)))
    lb = get_rb_lb(all_data, 1)
    lb_symp = list(filter(None, get_rb_lb(lb, 0)))
    lb_dur = list(filter(None, get_rb_lb(lb, 1)))
    data = [rb_symp, rb_dur, lb_symp, lb_dur]
    data = [rb_symp, rb_dur, lb_symp, lb_dur]
    for index in range(0, len(data)):
        if not data[index]:
            data[index] = ["No other symptoms"]
        else:
            data[index] = ["; ".join(data[index])]
    data_flat = [item for sublist in data for item in sublist]
    new_data = tuple(data_flat)
    columns = "RB_Other_Symptoms", "RB_Other_Symptoms_duration", "LB_Other_Symptoms", "RB_Other_Symptoms_duration"
    update_multiple(conn, cursor, table, columns, file_number, new_data)