Пример #1
0
def add_gen_info(conn, cursor, file_number, user_name):
    table = "patient_information_history"
    #file_row(cursor, file_number)
    enter = ask_y_n("Enter Patient Biographical Information")
    if enter:
        data = bio_info(file_number)
        update_multiple(conn, cursor, table, pccm_names.names_info("bio_info"),
                        file_number, data)
    enter = ask_y_n("Enter Patient habits")
    if enter:
        data = phys_act(conn, cursor, file_number)
        update_multiple(conn, cursor, table, pccm_names.names_info("phys_act"),
                        file_number, data)
        data = habits(file_number)
        update_multiple(conn, cursor, table, pccm_names.names_info("habits"),
                        file_number, data)
        data = nut_supplements(conn, cursor, file_number)
        update_multiple(conn, cursor, table,
                        pccm_names.names_info("nut_supplements"), file_number,
                        data)
    enter = ask_y_n("Enter Patient family and reproductive details?")
    if enter:
        data = family_details(conn, cursor, file_number)
        update_multiple(conn, cursor, table,
                        pccm_names.names_info("family_details"), file_number,
                        data)
    enter = ask_y_n("Enter Patient and family medical history?")
    if enter:
        data = med_history(conn, cursor, file_number)
        update_multiple(conn, cursor, table,
                        pccm_names.names_info("med_history"), file_number,
                        data)
        data = cancer_history(conn, cursor, file_number)
        update_multiple(conn, cursor, table,
                        pccm_names.names_info("cancer_history"), file_number,
                        data)
        data = family_cancer(conn, cursor, file_number)
        update_multiple(conn, cursor, table,
                        pccm_names.names_info("family_cancer"), file_number,
                        data)
    enter = ask_y_n("Enter Patient Symptoms?")
    if enter:
        data = det_by(file_number)
        update_multiple(conn, cursor, table, pccm_names.names_info("det_by"),
                        file_number, data)
        data = breast_symptoms(file_number, user_name)
        update_multiple(conn, cursor, table,
                        pccm_names.names_info("breast_symptoms"), file_number,
                        data)
    print_info(cursor, file_number)
Пример #2
0
def print_info(cursor, file_number, folders):
    import docx
    from datetime import date
    import helper_function.pccm_names as pccm_names
    import os.path
    module_name = [
        "bio_info", "nut_supplements", "phys_act", "habits", "family_details",
        "med_history", "cancer_history", "family_cancer", "det_by",
        "breast_symptoms"
    ]
    folder = folders + '/Gen_Info_Docs'
    file_name = "Folder_" + (file_number.replace("/", "_")) + ".docx"
    path = os.path.join(folder, file_name)
    p_date_to_print = date.today().strftime('%d-%b-%Y')
    doc = docx.Document()
    doc.add_paragraph(("File Number " + file_number), style="Title")
    doc.add_paragraph(("Document Created on " + p_date_to_print),
                      style="Quote")
    for index in range(0, len(module_name)):
        col_titles = pccm_names.names_info(module_name[index])
        columns = ", ".join(col_titles)
        sql = 'SELECT ' + columns + ' FROM Patient_Information_History WHERE File_number = \'' + file_number + "'"
        data = cursor.execute(sql)
        data_file = data.fetchall()
        data_print = list(data_file[0])
        text_titles = pccm_names.info_print_all(module_name[index])
        for i in range(0, len(data_print)):
            p = doc.add_paragraph((text_titles[i] + ":  "),
                                  style="List Bullet")
            (p.add_run(data_print[i])).bold = True
        doc.add_paragraph()
    doc.save(path)
Пример #3
0
def bio_info(file_number):
    module_name = "bio_info"
    mr_number = gf.get_number_lt(500, 2000)
    name = names.get_full_name(gender='female')
    aadhaar_card = 'data_not_available'
    date_first = gf.gen_date(base_date='2010-12-12')
    permanent_address = 'data_not_available'
    current_address = permanent_address
    phone = gf.get_number_lt(900000000, 999999999)
    email_id = 'data_not_available'
    gender = gf.get_choice(["Female", "Male"])
    date_of_birth = gf.get_dob()
    age_yrs = gf.get_age(date_of_birth)
    age_diag = gf.get_years(date_of_birth, date_first)
    place_birth = 'data_not_available'
    height_cm = gf.get_number_lt(140, 180)
    weight_kg = gf.get_number_lt(50, 90)
    weight = float(weight_kg)
    height = float(height_cm) / 100
    bmi = str(round(weight / (height * height)))
    columns_list = pccm_names.names_info(module_name)
    new_data = [
        mr_number, name, aadhaar_card, date_first, permanent_address,
        current_address, phone, email_id, gender, age_yrs, age_diag,
        date_of_birth, place_birth, height_cm, weight_kg, bmi
    ]
    return (age_diag, tuple(new_data))
Пример #4
0
def metastasis_symp(file_number):
    module_name = "metastasis_symp"
    check = False
    while not check:
        met_none = ask_y_n("Metastatis Symptoms Present?")
        met = []
        if not met_none:
            met = [["No Metastatis Symptoms"]]
        else:
            met_bone = ask_y_n("Bone Pain")
            if met_bone:
                met.append(["Bone Pain"])
            met_cough = ask_y_n("Cough")
            if met_cough:
                met.append(["Cough"])
            met_jaundice = ask_y_n("Jaundice")
            if met_jaundice:
                met.append(["Jaundice"])
            met_headache = ask_y_n("Headache")
            if met_headache:
                met.append(["Headache"])
            met_weight = ask_y_n("Weight loss")
            if met_weight:
                met.append(["WeightLoss"])
        met_flat = [item for sublist in met for item in sublist]
        data_met = "; ".join(met_flat)
        columns_list = pccm_names.names_info(module_name)
        check = review_input(file_number, columns_list, [data_met])
    return (str(data_met))
Пример #5
0
def edit_data(conn, cursor, file_number, user_name):
    table = "patient_information_history"
    print("Patient Biographical Information")
    col_list = pccm_names.names_info("bio_info")
    enter = review_data(conn, cursor, table, file_number, col_list)
    if enter:
        data = bio_info(file_number)
        update_multiple(conn, cursor, table, col_list, file_number, data)
    col_list = pccm_names.names_info("phys_act") + pccm_names.names_info(
        "habits") + pccm_names.names_info("nut_supplements")
    print("Patient habits")
    enter = review_data(conn, cursor, table, file_number, col_list)
    if enter:
        data_phys = phys_act(conn, cursor, file_number)
        data_hab = habits(file_number)
        data_nut = nut_supplements(conn, cursor, file_number)
        data = data_phys + data_hab + data_nut
        update_multiple(conn, cursor, table, col_list, file_number, data)
    print("Patient family and reproductive details")
    col_list = pccm_names.names_info("family_details")
    enter = review_data(conn, cursor, table, file_number, col_list)
    if enter:
        data = family_details(conn, cursor, file_number)
        update_multiple(conn, cursor, table, col_list, file_number, data)
    print("Patient and family medical history")
    col_list = pccm_names.names_info("med_history") + pccm_names.names_info(
        "cancer_history") + pccm_names.names_info("family_cancer")
    enter = review_data(conn, cursor, table, file_number, col_list)
    if enter:
        data_med = med_history(conn, cursor, file_number)
        data_can = cancer_history(conn, cursor, file_number)
        data_fam = family_cancer(conn, cursor, file_number)
        data = data_med + data_can + data_fam
        update_multiple(conn, cursor, table, col_list, file_number, data)
    print("Patient Symptoms")
    col_list = pccm_names.names_info("det_by") + pccm_names.names_info(
        "breast_symptoms")
    enter = review_data(conn, cursor, table, file_number, col_list)
    if enter:
        data_det = det_by(file_number)
        data_symp = breast_symptoms(file_number, user_name)
        data = data_det + data_symp
        update_multiple(conn, cursor, table, col_list, file_number, data)
    print_info(cursor, file_number)
Пример #6
0
 def bio_info(self):
     module_name = "bio_info"
     new_data = ['NA'] * 16
     check = False
     while not check:
         mr_number = input('MR number :')
         name = input('Name :')
         aadhaar_card = input("Aadhaar card number (if available): ")
         date_first = check_date("Date of first visit: ")
         permanent_address = input('Permanent Address :')
         current_address_check = ask_option(
             'Current Address', ["Same as Permanent", "Different"])
         if current_address_check == "Different":
             current_address = input("Current Address: ")
         else:
             current_address = permanent_address
         phone = input('Phone :')
         email_id = input('Email_ID :')
         gender = ask_option('Gender', ["Female", "Male", "Other"])
         age_yrs = input('Age at first visit (yrs) :')
         age_diag = input('Age at diagnosis (yrs): ')
         date_of_birth = check_date('Date of Birth (dd/mm/yyyy):')
         place_birth = input('Place of Birth :')
         height = ask_option("Height unit",
                             ["cm", "feet/inches", "Height not available"])
         height_cm, height_feet, height_inch, weight, bmi = ['NA'] * 5
         if height == "Height not available":
             height_cm = "NA"
             weight_kg = input('Weight (kg) (if available else enter NA) :')
             bmi = "NA"
         else:
             if height == "cm":
                 height_cm = input('Height (cm) :')
             else:
                 height_feet = float(input("Height (feet)"))
                 height_inch = float(input("Height (inches)"))
                 height_inch = height_inch + 12 * height_feet
                 height_cm = height_inch * 2.54
             weight_kg = input('Weight (kg) (if available else enter NA) :')
             try:
                 weight = float(weight_kg)
                 height = float(height_cm) / 100
                 bmi = str(round(weight / (height * height)))
             except ValueError:
                 bmi = 'NA'
         columns_list = pccm_names.names_info(module_name)
         new_data = [
             mr_number, name, aadhaar_card, date_first, permanent_address,
             current_address, phone, email_id, gender, age_yrs, age_diag,
             date_of_birth, place_birth, height_cm, weight_kg, bmi
         ]
         check = review_input(self.file_number, columns_list, new_data)
     return new_data
Пример #7
0
def family_cancer(file_number):
    module_name = "family_cancer"
    family_cancer_history_y_n = gf.get_yes_no_na()
    if family_cancer_history_y_n == 'yes':
        family_cancer = bct.family_cancer_table(file_number)
        family_cancer_history_y_n = "Family History of Cancer"
    elif family_cancer_history_y_n == 'no':
        family_cancer_history_y_n = "No Family History of Cancer"
        family_cancer = "No Family History of Cancer"
    else:
        family_cancer = family_cancer_history_y_n
    data_list = [family_cancer_history_y_n, family_cancer]
    columns_list = pccm_names.names_info(module_name)
    return (tuple(data_list))
def nut_supp_table(file_number):
    type_nut_list, quant_nut_list, duration_nut_list = [], [], []
    add_supp = True
    table_nut = "nutritional_supplements"
    columns = ", ".join(pccm_names.names_info("nut_sup"))
    nut_supplements_type = 'data_not_available'
    type_nut_list.append(nut_supplements_type)
    nut_supplements_quant = str(gf.get_number(1000))
    quant_nut_list.append(nut_supplements_quant)
    nut_supplements_duration = str(gf.get_number(4))
    duration_nut_list.append(nut_supplements_duration)
    type_nut = '; '.join(type_nut_list)
    quant_nut = '; '.join(quant_nut_list)
    duration_nut = "; ".join(duration_nut_list)
    return (type_nut, quant_nut, duration_nut)
Пример #9
0
def det_by(file_number):
    module_name = "det_by"
    check = False
    while not check:
        category = "Current Breast Cancer Detected by"
        options = ["Self", "Physician", "Screening Camp", "Other"]
        determined_by = ask_option(category, options)
        if determined_by == "Screening Camp":
            sc_id = input("Screening Camp ID: ")
            determined_by = "Screening Camp ID " + sc_id
        det_date = input("Date of current breast cancer detection: ")
        columns_list = pccm_names.names_info(module_name)
        data_list = [determined_by, det_date]
        check = review_input(file_number, columns_list, data_list)
    return (tuple(data_list))
Пример #10
0
def nut_supplements(file_number):
    module_name = "nut_supplements"
    nut_supplements = gf.get_yes_no_na()
    if nut_supplements == 'yes':
        nuts = bct.nut_supp_table(file_number)
        nut_supplements = "Nutritional supplements taken"
    elif nut_supplements == 'no':
        nut_supplements = "No nutritional supplements taken"
        nuts = ("No nutritional supplements taken", ) * 3
    else:
        nuts = (nut_supplements, ) * 3
    nuts_type, nuts_quant, nuts_dur = nuts
    data_list = [nut_supplements, nuts_type, nuts_quant, nuts_dur]
    columns_list = pccm_names.names_info(module_name)
    return (tuple(data_list))
Пример #11
0
def phys_act(file_number):
    module_name = "phys_act"
    phys_act = gf.get_yes_no_na()
    if phys_act == 'yes':
        phys = bct.physical_activity_table(file_number)
        phys_act = "Physical Activities Performed"
        phys_act_done, phys_act_freq = phys
    elif phys_act == 'no':
        phys_act = "No Physical Activities"
        phys_act_done, phys_act_freq = ("No Physical Activities", ) * 2
    else:
        phys_act_done, phys_act_freq = (phys_act, ) * 2
    data_list = [phys_act, phys_act_done, phys_act_freq]
    columns_list = pccm_names.names_info(module_name)
    return (tuple(data_list))
Пример #12
0
 def other_test(self):
     data_list = [
         'data_to_be_entered',
     ] * 14 + [self.user_name, last_update()]
     module_name = "other_test"
     check = False
     while not check:
         print(
             'In this module please enter data for tests done at the time of diagnosis before the start of '
             'treatment')
         data = clinical_tests()
         data_list = data + [self.user_name, last_update()]
         col_list = pccm_names.names_info(module_name)
         check = review_input(self.file_number, col_list, data_list)
     return data_list
Пример #13
0
def family_cancer(conn, cursor, file_number):
    module_name = "family_cancer"
    check = False
    while not check:
        family_cancer_history_y_n = ask_y_n('Cancer history in Family')
        if family_cancer_history_y_n:
            family_cancer = family_cancer_table(conn, cursor, file_number)
            family_cancer_history_y_n = "Family History of Cancer"
        else:
            family_cancer_history_y_n = "No Family History of Cancer"
            family_cancer = "NA"
        data_list = [family_cancer_history_y_n, family_cancer]
        columns_list = pccm_names.names_info(module_name)
        check = review_input(file_number, columns_list, data_list)
    return (tuple(data_list))
def physical_activity_table(file_number):
    # def physical_activity_table(file_number):
    table_act = "physical_activity"
    columns = ", ".join(pccm_names.names_info("phys_act_table"))
    type_phys_list, freq_phys_list = [], []
    type_phys_act = gf.get_choice(options=PatientInfo.phys_act)
    type_phys_list.append(type_phys_act)
    freq_phys_act = gf.get_choice(options=PatientInfo.frequency)
    freq_phys_list.append(freq_phys_act)
    type_phys_act = gf.get_choice(options=PatientInfo.phys_act)
    type_phys_list.append(type_phys_act)
    freq_phys_act = gf.get_choice(options=PatientInfo.frequency)
    freq_phys_list.append(freq_phys_act)
    type_phys = '; '.join(type_phys_list)
    freq_phys = '; '.join(freq_phys_list)
    return (type_phys, freq_phys)
Пример #15
0
def phys_act(conn, cursor, file_number):
    module_name = "phys_act"
    check = False
    while not check:
        phys_act = ask_y_n("Any Physical Activities ?")
        if phys_act:
            phys = physical_activity_table(conn, cursor, file_number)
            phys_act = "Physical Activities Performed"
            phys_act_done, phys_act_freq = phys
        else:
            phys_act = "No Physical Activities"
            phys_act_done, phys_act_freq = ("NA", ) * 2
        data_list = [phys_act, phys_act_done, phys_act_freq]
        columns_list = pccm_names.names_info(module_name)
        check = review_input(file_number, columns_list, data_list)
    return (tuple(data_list))
def physical_activity_table(conn, cursor, file_number):
    table_act = "physical_activity"
    columns = ", ".join(pccm_names.names_info("phys_act_table"))
    add_act = True
    type_phys_list, freq_phys_list = [], []
    while add_act:
        type_phys_act = input("Type of physical activity: ")
        type_phys_list.append(type_phys_act)
        freq_phys_act = input("Frequency of physical activity: ")
        freq_phys_list.append(freq_phys_act)
        data = file_number, type_phys_act, freq_phys_act
        sql.insert(conn, cursor, table_act, columns, data)
        add_act = ask_y_n("Add further activities?")
    type_phys = '; '.join(type_phys_list)
    freq_phys = '; '.join(freq_phys_list)
    return (type_phys, freq_phys)
Пример #17
0
def nut_supplements(conn, cursor, file_number):
    module_name = "nut_supplements"
    check = False
    while not check:
        nut_supplements = ask_y_n("Nutritional supplements taken")
        if nut_supplements:
            nuts = nut_supp_table(conn, cursor, file_number)
            nut_supplements = "Nutritional supplements taken"
        else:
            nut_supplements = "No nutritional supplements taken"
            nuts = ("NA", ) * 3
        nuts_type, nuts_quant, nuts_dur = nuts
        data_list = [nut_supplements, nuts_type, nuts_quant, nuts_dur]
        columns_list = pccm_names.names_info(module_name)
        check = review_input(file_number, columns_list, data_list)

    return (tuple(data_list))
Пример #18
0
def db_dict(table, module):
    db_tables = {
        "patient_information_history": names.names_info(module),
        "radiology": names.names_radio(module),
        'pet_reports': names.names_pet(module),
        'biopsy_path_report_data': names.names_biopsy(module),
        "neo_adjuvant_therapy": names.names_nact(module),
        "surgery_report": names.names_surgery_information(module),
        'surgery_path_report_data': names.names_surgery(module),
        "adjuvant_chemotherapy": names.names_chemotherapy(module),
        "radiotherapy": names.names_radiation(),
        "hormonetherapy_survival": names.names_longterm(module),
        "follow_up_data": names.name_follow_up(),
        'block_list': names.block_list(module)
    }

    cols = db_tables.get(table)
    return cols
Пример #19
0
def med_history(file_number):
    module_name = "med_history"
    medical_history_y_n = gf.get_yes_no_na()
    if medical_history_y_n == 'yes':
        med_hist = bct.med_history_table(file_number)
        medical_history_y_n = "Previous medical history present"
    elif medical_history_y_n == 'no':
        medical_history_y_n = "No previous medical history present"
        med_hist = ("No previous medical history present", ) * 3
    else:
        med_hist = (medical_history_y_n, ) * 3
    condition_hist, diagnosis_date_hist, treatment_hist = med_hist
    data_list = [
        medical_history_y_n, condition_hist, diagnosis_date_hist,
        treatment_hist
    ]
    columns_list = pccm_names.names_info(module_name)
    return (tuple(data_list))
Пример #20
0
 def family_cancer(self):
     module_name = "family_cancer"
     check = False
     while not check:
         family_cancer_history_y_n = ask_y_n_na('Cancer history in Family')
         if family_cancer_history_y_n == 'Yes':
             family_cancer = family_cancer_table(self.conn, self.cursor,
                                                 self.file_number)
             family_cancer_history_y_n = "Family History of Cancer"
         elif family_cancer_history_y_n == 'No':
             family_cancer_history_y_n = "No Family History of Cancer"
             family_cancer = "No Family History of Cancer"
         else:
             family_cancer = family_cancer_history_y_n
         data_list = [family_cancer_history_y_n, family_cancer]
         columns_list = pccm_names.names_info(module_name)
         check = review_input(self.file_number, columns_list, data_list)
     return data_list
Пример #21
0
def cancer_history(conn, cursor, file_number):
    module_name = "cancer_history"
    check = False
    while not check:
        previous_cancer_history_y_n = ask_y_n("Previous history of cancer ?")
        if previous_cancer_history_y_n:
            previous_cancer = cancer_table(conn, cursor, file_number)
            previous_cancer_history_y_n = "Previous history of cancer"
        else:
            previous_cancer_history_y_n = "No previous history of cancer"
            previous_cancer = ("NA", ) * 5
        type_of_cancer_list, year_diagnosis_list, treat_all, type_all, duration_all = previous_cancer
        data_list = [
            previous_cancer_history_y_n, type_of_cancer_list,
            year_diagnosis_list, treat_all, type_all, duration_all
        ]
        columns_list = pccm_names.names_info(module_name)
        check = review_input(file_number, columns_list, data_list)
    return (tuple(data_list))
Пример #22
0
def med_history(conn, cursor, file_number):
    module_name = "med_history"
    check = False
    while not check:
        medical_history_y_n = ask_y_n("Any Other Medical History ?")
        if medical_history_y_n:
            med_hist = med_history_table(conn, cursor, file_number)
            medical_history_y_n = "Previous medical history present"
        else:
            medical_history_y_n = "No previous medical history present"
            med_hist = ("NA", ) * 3
        condition_hist, diagnosis_date_hist, treatment_hist = med_hist
        data_list = [
            medical_history_y_n, condition_hist, diagnosis_date_hist,
            treatment_hist
        ]
        columns_list = pccm_names.names_info(module_name)
        check = review_input(file_number, columns_list, data_list)
    return (tuple(data_list))
Пример #23
0
 def nut_supplements(self):
     module_name = "nut_supplements"
     data_list = ['NA'] * 4
     check = False
     while not check:
         nutrition = ask_y_n_na("Nutritional supplements taken")
         if nutrition == 'Yes':
             nuts = nut_supp_table(self.conn, self.cursor, self.file_number)
             nutrition = "Nutritional supplements taken"
         elif nutrition == 'No':
             nutrition = "No nutritional supplements taken"
             nuts = ("No nutritional supplements taken", ) * 3
         else:
             nuts = (nutrition, ) * 3
         nuts_type, nuts_quant, nuts_dur = nuts
         data_list = [nutrition, nuts_type, nuts_quant, nuts_dur]
         columns_list = pccm_names.names_info(module_name)
         check = review_input(self.file_number, columns_list, data_list)
     return data_list
Пример #24
0
 def phys_act(self):
     module_name = "phys_act"
     check = False
     data_list = ['NA'] * 3
     while not check:
         activity = ask_y_n_na("Any Physical Activities ?")
         if activity == 'Yes':
             phys = physical_activity_table(self.conn, self.cursor,
                                            self.file_number)
             activity = "Physical Activities Performed"
             phys_act_done, phys_act_freq = phys
         elif activity == 'No':
             activity = "No Physical Activities"
             phys_act_done, phys_act_freq = ("No Physical Activities", ) * 2
         else:
             phys_act_done, phys_act_freq = (activity, ) * 2
         data_list = [activity, phys_act_done, phys_act_freq]
         columns_list = pccm_names.names_info(module_name)
         check = review_input(self.file_number, columns_list, data_list)
     return data_list
def nut_supp_table(conn, cursor, file_number):
    type_nut_list, quant_nut_list, duration_nut_list = [], [], []
    add_supp = True
    table_nut = "nutritional_supplements"
    columns = ", ".join(pccm_names.names_info("nut_sup"))
    while add_supp:
        nut_supplements_type = input("Type of nutritional supplements taken: ")
        type_nut_list.append(nut_supplements_type)
        nut_supplements_quant = input(
            "Quantity of nutritional supplements taken per day: ")
        quant_nut_list.append(nut_supplements_quant)
        nut_supplements_duration = input(
            "Duration of nutritional supplements use: ")
        duration_nut_list.append(nut_supplements_duration)
        new_data = file_number, nut_supplements_type, nut_supplements_quant, nut_supplements_duration
        sql.insert(conn, cursor, table_nut, columns, new_data)
        add_supp = ask_y_n('Add more nutritional supplements?')
    type_nut = '; '.join(type_nut_list)
    quant_nut = '; '.join(quant_nut_list)
    duration_nut = "; ".join(duration_nut_list)
    return (type_nut, quant_nut, duration_nut)
Пример #26
0
 def med_history(self):
     module_name = "med_history"
     check = False
     while not check:
         medical_history_y_n = ask_y_n_na("Any Other Medical History ?")
         if medical_history_y_n == 'Yes':
             med_hist = med_history_table(self.conn, self.cursor,
                                          self.file_number)
             medical_history_y_n = "Previous medical history present"
         elif medical_history_y_n == 'No':
             medical_history_y_n = "No previous medical history present"
             med_hist = ("No previous medical history present", ) * 3
         else:
             med_hist = (medical_history_y_n, ) * 3
         condition_hist, diagnosis_date_hist, treatment_hist = med_hist
         data_list = [
             medical_history_y_n, condition_hist, diagnosis_date_hist,
             treatment_hist
         ]
         columns_list = pccm_names.names_info(module_name)
         check = review_input(self.file_number, columns_list, data_list)
     return data_list
Пример #27
0
 def cancer_history(self):
     module_name = "cancer_history"
     data_list = ['NA'] * 6
     check = False
     while not check:
         previous_cancer_history_y_n = ask_y_n_na(
             "Previous history of cancer ?")
         if previous_cancer_history_y_n == 'Yes':
             previous_cancer = cancer_table(self.conn, self.cursor,
                                            self.file_number)
             previous_cancer_history_y_n = "Previous history of cancer"
         elif previous_cancer_history_y_n == 'No':
             previous_cancer_history_y_n = "No previous history of cancer"
             previous_cancer = ("No previous history of cancer", ) * 5
         else:
             previous_cancer = (previous_cancer_history_y_n, ) * 5
         type_of_cancer_list, year_diagnosis_list, treat_all, type_all, duration_all = previous_cancer
         data_list = [
             previous_cancer_history_y_n, type_of_cancer_list,
             year_diagnosis_list, treat_all, type_all, duration_all
         ]
         columns_list = pccm_names.names_info(module_name)
         check = review_input(self.file_number, columns_list, data_list)
     return data_list
Пример #28
0
table = "hormonetherapy_recurrence_survival"
col_list = [
    "File_number"
] + names.names_longterm("hormone") + names.names_longterm("metastasis")
sql = ('SELECT ' + ", ".join(col_list[:-2]) + " FROM '" + table + "'")
df = pd.read_sql(sql, conn)
df.to_excel(writer, sheet_name="Hormone_RecurrenceSurvival")

table = "follow_up_data"
col_list = ["File_number"] + names.name_follow_up()
sql = ('SELECT ' + ", ".join(col_list[:-2]) + " FROM '" + table + "'")
df = pd.read_sql(sql, conn)
df.to_excel(writer, sheet_name=table)

table = "patient_information_history"
col_list_bio = names.names_info("bio_info")

col_list = ["File_number"] + col_list_bio + names.names_info("phys_act") + names.names_info("habits") + \
           names.names_info("nut_supplements") + names.names_info("family_details") + names.names_info("med_history") + \
           names.names_info("cancer_history") + names.names_info("family_cancer") + names.names_info("breast_symptoms")
sql = ('SELECT ' + ", ".join(col_list) + " FROM '" + table + "'")
df = pd.read_sql(sql, conn)
df.to_excel(writer, sheet_name=table)
writer.save()

#######################################33

table = "Biopsy_Report_Data"
module_names = ["biopsy_report_info", "tumour_biopsy_data", "lymphnode_biopsy"]
col_list = ["File_number"]
for index in module_names:
Пример #29
0
db_name = 'PCCM_BreastCancerDB_all_data.db'
path = os.path.join(folder, db_name)
conn_all = sqlite3.connect(path)
cursor_all = conn_all.cursor()
file_number = "file_number"
table = "patient_information_history"
if table_check(cursor_all, table) == 0:
    cursor_all.execute('CREATE TABLE {tn}({nf})'\
                   .format(tn=table, nf=file_number))
    module_names = [
        "bio_info", "phys_act", "habits", "nut_supplements", "family_details",
        "med_history", "cancer_history", "family_cancer", "det_by",
        "breast_symptoms"
    ]
    for index in module_names:
        col_name = pccm_names.names_info(index)
        add_columns(cursor_all, table, col_name)
table = "radiotherapy"
if table_check(cursor_all, table) == 0:
    column = ", ".join(pccm_names.names_radiation())
    cols_file = "file_number, " + column
    cursor_all.execute('CREATE TABLE {tn}({nf})'.format(tn=table,
                                                        nf=cols_file))

table = "follow_up_data"
if table_check(cursor_all, table) == 0:
    column = ", ".join(pccm_names.name_follow_up())
    cols_file = "file_number, " + column
    cursor_all.execute('CREATE TABLE {tn}({nf})'.format(tn=table,
                                                        nf=cols_file))
Пример #30
0
def family_details(conn, cursor, file_number):
    module_name = "family_details"
    check = False
    while not check:
        marital_status = input('Marital Status :')
        siblings = ask_y_n('Siblings')
        if siblings:
            siblings_number = input("Number of siblings: ")
            sisters = input('Sisters :')
            brothers = input('Brothers :')
        else:
            siblings_number, sisters, brothers = "No Siblings", "0", "0"
        children_y_n = ask_y_n('Children')
        if children_y_n:
            children_number = input("Number of children: ")
            daughters = input('Daughters :')
            sons = input('Sons :')
        else:
            children_number, daughters, sons = "No Children", "0", "0"
        menarche = input('Age at menarche (yrs): ')
        category = "Menopausal Status"
        options = [
            "Pre-menopausal", "Peri-menopausal", "Post-Menopausal", "Other"
        ]
        menopause = ask_option(category, options)
        menopause_age = menopause
        if menopause == "Post-Menopausal":
            menopause_age = input('Age at menopause (yrs): ')
            lmp = "Last menstrual period " + menopause_age + " yrs"
            period_type = "NA"
        else:
            lmp = input("Date of last menstrual period: ")
            category = "Type of Period"
            options = ["Regular", "Irregular", "Other"]
            period_type = ask_option(category, options)
        number_pregnancy = input("Number of pregnancies: ")
        if number_pregnancy == "0":
            age_first_preg, age_last_preg, number_term, number_abortion, age_first, age_last, twice_birth, \
            breast_feeding_data, kid_feeding, duration_feeding, breast_usage = ('NA',) * 11
        else:
            number_term = input(
                "Pregnancy carried to term (include abortion after 6 months): "
            )
            number_abortion = input("Number of abortions: ")
            age_first_preg = input("Age at first pregnancy: ")
            sql = (
                'SELECT Age_at_First_Visit_yrs FROM Patient_Information_History WHERE File_number = \''
                + file_number + "'")
            cursor.execute(sql)
            age = cursor.fetchall()
            age_mother = age[0][0]
            if children_number == 'No Children':
                age_first, age_last, twice_birth, breast_feeding_data, kid_feeding, \
                duration_feeding, breast_usage = ('NA',) * 7
            else:
                age_first = input("Age of first child: ")
                if age_first_preg == "NA":
                    age_first_preg = str(int(age_mother) - int(age_first))
                if int(children_number) > 1:
                    age_last = input("Age of last child: ")
                    age_last_preg = input("Age at last pregnancy: ")
                    if age_last_preg == "NA":
                        age_last_preg = str(int(age_mother) - int(age_last))
                    twice_birth = ask_y_n("Two births in a year (not twins)",
                                          "Two births in a year",
                                          "No two births in a year")
                else:
                    age_last = age_first
                    age_last_preg, twice_birth = ("NA", ) * 2
                breast_feeding = ask_y_n("Breast feeding?")
                if breast_feeding:
                    breast_feeding_data = "Breast feeding"
                    feed_details = feed_duration(conn, cursor, file_number,
                                                 children_number)
                else:
                    breast_feeding_data = "No Breast feeding"
                    feed_details = ("NA", ) * 3
                kid_feeding, duration_feeding, breast_usage = feed_details
        fert_treat_y_n = ask_y_n(
            "Have any fertility treatments ever been used")
        if fert_treat_y_n:
            fert_treat = "Fertility Treatment used"
            type_fert = input("Type of fertility treatment used: ")
            detail_fert = input("Details of fertility treatment used:")
            cycles_fert = input(
                "Number of cycles of fertility treatment taken: ")
            success_fert = ask_y_n(
                "Did fertility treatment result in successful pregnancy? ",
                "Pregnancy from Treatment", "No pregnancy from treatment")
        else:
            fert_treat = "No Fertility Treatment used"
            type_fert, detail_fert, cycles_fert, success_fert = ("NA", ) * 4
        type_birth_control = input("Type of birth control used: ")
        if str.lower(type_birth_control) == "na":
            type_birth_control, detail_birth_control, duration_birth_control = (
                "NA", ) * 3
        else:
            detail_birth_control = input("Details of birth control used: ")
            duration_birth_control = input("Duration of birth control use: ")
        data_list = [
            marital_status, siblings_number, sisters, brothers,
            children_number, daughters, sons, menarche, menopause,
            menopause_age, lmp, period_type, number_pregnancy, number_term,
            number_abortion, age_first, age_first_preg, age_last,
            age_last_preg, twice_birth, breast_feeding_data, kid_feeding,
            duration_feeding, breast_usage, fert_treat, type_fert, detail_fert,
            cycles_fert, success_fert, type_birth_control,
            detail_birth_control, duration_birth_control
        ]
        columns_list = pccm_names.names_info(module_name)
        check = review_input(file_number, columns_list, data_list)
    return (tuple(data_list))