Beispiel #1
0
 def add_data(self):
     enter = ask.ask_y_n("Enter Surgery Block information?")
     if enter:
         data = SurgeryBlockData.surgery_block_information_1(self)
         col_list = names(self.module_list[0])
         sql.update_multiple(self.conn, self.cursor, self.table, col_list,
                             self.file_number, data)
     enter = ask.ask_y_n(
         "Enter Surgery Block information (Tumour Details) ?")
     if enter:
         col_list = names(self.module_list[1])
         data, block_data_df = SurgeryBlockData.surgery_block_information_2(
             self)
         sql.update_multiple(self.conn, self.cursor, self.table, col_list,
                             self.file_number, data)
         block_data_df.to_sql("block_data",
                              self.conn,
                              index=False,
                              if_exists="append")
     enter = ask.ask_y_n("Enter Surgery Block information (Node Details)?")
     if enter:
         col_list = names(self.module_list[2])
         data = SurgeryBlockData.surgery_block_information_3(self)
         sql.update_multiple(self.conn, self.cursor, self.table, col_list,
                             self.file_number, data)
     enter = ask.ask_y_n("Enter Pathological Stage?")
     if enter:
         col_list = names(self.module_list[3])
         data = SurgeryBlockData.path_stage(self)
         sql.update_multiple(self.conn, self.cursor, self.table, col_list,
                             self.file_number, data)
Beispiel #2
0
def edit_data(conn, cursor, file_number, user_name):
    table = "Neo_Adjuvant_Therapy"
    enter = review_data(conn, cursor, table, file_number, names(table))
    if enter:
        delete_rows(cursor, 'NACT_Drug_Table', "File_number", file_number)
        delete_rows(cursor, 'NACT_Tox_table', "File_number", file_number)

        data = nact_test(file_number, user_name)
        data_sql, drug_table, tox_response = data

        update_multiple(conn, cursor, table, names(table), file_number,
                        data_sql)
        drug_table.to_sql("NACT_Drug_Table",
                          conn,
                          index=False,
                          if_exists="append")
        tox_response.to_sql("NACT_Tox_table",
                            conn,
                            index=False,
                            if_exists="append")

    print("Clip Information")
    module = "clip_information"
    col_list = names(module)
    enter = review_data(conn, cursor, table, file_number, col_list)
    if enter:
        data = clip_information(file_number)
        update_multiple(conn, cursor, table, col_list, file_number, data)
Beispiel #3
0
def edit_data(conn, cursor, file_number, user_name):
    table = "Surgery_Report"
    print("Surgery Information")
    col_list = names("surgery_information")
    enter = add_update_sql.review_data(conn, cursor, table, file_number,
                                       col_list)
    if enter:
        data = surgery_information(file_number)
        add_update_sql.update_multiple(conn, cursor, table, col_list,
                                       file_number, data)
    print("Node Excision")
    col_list = names("node_excision")
    enter = add_update_sql.review_data(conn, cursor, table, file_number,
                                       col_list)
    if enter:
        data = node_excision(file_number)
        add_update_sql.update_multiple(conn, cursor, table, col_list,
                                       file_number, data)
    print("Post-Surgery management")
    col_list = names("post_surgery")
    enter = add_update_sql.review_data(conn, cursor, table, file_number,
                                       col_list)
    if enter:
        data = post_surgery(file_number, user_name)
        add_update_sql.update_multiple(conn, cursor, table, col_list,
                                       file_number, data)
Beispiel #4
0
def edit_data(conn, cursor, file_number, user_name):
    table = "Radiology"
    print("Mammography")
    col_list = names("mammography")
    enter = add_update_sql.review_data(conn, cursor, table, file_number,
                                       col_list)
    if enter:
        data = mammography(file_number)
        add_update_sql.update_multiple(conn, cursor, table, col_list,
                                       file_number, data)
    print("Automated Breast Volume Scan")
    col_list = names("abvs")
    enter = add_update_sql.review_data(conn, cursor, table, file_number,
                                       col_list)
    if enter:
        data = abvs(file_number)
        add_update_sql.update_multiple(conn, cursor, table, col_list,
                                       file_number, data)
    print("Sono-Mammography")
    col_list = names("sonomammo")
    enter = add_update_sql.review_data(conn, cursor, table, file_number,
                                       col_list)
    if enter:
        data = sonomammo(file_number, user_name)
        add_update_sql.update_multiple(conn, cursor, table, col_list,
                                       file_number, data)
    print("MRI Breast")
    col_list = names("mri_breast")
    enter = add_update_sql.review_data(conn, cursor, table, file_number,
                                       col_list)
    if enter:
        data = mri_breast(file_number, user_name)
        add_update_sql.update_multiple(conn, cursor, table, col_list,
                                       file_number, data)
Beispiel #5
0
 def add_data(self):
     enter = ask.ask_y_n("Enter Biopsy Block Report information?")
     if enter:
         data = BiopsyData.biopsy_report_info(self)
         sql.update_multiple(self.conn, self.cursor, self.table, names("biopsy_report_info"), self.file_number, data)
     enter = ask.ask_y_n("Enter Tumour Biopsy data?")
     if enter:
         data = BiopsyData.tumour_biopsy_data(self)
         sql.update_multiple(self.conn, self.cursor, self.table, names("tumour_biopsy_data"), self.file_number, data)
Beispiel #6
0
def add_data(conn, cursor, file_number, user_name):
    table = "Neo_Adjuvant_Therapy"
    data = nact_test(file_number, user_name)
    data_sql, drug_table, tox_response = data
    update_multiple(conn, cursor, table, names(table), file_number, data_sql)
    drug_table.to_sql("NACT_Drug_Table", conn, index=False, if_exists="append")
    tox_response.to_sql("NACT_Tox_table", conn, index=False, if_exists="append")
    enter = ask_y_n_statement.ask_y_n("Input Clip Information")
    if enter:
        data = clip_information(file_number)
        col_list = names("clip_information")
        update_multiple(conn, cursor, table, col_list, file_number, data)
Beispiel #7
0
 def edit_data(self):
     print("Block Report information")
     col_list = names("biopsy_report_info")
     enter = sql.review_data(self.conn, self.cursor, self.table, self.file_number, col_list)
     if enter:
         data = BiopsyData.biopsy_report_info(self)
         sql.update_multiple(self.conn, self.cursor, self.table, col_list, self.file_number, data)
     print("Tumour Biopsy data")
     col_list = names("tumour_biopsy_data")
     enter = sql.review_data(self.conn, self.cursor, self.table, self.file_number, col_list)
     if enter:
         data = BiopsyData.tumour_biopsy_data(self)
         sql.update_multiple(self.conn, self.cursor, self.table, col_list, self.file_number, data)
Beispiel #8
0
 def surgery_block_information_3(self):
     module_name = self.module_list[2]
     check = False
     while not check:
         surgery_er, surgery_er_percent, surgery_pr, surgery_pr_percent, surgery_her2, surgery_her2_grade, \
         surgery_fish, surgery_ki67, = BlockDescription.ihc_report()
         sentinel, sent_number_rem, sent_number_pos = SurgeryBlockData.node_details(
             "Sentinel")
         ax, ax_number_rem, ax_number_pos = SurgeryBlockData.node_details(
             "Axillary")
         ap, ap_number_rem, ap_number_pos = SurgeryBlockData.node_details(
             "Apical")
         per_spread = ask.ask_y_n_na("Perinodal Spread",
                                     yes_ans='Yes',
                                     no_ans='No',
                                     na_ans='Data not in Report')
         supra_inv = ask.ask_y_n_na("Supraclavicular Node Involvment",
                                    yes_ans='Yes',
                                    no_ans='No',
                                    na_ans='Data not in Report')
         data_list = [
             surgery_er, surgery_er_percent, surgery_pr, surgery_pr_percent,
             surgery_her2, surgery_her2_grade, surgery_fish, surgery_ki67,
             sentinel, sent_number_rem, sent_number_pos, ax, ax_number_rem,
             ax_number_pos, ap, ap_number_rem, ap_number_pos, per_spread,
             supra_inv
         ]
         columns_list = names(module_name)
         check = sql.review_input(self.file_number, columns_list, data_list)
     return (tuple(data_list))
Beispiel #9
0
def edit_data(conn, cursor, file_number, user_name):
    table = "Adjuvant_ChemoTherapy"
    enter = review_data(conn, cursor, table, file_number, names(table))
    if enter:
        delete_rows(cursor, 'Chemo_Drug_Table', "File_number", file_number)
        delete_rows(cursor, 'Chemo_Tox_table', "File_number", file_number)
        data = chemotherapy(file_number, user_name)
        data_sql, drug_table, tox_response = data
        update_multiple(conn, cursor, table, names(table), file_number,
                        data_sql)
        drug_table.to_sql("Chemo_Drug_Table",
                          conn,
                          index=False,
                          if_exists="append")
        tox_response.to_sql("Chemo_Tox_table",
                            conn,
                            index=False,
                            if_exists="append")
Beispiel #10
0
 def biopsy_report_info(self, file_number='test'):
     module_name = "biopsy_report_info"
     df_cols = names('biopsy_report_info_df')
     data_list_df = pd.DataFrame(columns=df_cols)
     check = False
     while not check:
         biopsy_report_pccm = ask.ask_y_n_na("Is the biopsy report available?", yes_ans="Biopsy_report_PCCM_yes",
                                             no_ans="Biopsy_report_PCCM_no", na_ans="Biopsy Not Done")
         ihc_report_pccm = ask.ask_y_n_na("Is the IHC report available?", yes_ans="IHC_report_PCCM_yes",
                                          no_ans="IHC_report_PCCM_no", na_ans="IHC Not Done")
         breast_biopsy = biopsy_report_pccm
         data_list = [biopsy_report_pccm] * 11
         data_list_df.loc[biopsy_report_pccm] = data_list
         if biopsy_report_pccm == 'Biopsy_report_PCCM_yes':
             data_list_df, breast_biopsy = BiopsyData.biopsy_details(self, df_cols)
         data_all = BlockDescription.rb_lb_data(data_list_df, df_cols)
         data_list = [biopsy_report_pccm, ihc_report_pccm, breast_biopsy]+data_all
         columns_list = names(module_name)
         check = sql.review_input(file_number, columns_list, data_list)
     return data_list
Beispiel #11
0
 def edit_data(self):
     print("Surgery Block information")
     col_list = names(self.module_list[0])
     enter = sql.review_data(self.conn, self.cursor, self.table,
                             self.file_number, col_list)
     if enter:
         data = SurgeryBlockData.surgery_block_information_1(self)
         sql.update_multiple(self.conn, self.cursor, self.table, col_list,
                             self.file_number, data)
     print("Surgery Block information (Tumour Details)")
     col_list = names(self.module_list[1])
     enter = sql.review_data(self.conn, self.cursor, self.table,
                             self.file_number, col_list)
     if enter:
         sql.delete_rows(self.cursor, 'block_data', "file_number",
                         self.file_number)
         data, block_data_df = SurgeryBlockData.surgery_block_information_2(
             self)
         sql.update_multiple(self.conn, self.cursor, self.table, col_list,
                             self.file_number, data)
         block_data_df.to_sql("block_data",
                              self.conn,
                              index=False,
                              if_exists="append")
     print("Surgery Block information (Node Details)")
     col_list = names(self.module_list[2])
     enter = sql.review_data(self.conn, self.cursor, self.table,
                             self.file_number, col_list)
     if enter:
         data = SurgeryBlockData.surgery_block_information_3(self)
         sql.update_multiple(self.conn, self.cursor, self.table, col_list,
                             self.file_number, data)
     print("Pathological Stage")
     col_list = names(self.module_list[3])
     enter = sql.review_data(self.conn, self.cursor, self.table,
                             self.file_number, col_list)
     if enter:
         data = SurgeryBlockData.path_stage(self)
         sql.update_multiple(self.conn, self.cursor, self.table, col_list,
                             self.file_number, data)
Beispiel #12
0
def add_data(conn, cursor, file_number, user_name):
    table = "Radiology"
    enter = ask_y_n("Enter Mammography Report?")
    if enter:
        data = mammography(file_number)
        add_update_sql.update_multiple(conn, cursor, table,
                                       names("mammography"), file_number, data)
    enter = ask_y_n("Enter Automated Breast Volume Scanner")
    if enter:
        data = abvs(file_number)
        add_update_sql.update_multiple(conn, cursor, table, names("abvs"),
                                       file_number, data)
    enter = ask_y_n("Enter Sono-Mammography")
    if enter:
        data = sonomammo(file_number, user_name)
        add_update_sql.update_multiple(conn, cursor, table, names("sonomammo"),
                                       file_number, data)
    enter = ask_y_n("Enter MRI-Breast")
    if enter:
        data = mri_breast(file_number, user_name)
        add_update_sql.update_multiple(conn, cursor, table,
                                       names("mri_breast"), file_number, data)
Beispiel #13
0
def add_data(conn, cursor, file_number, user_name):
    table = "Adjuvant_ChemoTherapy"
    data = chemotherapy(file_number, user_name)
    data_sql, drug_table, tox_response = data
    update_multiple(conn, cursor, table, names(table), file_number, data_sql)
    drug_table.to_sql("Chemo_Drug_Table",
                      conn,
                      index=False,
                      if_exists="append")
    tox_response.to_sql("Chemo_Tox_table",
                        conn,
                        index=False,
                        if_exists="append")
Beispiel #14
0
 def tumour_biopsy_data(self):
     module_name = "tumour_biopsy_data"
     columns_list = names(module_name)
     df_cols = columns_list[:-2]
     data_list_df = pd.DataFrame(columns=df_cols)
     try:
         ihc_biopsy = sql.get_value(col_name='IHC_report_PCCM_yes_no', table=self.table,
                                    file_number=self.file_number, cursor=self.cursor)
     except sqlite3.Error:
         ihc_biopsy = ask.ask_y_n_na("Is the IHC report available?", yes_ans="IHC_report_PCCM_yes",
                                     no_ans="IHC_report_PCCM_no", na_ans="IHC Not Done")
     check = False
     while not check:
         try:
             breast_biopsy = sql.get_value(col_name='Breast_Biopsy', table=self.table,
                                           file_number=self.file_number, cursor=self.cursor)
         except sqlite3.Error:
             breast_biopsy = ask.ask_option('Breast that biopsy has been done for',
                                            ['Right Breast', 'Left Breast', 'Unilateral', "Bilateral"])
         breasts = BlockDescription.breast_list(breast_biopsy)
         for breast in breasts:
             check_breast = False
             while not check_breast:
                 print('Please input all data for ' + breast + ' block only')
                 tumour_er, tumour_er_percent, tumour_pr, tumour_pr_percent, tumour_her2, tumour_her2_grade, \
                 tumour_fish, tumour_ki67 = (ihc_biopsy, )* 8
                 if ihc_biopsy == 'IHC_report_PCCM_yes':
                     ihc_data = BlockDescription.ihc_report()
                     tumour_er, tumour_er_percent, tumour_pr, tumour_pr_percent, tumour_her2, tumour_her2_grade, \
                     tumour_fish, tumour_ki67 = ihc_data
                 fnac = ask.ask_y_n_na(question=("Lymph Node biopsy FNAC for " + breast),
                                       yes_ans="Lymph_Node_biopsy_FNAC_yes",
                                       no_ans="Lymph_Node_biopsy_FNAC_no", na_ans="Data not in report")
                 fnac_location, fnac_diagnosis = (fnac,) * 2
                 if fnac == "Lymph_Node_biopsy_FNAC_yes":
                     fnac_location = input("Please enter lymph node biopsy location: ")
                     fnac_diagnosis = ask.ask_option("Lymph Node biopsy diagnosis",
                                                     ["Lymph_Node_biopsy_malignant",
                                                      "Lymph_Node_biopsy_non_malignant",
                                                      "Data not in report"])
                 df_data = [tumour_er, tumour_er_percent, tumour_pr, tumour_pr_percent, tumour_her2,
                                    tumour_her2_grade, tumour_fish, tumour_ki67, fnac, fnac_location, fnac_diagnosis]
                 print('Data entered for ' + breast + 'is as follows:\n')
                 check_breast = sql.review_input(self.file_number, df_cols, df_data)
                 data_list_df.loc[breast] = df_data
             data_list = BlockDescription.rb_lb_data(data_list_df, df_cols)
         check = sql.review_input(self.file_number, columns_list, data_list)
     last_update = datetime.now().strftime("%Y-%b-%d %H:%M")
     data_list = data_list+[last_update]+[self.user_name]
     return data_list
Beispiel #15
0
def clip_information(file_number):
    check = False
    while not check:
        clip = ask_y_n_statement.ask_y_n("Was Clip inserted for surgery?")
        if clip:
            clip_number = input("Number of clips inserted: ")
            clip_date = ask_y_n_statement.check_date("Date of clip insertion: ")
            clip_cycle = input("Clip inserted after cycle? ")
        else:
            clip_date, clip_number, clip_cycle = ("NA", )*3
        data_list = clip_number, clip_date, clip_cycle
        col_list = names("clip_information")
        check = review_input(file_number, col_list, data_list)
    return data_list
Beispiel #16
0
def add_data(conn, cursor, file_number, user_name):
    table = "Surgery_Report"
    #file_row(cursor, file_number)
    enter = ask_y_n("Do you want to enter Surgery Information?")
    if enter:
        data = surgery_information(file_number)
        add_update_sql.update_multiple(conn, cursor, table,
                                       names("surgery_information"),
                                       file_number, data)
    enter = ask_y_n("Do you want to enter dnter Node Excision Information?")
    if enter:
        data = node_excision(file_number)
        add_update_sql.update_multiple(conn, cursor, table,
                                       names("node_excision"), file_number,
                                       data)
    enter = ask_y_n(
        "Do you want to enter details of Post-Surgery management (plans and complications)?"
    )
    if enter:
        data = post_surgery(file_number, user_name)
        add_update_sql.update_multiple(conn, cursor, table,
                                       names("post_surgery"), file_number,
                                       data)
Beispiel #17
0
 def block_description_for_db(self, block_desc_df):
     block_type_list = names('block_type_list')
     block_data_all = []
     for type in block_type_list:
         query_type = 'block_type == ' + '"' + type + '"'
         id_desc = block_desc_df.query(query_type)
         if list(id_desc.shape)[0] == 0:
             block_data_type = ['Not Removed']
             block_data_all.append(block_data_type)
         else:
             block_data_type = []
             id = list(id_desc['block_reference'])
             desc = list(id_desc['block_description'])
             for index in range(list(id_desc.shape)[0]):
                 data = id[index] + ": " + desc[index]
                 block_data_type.append(data)
             block_data_type = ["; ".join(block_data_type)]
             block_data_all.append(block_data_type)
     return block_data_all
Beispiel #18
0
 def block_description(self):
     block_type_list = names('block_type_list')
     block_desc_df = pd.DataFrame(columns=self.block_desc_df_cols)
     if int(self.block_no) == 0:
         block_desc_df.loc[self.block_no] = [
             'No blocks available', 'NA', 'NA'
         ]
     else:
         block_id_list = BlockDescription.create_block_id(self)
         for id in range(0, len(block_id_list)):
             print("For Block ID " + self.block_id + ', Block reference: ' +
                   block_id_list[id])
             block_type = ask.ask_option("Block type", block_type_list)
             block_desc = input("Block Description for block " +
                                block_id_list[id] + ": ")
             block_desc_df.loc[id] = [
                 self.file_number, self.block_id, block_id_list[id],
                 block_type, block_desc
             ]
         print(block_desc_df)
         check = ask.ask_y_n("Are block descriptions correct?")
         if not check:
             to_correct = ask.ask_y_n("Correct all entries?")
             if not to_correct:
                 to_do = True
                 while to_do:
                     id = input("Enter block id to change: ")
                     index = block_id_list.index(id)
                     print(block_desc_df.loc[index, :])
                     col_change = ask.ask_option("Name of column to change",
                                                 self.block_desc_df_cols)
                     new_val = input("Enter correct value for " +
                                     col_change + ' for ' + id)
                     block_desc_df.loc[index, col_change] = new_val
                     print(block_desc_df)
                     to_do = ask.ask_y_n("Make more changes?")
     block_data_all = BlockDescription.block_description_for_db(
         self, block_desc_df)
     return block_desc_df, block_data_all
Beispiel #19
0
def abvs(file_number):
    module_name = "abvs"
    check = False
    while not check:
        abvs = ask_y_n_statement.ask_y_n(
            "Automated Breast Volume Scanner (ABVS) done?")
        if abvs:
            abvs = "Automated Breast Volume Scanner done"
            abvs_date = ask_y_n_statement.check_date(
                "Date of examination of ABVS: ")
            abvs_acc = input("Accession number of ABVS: ")
            abvs_lesion = ask_y_n_statement.ask_option(
                "Location of lesion",
                ["Right Breast", "Left Breast", "Both", "Not present"])
            if abvs_lesion in {"Right Breast", "Left Breast", "Both"}:
                abvs_lesion_data = radio_tables.lesion_location(abvs_lesion)
            else:
                abvs_lesion_data = "NA"
            abvs_size = ask_y_n_statement.ask_option(
                "Size of lesion", ["<2 cm", "2-5 cm", ">5 cm", "Other"])
            abvs_dist = ask_y_n_statement.ask_option(
                "Distance from Skin (cm)", ["<0.5 cm", ">0.5 cm", "Other"])
            abvs_pect = input("Distance from Pectoralis Major (cm): ")
            abvs_diagnosis = ask_y_n_statement.ask_option(
                "ABVS Diagnosis",
                ["Normal", "Benign", "Suspicious", "Diagnostic for Cancer"])
        else:
            abvs = "Automated Breast Volume Scanner not done"
            abvs_date, abvs_acc, abvs_lesion, abvs_lesion_data, abvs_size, abvs_dist, abvs_pect, \
            abvs_diagnosis = ("NA",) * 8

        data_list = [
            abvs, abvs_date, abvs_acc, abvs_lesion, abvs_lesion_data,
            abvs_size, abvs_dist, abvs_pect, abvs_diagnosis
        ]
        columns_list = names(module_name)
        check = add_update_sql.review_input(file_number, columns_list,
                                            data_list)
    return tuple(data_list)
Beispiel #20
0
 def path_stage(self):
     module_name = self.module_list[3]
     check = False
     while not check:
         category = "pT"
         options = ["is", "0", "1", "2", "3", "4", "Other"]
         pt = ask.ask_option(category, options)
         category = "pN"
         options = ["0", "1", "2", "3", "4", "Other"]
         pn = ask.ask_option(category, options)
         category = ("M")
         options = ["0", "1", "Other"]
         m = ask.ask_option(category, options)
         path_stage, clinical_stage = BlockDescription.stage(pt, pn, m)
         last_update = datetime.now().strftime("%Y-%b-%d %H:%M")
         data_list = [
             pt, pn, m, path_stage, clinical_stage, self.user_name,
             last_update
         ]
         columns_list = names(module_name)
         check = sql.review_input(self.file_number, columns_list, data_list)
     return (tuple(data_list))
Beispiel #21
0
 def surgery_block_information_2(self):
     module_name = self.module_list[1]
     check = False
     while not check:
         no_blocks = sql.get_value(
             col_name='Number_Blocks_Surgery_Block',
             table=self.table,
             file_number=self.file_number,
             cursor=self.cursor,
             error_statement=
             "Please input number of blocks (if block information is not available "
             "please enter 0: ")
         block_id = sql.get_value(col_name='Block_ID_Surgery_Block',
                                  table=self.table,
                                  file_number=self.file_number,
                                  cursor=self.cursor,
                                  error_statement="Please input block id: ")
         blocks = BlockDescription(self.file_number, block_id, no_blocks)
         block_desc_df, block_data_all = blocks.block_description()
         breast_cancer_yes_no = sql.get_value(
             col_name='Breast_Cancer_Yes_No_Surgery_Block',
             table=self.table,
             file_number=self.file_number,
             cursor=self.cursor,
             error_statement=
             'Is this a case of breast cancer if yes answer if yes '
             'answer breast cancer_yes and if no answer '
             'breast cancer_no')
         tumour_size, tumour_unit, tumour_grade, surg_diag, dcis_yes_no, dcis_type, dcis_percent, tumour_invasion, \
         per_inv, necrosis, percent_vasc_invasion, percent_lymph_invasion, percent_stroma, margin, margin_id, \
         margin_type = (breast_cancer_yes_no, )*16
         if breast_cancer_yes_no == 'breast cancer_yes':
             tumour_size = input(
                 "Tumour size (please input dimension only, e.g, 1 x 3 x 4): "
             )
             tumour_unit = ask.ask_option("Tumour size unit", ['mm', 'cm'])
             tumour_grade = ask.ask_option("Tumour Grade",
                                           ["I", "II", "III"])
             surg_diag = ask.ask_option("Surgery Diagnosis",
                                        names('diagnosis'))
             dcis_yes_no = ask.ask_y_n_na('Is DCIS present',
                                          yes_ans='dcis_yes',
                                          no_ans='dcis_no',
                                          na_ans='Data not in Report')
             dcis_type, dcis_percent = (dcis_yes_no, ) * 2
             if dcis_yes_no == 'dcis_yes':
                 dcis_type = input(
                     'Enter type of DCIS if textual description given (else enter NA): '
                 )
                 dcis_percent = input("Percent DCIS (number only): ")
             tumour_invasion = ask.ask_option(
                 "Type of Tumour Invasion",
                 ['Microinvasion', 'Macroinvasion'])
             per_inv = ask.ask_y_n_na(question="Perineural Invasion",
                                      yes_ans='perineural_invasion_yes',
                                      no_ans='perineural_invasion_no',
                                      na_ans='Data not in Report')
             necrosis = ask.ask_y_n_na("Necrosis",
                                       yes_ans='necrosis_yes',
                                       no_ans='necrosis_no',
                                       na_ans='Data not in Report')
             percent_vasc_invasion = input(
                 "Percent Vascular Invasion "
                 "Enter number only; Enter 'Data not in report' if not available: "
             )
             percent_lymph_invasion = input(
                 "Percent Lymphocyte Invasion "
                 "Enter number only; Enter 'Data not in report' if not available: "
             )
             percent_stroma = input(
                 "Percent Stroma "
                 "Enter number only; Enter 'Data not in report' if not available: "
             )
             margin = ask.ask_option("Margins", [
                 "Surgery_Block_Margins_involved",
                 "Surgery_Block_Margins_free"
             ])
             margin_id, margin_type = ('NA', ) * 2
             if margin == 'Surgery_Block_Margins_involved':
                 margin_id = input('Margin that is involved: ')
                 margin_type = input('Margin type: ')
         tumour_block_ref, node_block_ref, ad_normal_block_ref, red_tissue_block_ref \
             = ask.join_lists(block_data_all, sep="; ")
         data_list = [
             tumour_block_ref, node_block_ref, ad_normal_block_ref,
             red_tissue_block_ref, tumour_size, tumour_unit, tumour_grade,
             surg_diag, dcis_yes_no, dcis_type, dcis_percent,
             tumour_invasion, per_inv, necrosis, percent_vasc_invasion,
             percent_lymph_invasion, percent_stroma, margin, margin_id,
             margin_type
         ]
         columns_list = names(module_name)
         check = sql.review_input(self.file_number, columns_list, data_list)
     return (tuple(data_list), block_desc_df)
Beispiel #22
0
def surgery_information(file_number):
    check = False
    while not check:
        surgery_date,surgery_hospital,surgery_patient_hospital_id,surgery_date_admission, surgery_hospital_ward, \
        surgery_name_anaesthetist, surgery_name_surgeon, surgery_lesion_location, surgery_type, surgery_incision, \
        surgery_type_subtype, surgery_type_level_subtype, oncoplastic_surgery_type, oncoplastic_surgery_flap, \
        oncoplastic_surgery_plan, oncoplastic_surgery_tumour_filled_by, oncoplastic_surgery_nac_graft, \
        oncoplastic_surgery_primary_pedicle, oncoplastic_surgery_secondary_pedicle, reconstruction_surgery_implant_type,\
        reconstruction_surgery_implant_size, contralateral_surgery, contralateral_surgery_type, \
        contralateral_surgery_type_details, surgery_notes = (" ", )*25
        surgery_date = input("Date of surgery: ")
        surgery_hospital = ask_option("Name of hospital", [
            'Ruby Hall Clinic', 'RHC Wanowarie', 'Jehangir Hospital',
            'Oyster and Pearl', 'Inamdar Hospital'
        ])
        surgery_patient_hospital_id = input("Patient ID at the hospital: ")
        surgery_hospital_ward = input("Name of hospital ward: ")
        surgery_date_admission = input("Date of admission: ")
        surgery_name_anaesthetist = ask_option("Name of Anaesthetist", [
            "Dr.Sachin Arbhi", "Dr. Sandhya Sathe", 'Dr. Sagar Sanjay',
            'Dr. Amol Ramekar', "Dr. Nita D'Souza"
        ])
        surgery_name_surgeon = ask_option("Name of the Surgeon/s",
                                          ["Dr. C. B. Koppiker"])
        lesion = ask_option("Location of lesion", [
            "Right Breast", "Left Breast", "Both Breasts", "Other", "Not known"
        ])
        if lesion in {"Right Breast", "Left Breast", "Both Breasts"}:
            surgery_lesion_location = lesion_location(lesion)
        else:
            surgery_lesion_location = 'Requires specialist Input'
        surgery_type = ask_option("Types of Surgery", [
            "Conservative Breast Surgery", "Implant Based Reconstruction",
            'Requires Specialist Input'
        ])
        if surgery_type == "Conservative Breast Surgery":
            surgery_incision = ask_option(
                "Type of Incisions",
                surgery_tables.incision("conservative_incision"))
            if surgery_incision == "Circum-areolar":
                incisions_type = ask_option(
                    "Circum-areolar incision is",
                    ["at areolar margin", 'Away from margin', 'Other'])
                surgery_incision = surgery_incision + " " + incisions_type
            surgery_type_subtype = ask_option(
                "Type of Breast Conservation Surgery",
                ['Conventional Surgery', 'Oncoplastic Surgery', 'Other'])
            if surgery_type_subtype == "Conventional Surgery":
                surgery_type_level_subtype = ask_option(
                    "type of conventional surgery",
                    ["Lumpectomy", "Quadrantectomy", "Wedge Resection"])
                oncoplastic_surgery_type, oncoplastic_surgery_flap, oncoplastic_surgery_plan, \
                oncoplastic_surgery_tumour_filled_by,oncoplastic_surgery_nac_graft, oncoplastic_surgery_primary_pedicle, \
                oncoplastic_surgery_secondary_pedicle, reconstruction_surgery_implant_type, \
                reconstruction_surgery_implant_size = ("Not applicable for Conventional Breast Conservation", )*9
            elif surgery_type_subtype == "Oncoplastic Surgery":
                surgery_type_level_subtype = ask_option(
                    "Level of oncoplastic surgery", [
                        "Level 1", "Level 2: Therapeutic Mammoplasty",
                        'Level 3: Volume Replacement'
                    ])
                if surgery_type_level_subtype == "Level 1":
                    oncoplastic_surgery_type = ask_option(
                        "Type of level 1 oncoplastic surgery", [
                            "Type 1: Simple oncoplastic – mammoplasty",
                            "Type 2: Volume Displacement"
                        ])
                    if oncoplastic_surgery_type == "Type 2: Volume Displacment":
                        oncoplastic_surgery_flap = ask_option(
                            "Type of flap used", [
                                "Grisotti Flap", "Round Block",
                                "Batwing Procedure"
                            ])
                        oncoplastic_surgery_plan, oncoplastic_surgery_tumour_filled_by, oncoplastic_surgery_nac_graft, \
                        oncoplastic_surgery_primary_pedicle, oncoplastic_surgery_secondary_pedicle, \
                        reconstruction_surgery_implant_type, reconstruction_surgery_implant_size, \
                        surgery_type_level_subtype = ("Not applicabel for Level 1: Type 2 Oncolplastic Surgery with " \
                                                      "volume displacement",)* 8
                    elif oncoplastic_surgery_type == 'Type 1: Simple oncoplastic – mammoplasty':
                        oncoplastic_surgery_flap = "No flap for Simple oncoplastic – mammoplasty"
                        oncoplastic_surgery_plan, oncoplastic_surgery_tumour_filled_by, oncoplastic_surgery_nac_graft, \
                        oncoplastic_surgery_primary_pedicle, oncoplastic_surgery_secondary_pedicle, \
                        reconstruction_surgery_implant_type, reconstruction_surgery_implant_size, \
                        surgery_type_level_subtype = ("Not applicabel for Level 1: Type 1 Simple oncoplastic – "
                                                      "mammoplasty",) * 8
                elif surgery_type_level_subtype == "Level 2: Therapeutic Mammoplasty":
                    oncoplastic_surgery_type = ask_option(
                        "Subtypes of Level 2 oncoplastic surgery, Therapeutic Mammoplastty",
                        [
                            "Simple Therapeutic", "Complex Therapeutic",
                            "Extreme Therapeutic"
                        ])
                    oncoplastic_surgery_flap = "Therapeutic Mammoplasty"
                    if oncoplastic_surgery_type in {"Simple Therapeutic"}:
                        oncoplastic_surgery_plan = ask_option(
                            "Type of Plan used",
                            ["Wise pattern", "Vertical Scar"])
                        oncoplastic_surgery_tumour_filled_by = oncoplastic_surgery_type
                        oncoplastic_surgery_nac_graft = "No NAC Graft, " + oncoplastic_surgery_type
                        oncoplastic_surgery_primary_pedicle = ask_option(
                            "Type of pedicle used",
                            surgery_tables.pedicle("primary"))
                        oncoplastic_surgery_secondary_pedicle = "No secondary pedicle, " + oncoplastic_surgery_type
                    if oncoplastic_surgery_type in {
                            "Complex Therapeutic", "Extreme Therapeutic"
                    }:
                        oncoplastic_surgery_tumour_filled_by = ask_option(
                            "Tumour filled by",
                            ["Extended Primary Pedicle", "Secondary Pedicle"])
                        oncoplastic_surgery_plan = ask_option(
                            "Type of Plan used",
                            ["Wise pattern", "Vertical Scar"])
                        oncoplastic_surgery_nac_graft = ask_option_y_n(
                            "Is NAC graft done?")
                        if not oncoplastic_surgery_nac_graft:
                            oncoplastic_surgery_nac_graft = "Nipple areola complex is not grafted "
                            oncoplastic_surgery_primary_pedicle = ask_option(
                                "What is Nipple On (primary pedicle) pedicle used?",
                                surgery_tables.pedicle("primary"))

                            oncoplastic_surgery_secondary_pedicle = ask_option(
                                "What is the secondary pedicle used?",
                                surgery_tables.pedicle("secondary"))
                        else:
                            oncoplastic_surgery_nac_graft = "Nipple areola complex is grafted"
                            oncoplastic_surgery_primary_pedicle = oncoplastic_surgery_nac_graft
                            oncoplastic_surgery_secondary_pedicle = ask_option(
                                "What is the pedicle used?",
                                surgery_tables.pedicle("secondary"))
                        reconstruction_surgery_implant_type, reconstruction_surgery_implant_size = \
                            (oncoplastic_surgery_plan, )*2
                elif surgery_type_level_subtype == "Level 3: Volume Replacement":
                    oncoplastic_surgery_flap = ask_option(
                        "Type of flap used",
                        ["Local Flaps", "LD Flaps", "Mini LD"])
                    if oncoplastic_surgery_flap == "Local Flaps":
                        flap_type = ask_option(
                            "type of flap",
                            ["Thoraco-epigastric Flap", "LICAP", "TDAP"])
                        oncoplastic_surgery_flap = "Local " + flap_type
                        oncoplastic_surgery_plan, oncoplastic_surgery_tumour_filled_by, oncoplastic_surgery_nac_graft, \
                        oncoplastic_surgery_primary_pedicle, oncoplastic_surgery_secondary_pedicle = \
                            ("Not applicable for volume replacment oncoplasty", )*5
            else:
                other = surgery_type_subtype
                oncoplastic_surgery_type, oncoplastic_surgery_flap, oncoplastic_surgery_plan, \
                oncoplastic_surgery_tumour_filled_by, oncoplastic_surgery_nac_graft, oncoplastic_surgery_primary_pedicle, \
                oncoplastic_surgery_secondary_pedicle, reconstruction_surgery_implant_type, \
                reconstruction_surgery_implant_size, surgery_type_level_subtype = (other,) * 10
        elif surgery_type == "Implant Based Reconstruction":
            surgery_type_subtype = ask_option("Type of surgery", [
                'Non Sling – Conventional IBRS', 'Sling ALDS',
                'Advanced Sling (AALDS)', 'LD Flap', 'LD Flap + Implant',
                'TDAP + Implant', 'LICAP + Implant', 'Implant'
            ])
            reconstruction_surgery_implant_type = ask_option(
                "Type of implant used", ["Fixed Volume", "Dual Lumen"])
            if reconstruction_surgery_implant_type == "Fixed Volume":
                fixed_type = ask_option(
                    "Type of fixed volume implant",
                    ["Smooth", "Textured", "Microtextured"])
                reconstruction_surgery_implant_type = reconstruction_surgery_implant_type + " " + fixed_type
            reconstruction_surgery_implant_size = input(
                "Size of implant used: ")
            surgery_incision = ask_option(
                "Type of incision used",
                surgery_tables.incision("reconstruction"
                                        "_incision"))
            surgery_type_level_subtype, oncoplastic_surgery_type, oncoplastic_surgery_flap, \
            oncoplastic_surgery_plan,oncoplastic_surgery_tumour_filled_by,oncoplastic_surgery_nac_graft,\
            oncoplastic_surgery_primary_pedicle,oncoplastic_surgery_secondary_pedicle = \
                ("Not applicable for reconstruction surgery", )*8
        else:
            surgery_incision,surgery_type_subtype,surgery_type_level_subtype,oncoplastic_surgery_type,\
            oncoplastic_surgery_flap,oncoplastic_surgery_plan,oncoplastic_surgery_tumour_filled_by,\
            oncoplastic_surgery_nac_graft,oncoplastic_surgery_primary_pedicle,oncoplastic_surgery_secondary_pedicle,\
            reconstruction_surgery_implant_type,reconstruction_surgery_implant_size = (surgery_type, ) *12
        contralateral_surgery = ask_option(
            "Was Contralateral Surgery done?",
            ["Yes", "No", "Requires Specialist Input"])
        if contralateral_surgery == "Yes":
            contralateral_surgery_type = ask_option(
                "Type of Contralateral Surgery Done", [
                    "Symmetrisation",
                    "Prophylactic Masstectomy with Reconstruction", "Other"
                ])
            if contralateral_surgery_type == "Symmetrisation":
                contralateral_surgery_type_details = ask_option(
                    "Type of Symmetrisation",
                    ["Same as other side", "Different from other side"])
                if contralateral_surgery_type_details == "Different from other side":
                    contralateral_surgery_type_details = input(
                        "Please give details of symmetrisation: ")
            else:
                contralateral_surgery_type_details = input(
                    "Please give details of " + contralateral_surgery_type)
            contralateral_surgery = "Contralateral Surgery Performed"
        elif contralateral_surgery == "No":
            contralateral_surgery, contralateral_surgery_type, contralateral_surgery_type_details = \
                ("Contralateral Surgery Not Performed", )*3
        elif contralateral_surgery == "Requires Specialist Input":
            contralateral_surgery_type, contralateral_surgery_type_details = (
                'Requires Specialist Input', ) * 2
        surgery_notes = input(
            "Additional Surgery Notes and comments (if available): ")
        data_list = [
            surgery_date, surgery_hospital, surgery_patient_hospital_id,
            surgery_date_admission, surgery_hospital_ward,
            surgery_name_anaesthetist, surgery_name_surgeon,
            surgery_lesion_location, surgery_type, surgery_incision,
            surgery_type_subtype, surgery_type_level_subtype,
            oncoplastic_surgery_type, oncoplastic_surgery_flap,
            oncoplastic_surgery_plan, oncoplastic_surgery_tumour_filled_by,
            oncoplastic_surgery_nac_graft, oncoplastic_surgery_primary_pedicle,
            oncoplastic_surgery_secondary_pedicle,
            reconstruction_surgery_implant_type,
            reconstruction_surgery_implant_size, contralateral_surgery,
            contralateral_surgery_type, contralateral_surgery_type_details,
            surgery_notes
        ]
        col_list = names('surgery_information')
        check = add_update_sql.review_input(file_number, col_list, data_list)
    return data_list
Beispiel #23
0
def nact_regime(file_number, user_name):
    col_drug = names("NACT_Drug_per_week")
    drug_per_week = pd.DataFrame(columns=col_drug)
    col_cycle_all = names("NACT_Drug_Cycle")
    data_per_cycle = pd.DataFrame(columns=col_cycle_all)
    col_drug_response = names("NACT_Toxicity")
    tox_response_all = pd.DataFrame(columns=col_drug_response)
    check = False
    while not check:
        nact = ask_y_n_statement.ask_y_n("Has neo adjuvant therapy been done for the patient?")
        if nact:
            nact = "Neo Adjuvant therapy given"
            place_nact = ask_y_n_statement.ask_y_n_na("Has Chemotherapy been done at PCCM?", "At PCCM", "Outside",
                                                       "Not Certain, requires follow-up")
            details_nact = ask_y_n_statement.ask_y_n("Are Chemotherapy details available?", "Details Available",
                                                      "Details to be taken from patient")
            if details_nact == "Details Available":
                date_nact = input("Date of starting neo-adjuvant therapy: ")
                plan_nact = input("Type of NACT plan: ")
                cycle_number, week_number = (1,)*2
                week_end, cycle_index, week_index, drug_index  = (0,)*4
                add_cycle = True
                while add_cycle:
                    check_cycle = False
                    while not check_cycle:
                        cyc_name = "Cycle " + str(cycle_number)
                        print(cyc_name)
                        week_add = True
                        while week_add:
                            check_drug_tox = False
                            while not check_drug_tox:
                                week = "Week " + str(week_number)
                                print(week)
                                week_check = ask_y_n_statement.ask_y_n("Is week correct?")
                                if not week_check:
                                    week_number = input("Week number? ")
                                    week_number = int(week_number)
                                    week = "Week " + str(week_number)
                                patient_wt = input("Patient weight (in kg): ")
                                drug_per_week, drug_cyc = drug_add(file_number, cyc_name, cycle_number, week, patient_wt, drug_per_week, drug_index)
                                tox_response = chemo.tox_table(file_number, cyc_name, week, drug_cyc)
                                tox_grade, tox, tox_treatment, tox_response = tox_response
                                change_tox = ask_y_n_statement.ask_option("Changes to NACT treatment due to toxicity",
                                                                    ["No change", "NACT regime changed", "NACT stopped"])
                                if change_tox =="NACT regime changed":
                                    change = input("Please describe changes to NACT regime: ")
                                    change_tox = change_tox+": "+change
                                data_tox_response = [file_number, cycle_number, week, "/".join(drug_cyc), tox, tox_grade, tox_treatment,
                                                     tox_response, change_tox]
                                tox_response_all.loc[week_index] = data_tox_response
                                check_drug_tox = review_df(tox_response_all.loc[week_index])
                                week_number = week_number + 1
                                week_index = week_index + 1
                            week_add = ask_y_n_statement.ask_y_n("Add another week to " + cyc_name + " ?")
                        patient_wt_end_cycle = patient_wt
                        drug_cycle = drug_per_week.query('Cycle_number==' + str(cycle_number))
                        tox_cycle = tox_response_all.query('Cycle_number==' + str(cycle_number))
                        data_cycle, drug_dose = chemo.get_cycle_data(drug_cycle, tox_cycle)
                        drug_week, tox_week, tox_grade_week, tox_treatment_week, tox_response_week, change_tox_week \
                            = data_cycle
                        response_check = ask_y_n_statement.ask_option("Method used to check response to NACT in this cycle",
                                                                      ["Response not checked", "Other"])
                        if response_check != "Response not checked":
                            response_nact = ask_y_n_statement.ask_option("Tumour response to NACT treatment",
                            response_nact = ask_y_n_statement.ask_option("Tumour response to NACT treatment",
                                                                         ["Partial", "Complete", "Progressing", "Static",
                                                                          "Other"])
                            response_size = input("Tumour Size as assessed by " + response_check+" (cm): ")
                            date = input("Date of tumour size assessment: ")
                        else:
                            response_nact, response_size, date  = ("NA", )*3
                        week_end = week_number - week_end -1
                        weeks = str(week_end)+" Weeks"
                        data_cycle_all = [file_number, cyc_name, weeks, patient_wt_end_cycle, drug_week, tox_week, tox_grade_week,
                                          tox_treatment_week, tox_response_week, change_tox_week, drug_dose, response_check,
                                          response_nact, response_size, date]
                        data_per_cycle.loc[cycle_index] = data_cycle_all
                        check_cycle = review_df(data_per_cycle.loc[cycle_index])
                        cycle_number = cycle_number + 1
                        cycle_index = cycle_index + 1
                    add_cycle = ask_y_n_statement.ask_y_n("Add another cycle? ")
                trast_nact = ask_y_n_statement.ask_y_n("Trastuzumab used?")
                if trast_nact:
                    trast_regime = ask_y_n_statement.ask_option("Trastuzumab use was", ["Sequential", "Concurrent"])
                    trast_nact = "Trastuzumab used"
                    trast_courses = input("Number of courses of trastuzumab/herceptin taken: ")
                else:
                    trast_nact = "Trastuzumab not used"
                    trast_regime, trast_courses = ("NA",)*2

                date_complete = input("Date of completion of NACT")
                complete_nact = ask_y_n_statement.ask_y_n("Was NACT completed as per schedule?")
                if complete_nact:
                    reason_incomplete = "NACT completed as per schedule"
                else:
                    reason_incomplete = ask_y_n_statement.ask_option("Reason for discontinuation", ["Toxicity",
                    "Reluctance of patient", "Progression on chemotherapy", "Advised by treating doctor",
                    "Death due to toxicity", "Death due to progressive disease", "Preferred treatment at another centre",
                    "Death due to unrelated cause", "Patient was unable to afford treatment"])
                    reason_incomplete = "NACT incomplete: "+reason_incomplete
                number_cycles = data_per_cycle.shape[0]
                number_weeks = week_number -1
                drug_dose = []
                drug_dose_unit_df = drug_per_week.loc[:,("Drugs", "Dose_unit")].drop_duplicates()
                for index in range(1, 2):
                    dose_ = drug_per_week.loc[:, ("Drugs", "Dose")]
                    dose_sum_cycle = dose_.groupby("Drugs").sum()
                for index in range(0, len(list(dose_sum_cycle.index))):
                    dose_unit_ = list(drug_dose_unit_df.loc[:, "Dose_unit"])[index]
                    data = list(dose_sum_cycle.index)[index] + ": " + str(
                        list(dose_sum_cycle.loc[:, "Dose"])[index]) + " " + dose_unit_
                    drug_dose.append(data)
                drug_admin = "; ".join(drug_dose)
                hormone_therapy = ask_y_n_statement.ask_y_n("Was hormone therapy given?")
                if hormone_therapy:
                    hormone_therapy = "Hormone therapy given"
                    therapy_type = ask_y_n_statement.ask_option("Hormone therapy type", ["Sequential", "Concurrent"])
                    therapy_duration = input("What was the duration of therapy? ")
                    therapy_side = ask_y_n_statement.ask_y_n("Were any side effects observed ?")
                    if therapy_side:
                        therapy_side = input("Please give details of side effects observed: ")
                    else:
                        therapy_side = "NA"
                else:
                    hormone_therapy = "No hormone therapy given"
                    therapy_type, therapy_duration, therapy_side = ("NA", )*3
            else:
                date_nact, plan_nact, drug_admin, number_weeks, number_cycles, response_check, response_nact, response_size, \
                date, reason_incomplete, date_complete, trast_nact, trast_regime, trast_courses, \
                hormone_therapy, therapy_type, therapy_duration, therapy_side = ("Details to be taken from patient",) * 18

        else:
            nact = "No NeoAdjuvant Therapy given"
            date_nact, plan_nact, drug_admin, number_weeks, number_cycles, response_check, response_nact, response_size, \
            date, reason_incomplete, date_complete, trast_nact, trast_regime, trast_courses, \
            hormone_therapy, therapy_type, therapy_duration, therapy_side, place_nact, details_nact = \
                ("No NeoAdjuvant Therapy given",)*20
        last_update = datetime.now().strftime("%Y-%b-%d %H:%M")
        data_list = [nact, date_nact, plan_nact, drug_admin,str(number_weeks), str(number_cycles),
                     response_check, response_nact, response_size, date, reason_incomplete, date_complete,
                     trast_nact, trast_regime, trast_courses, hormone_therapy, therapy_type, therapy_duration,
                     therapy_side, user_name, last_update, place_nact, details_nact]
        col_list = names("Neo_Adjuvant_Therapy")
        check = review_input(file_number, col_list, data_list)
    return data_list,  tox_response_all, drug_per_week, data_per_cycle


def clip_information(file_number):
    check = False
    while not check:
        clip = ask_y_n_statement.ask_y_n("Was Clip inserted for surgery?")
        if clip:
            clip_number = input("Number of clips inserted: ")
            clip_date = input("Date of clip insertion: ")
            clip_cycle = input("Clip inserted after cycle? ")
        else:
            clip_date, clip_number, clip_cycle = ("NA", )*3
        data_list = clip_number, clip_date, clip_cycle
        col_list = names("clip_information")
        check = review_input(file_number, col_list, data_list)
    return data_list


def add_data(conn, cursor, file_number, user_name):
    table = "Neo_Adjuvant_Therapy"
    #file_row(cursor, file_number)
    data = nact_regime(file_number, user_name)
    data_sql, tox_response_all, drug_per_week, data_per_cycle = data
    update_multiple(conn, cursor, table, names(table), file_number, data_sql)
    tox_response_all.to_sql("NACT_Toxicity", conn, index=False, if_exists="append")
    drug_per_week.to_sql("NACT_Drug_per_week", conn, index=False, if_exists="append")
    data_per_cycle.to_sql("NACT_Drug_Cycle", conn, index=False, if_exists="append")
    enter = ask_y_n_statement.ask_y_n("Input Clip Information")
    if enter:
        data = clip_information(file_number)
        col_list = names("clip_information")
        update_multiple(conn, cursor, table, col_list, file_number, data)


def edit_data(conn, cursor, file_number, user_name):
    table = "Neo_Adjuvant_Therapy"
    enter = review_data(conn, cursor, table, file_number, names(table))
    if enter:
        data = nact_regime(file_number, user_name)
        data_sql, tox_response_all, drug_per_week, data_per_cycle = data
        update_multiple(conn, cursor, table, names(table), file_number, data_sql)
        delete_rows(cursor, 'NACT_Toxicity', "File_number", file_number)
        tox_response_all.to_sql("NACT_Toxicity", conn, index=False, if_exists="append")
        delete_rows(cursor, 'NACT_Drug_per_week', "File_number", file_number)
        drug_per_week.to_sql("NACT_Drug_per_week", conn, index=False, if_exists="append")
        delete_rows(cursor, 'NACT_Drug_Cycle', "File_number", file_number)
        data_per_cycle.to_sql("NACT_Drug_Cycle", conn, index=False, if_exists="append")
    print("Clip Information")
    module = "clip_information"
    col_list = names(module)
    enter = review_data(conn, cursor, table, file_number, col_list)
    if enter:
        data = clip_information(file_number)
        update_multiple(conn, cursor, table, col_list, file_number, data)
Beispiel #24
0
def nact_test(file_number, user_name):
    col_drug = names("NACT_Drug_Table")
    drug_table = pd.DataFrame(columns=col_drug)
    col_tox = names('NACT_Tox_table')
    toxicity = pd.DataFrame(columns=col_tox)
    check = False
    while not check:
        nact = ask_y_n_statement.ask_y_n_na("Has neo adjuvant therapy been done for the patient (Please check for "
                                            "chemotherapy and/hormone therapy)?")
        if nact == 'Yes':
            place_nact = ask_y_n_statement.ask_y_n_na("Has neo adjuvant therapy been done at PCCM?", "At PCCM",
                                                      "Outside", "Not Certain, requires follow-up")
            details_nact = ask_y_n_statement.ask_y_n("Are neo adjuvant therapy details available?", "Details Available",
                                                     "Follow-up required")
            if details_nact == "Follow-up required":
                plan_nact, date_start_nact, patient_wt, cyc_number, drug_cyc, drug_doses, drug_units, drug_freq, \
                tox_type, tox_grade, tox_treat, tox_response, tox_cycle, change_tox,nact_response_by, nact_response, \
                nact_size, nact_size_unit, nact_size_date, trast_nact, trast_regime, trast_courses, date_complete, \
                reason_incomplete, hormone_therapy,  therapy_type, therapy_duration, therapy_side = (details_nact,)*28
            elif details_nact == "Details Available":
                plan_nact = input("What is the plan of NACT (for eg., 4 cycles AC followed by 12 cycles Paclitaxel; "
                                  "Include hormone therapy plan here):")
                date_start_nact = ask_y_n_statement.check_date("Date of starting neo-adjuvant therapy: ")
                patient_wt = input("Weight of patient at start of therapy (in kgs): ")
                check_wt = ask_y_n_statement.ask_y_n("Is weight at any other time point mentioned in report "
                                                     "(with date, if given)?")
                while check_wt:
                    other_wt = input("Time point at which weight mentioned: ")
                    other_wt = other_wt + " " + input("Weight of patient at " + other_wt + ": ")
                    patient_wt = patient_wt + "; " + other_wt
                    check_wt = ask_y_n_statement.ask_y_n("Is weight at any other time point mentioned in report "
                                                         "(with date, if given)?")
                drug_admin = drug_table_enter(file_number, drug_table)
                data_drug = ['Number_cycle', 'Drug', 'Drug_dose', 'Dose_unit', 'Cycle_frequency_per_week']
                data_drug_list = []
                for index in data_drug:
                    data_drug = "; ".join(list(drug_admin.loc[:, index]))
                    data_drug_list.append(data_drug)
                cyc_number, drug_cyc, drug_doses, drug_units, drug_freq = data_drug_list
                check_drug_tox = False
                while not check_drug_tox:
                    toxicity = tox_table(file_number, drug_cyc, toxicity)
                    check_drug_tox = review_df(toxicity)
                columns = col_tox
                tox_details = []
                for column in columns:
                    tox_detail = toxicity.loc[:, column].drop_duplicates()
                    tox_details.append(list(tox_detail))
                tox_details = ask_y_n_statement.join_lists(tox_details, "; ")
                file_number_tox, drug_tox, tox_type, tox_grade, tox_treat, tox_response, tox_cycle, change_tox \
                    = tox_details
                nact_response_by = ask_y_n_statement.ask_option("Response to NACT measured by", ['Mammography',
                                                                                                 'SonoMammography'])
                if nact_response_by == "Data not in Report" or nact_response_by == "Requires Follow-up":
                    nact_response, nact_size, nact_size_unit, nact_size_date = (nact_response_by,)*4
                else:
                    nact_response = ask_y_n_statement.ask_option("Response of tumour",
                                                                 ["Partial", "Complete", "No Effect", "Other"])
                    nact_size = input("Tumour size (without unit, e.g., 2 x 4 x 5) after treatment: ")
                    nact_size_unit = ask_y_n_statement.ask_option("Tumour size unit", ['mm', 'cm'])
                    nact_size_date = ask_y_n_statement.check_date("Date tumour size checked: ")
                trast_nact = ask_y_n_statement.ask_y_n("Trastuzumab used?")
                if trast_nact:
                    trast_regime = ask_y_n_statement.ask_option("Trastuzumab use was", ["Sequential", "Concurrent"])
                    trast_nact = "Trastuzumab used"
                    trast_courses = input("Number of courses of trastuzumab/herceptin taken: ")
                else:
                    trast_nact, trast_regime, trast_courses, therapy_side = ("Trastuzumab not used", )*4
                date_complete = ask_y_n_statement.check_date("Date of completion of NACT: ")
                complete_nact = ask_y_n_statement.ask_y_n("Was NACT completed as per schedule? ")
                if complete_nact:
                    reason_incomplete = "NACT completed as per schedule"
                else:
                    reason_incomplete = ask_y_n_statement.ask_option("Reason for discontinuation",
                                                                     ["Toxicity", "Reluctance of patient",
                                                                      "Progression on chemotherapy",
                                                                      "Advised by treating doctor",
                                                                      "Death due to toxicity",
                                                                      "Death due to progressive disease",
                                                                      "Preferred treatment at another centre",
                                                                      "Death due to unrelated cause",
                                                                      "Patient was unable to afford treatment"])
                    reason_incomplete = "NACT incomplete: " + reason_incomplete
                hormone_therapy = ask_y_n_statement.ask_y_n_na("Was hormone therapy given?")
                if hormone_therapy == 'Yes':
                    hormone_therapy = "Hormone therapy given"
                    therapy_type = ask_y_n_statement.ask_option("Hormone therapy type", ["Sequential", "Concurrent"])
                    therapy_duration = input("What was the duration of therapy? ")
                    therapy_side = ask_y_n_statement.ask_y_n_na("Were any side effects observed ?")
                    if therapy_side == 'Yes':
                        therapy_side = input("Please give details of side effects observed: ")
                    nact_naht = ask_y_n_statement.ask_y_n('Was chemotherapy given in addition to hormone therapy?')
                    if nact_naht:
                        nact = 'NACT and NAHT given'
                    else:
                        nact = 'NAHT given'
                elif hormone_therapy == 'No':
                    hormone_therapy = "No hormone therapy given"
                    nact = "NACT given"
                    therapy_type, therapy_duration, therapy_side = (hormone_therapy,) * 3
                else:
                    therapy_type, therapy_duration, therapy_side = (hormone_therapy,) * 3
                    nact = "NACT given"
            else:
                plan_nact, date_start_nact, cyc_number, drug_cyc, drug_doses, drug_units, drug_freq, tox_type, \
                tox_grade, tox_treat, tox_response, tox_cycle, change_tox, nact_response_by, nact_response, nact_size, \
                nact_size_unit, nact_size_date, trast_nact, trast_regime, trast_courses, hormone_therapy,  \
                therapy_type, therapy_duration, therapy_side, date_complete, reason_incomplete, patient_wt \
                    = (details_nact,)*28
        elif nact == 'No':
            place_nact, plan_nact, date_start_nact, cyc_number, drug_cyc, drug_doses, drug_units, drug_freq, tox_type, \
            tox_grade, tox_treat, tox_response, tox_cycle, change_tox, nact_response_by, nact_response, \
            nact_size, nact_size_unit, nact_size_date, trast_nact, trast_regime, trast_courses, hormone_therapy,  \
            therapy_type, therapy_duration, therapy_side, date_complete, reason_incomplete, details_nact, nact, \
            patient_wt = ("NACT/NAHT not given",)*31
        else:
            place_nact, plan_nact, date_start_nact, cyc_number, drug_cyc, drug_doses, drug_units,  drug_freq, tox_type,\
            tox_grade, tox_treat, tox_response, tox_cycle, change_tox, nact_response_by, nact_response, \
            nact_size, nact_size_unit, nact_size_date, trast_nact, trast_regime, trast_courses, hormone_therapy,  \
            therapy_type, therapy_duration, therapy_side, date_complete, reason_incomplete, details_nact, patient_wt \
                = (nact,)*30

        last_update = datetime.now().strftime("%Y-%b-%d %H:%M")
        data_list = [nact,  place_nact,  details_nact,  plan_nact,  date_start_nact, patient_wt, drug_cyc,
                     cyc_number, drug_freq, drug_doses,  drug_units, tox_type, tox_grade, tox_treat, tox_response,
                     tox_cycle,  change_tox, nact_response_by, nact_response, nact_size, nact_size_unit, nact_size_date,
                     reason_incomplete, date_complete, trast_nact, trast_regime, trast_courses, hormone_therapy,
                     therapy_type, therapy_duration, therapy_side, user_name, last_update]
        col_list = names("Neo_Adjuvant_Therapy")
        check = review_input(file_number, col_list, data_list)
    return data_list, drug_table, toxicity
Beispiel #25
0
 def surgery_block_information_1(self, block_data_type='primary_surgery'):
     module_name = self.module_list[0]
     check = False
     while not check:
         data_type = ask.ask_y_n("Is surgery type '" + block_data_type +
                                 "'")
         if not data_type:
             block_data_type = input("Please input type of surgery: ")
         block_sr_no = input("Surgery Block Serial Number: ")
         surg_block_id = input("Surgical Block ID: ")
         surg_no_block = input(
             "Number of Blocks (please input only number): ")
         surg_block_source = input("Pathology Lab (source of block): ")
         breast_cancer_yes_no = ask.ask_y_n(
             'Is this a case of breast cancer',
             yes_ans="breast cancer_yes",
             no_ans="breast cancer_no")
         pathology_report_available_yes_no = ask.ask_y_n(
             'Is the pathology report available',
             yes_ans="yes",
             no_ans="no")
         surg_date = ask.check_date("Date of Surgery: ")
         surg_name = ask.ask_option("Name of the Surgeon/s",
                                    ["Dr. C. B. Koppiker"])
         surg_hosp_id = input("Hospital ID: ")
         lesion_side = ask.ask_option(
             "Lesion on",
             ["Right Breast", "Left Breast", 'Unilateral', "Bilateral"])
         nact = sql.get_value(
             col_name='NACT_status',
             table='Neo_Adjuvant_Therapy',
             file_number=self.file_number,
             cursor=self.cursor,
             error_statement="Please enter (Data to be filled) for NACT "
             "details here")
         surg_list = [
             'Mastectomy', 'Modified Radical Mastectomy',
             'Breast Conservation Surgery', 'Therapeutic Mammoplasty',
             'Reduction Mammoplasty', 'Lumpectomy (Wide Local Excision)',
             "Reconstruction"
         ]
         if lesion_side != "Bilateral":
             surg_type = ask.ask_option("Type Surgery", surg_list)
         else:
             print("Right Breast Surgery")
             surg_type = ask.ask_option("Type Surgery", surg_list)
             surg_type_rb = "RB: " + surg_type
             print("Left Breast Surgery")
             surg_type = ask.ask_option("Type Surgery", surg_list)
             surg_type_lb = "LB: " + surg_type
             surg_type = surg_type_rb + "; " + surg_type_lb
         data_list_1 = [
             block_data_type, block_sr_no, surg_block_id, surg_no_block,
             breast_cancer_yes_no, pathology_report_available_yes_no,
             surg_block_source, surg_date, surg_name, surg_hosp_id,
             lesion_side, nact, surg_type
         ]
         columns_list = names(module_name)
         check = sql.review_input(self.file_number, columns_list,
                                  data_list_1)
     return data_list_1
Beispiel #26
0
 def __init__(self, file_number, block_id, block_no):
     self.file_number = file_number
     self.block_id = block_id
     self.block_no = block_no
     self.block_desc_df_cols = names('block_data')
Beispiel #27
0
def chemotherapy(file_number, user_name):
    col_drug = names("Chemo_Drug_Table")
    drug_table = pd.DataFrame(columns=col_drug)
    col_tox = names('Chemo_Tox_table')
    toxicity = pd.DataFrame(columns=col_tox)
    check = False
    while not check:
        chemo = ask_y_n_statement.ask_y_n_na(
            "Has adjuvant chemotherapy been done for the patient?")
        if chemo == 'Yes':
            place_chemo = ask_y_n_statement.ask_y_n_na(
                "Has Adjuvant Chemotherapy been done at PCCM?", "At PCCM",
                "Outside", "Not Certain, requires follow-up")
            details_chemo = ask_y_n_statement.ask_y_n(
                "Are Adjuvant Chemotherapy details available?",
                "Details Available", "Follow-up required")
            chemo = "Adjuvant Chemotherapy given"
            if details_chemo == "Follow-up required":
                plan_chemo, date_start_chemo, cyc_number, drug_cyc, drug_doses, drug_units, tox_type, tox_grade, \
                tox_treat, tox_response, tox_cycle, change_tox,chemo_response_by, chemo_response, chemo_size, \
                chemo_size_date, trast_chemo, trast_regime, trast_courses,date_complete, reason_incomplete, \
                hormone_therapy, therapy_type, therapy_duration, therapy_side, ovary_status, patient_wt, drug_freq\
                    = (details_chemo,)*28
            elif details_chemo == "Details Available":
                plan_chemo = input(
                    "What is the plan of Adjuvant Chemotherapy (for eg., "
                    "4 cycles AC followed by 12 cycles Paclitaxel):")
                date_start_chemo = ask_y_n_statement.check_date(
                    "Date of starting Adjuvant Chemotherapy: ")
                patient_wt = input(
                    "Weight of patient at start of therapy (in kgs): ")
                check_wt = ask_y_n_statement.ask_y_n(
                    "Is weight at any other time point mentioned in report?")
                while check_wt:
                    other_wt = input("Time point at which weight mentioned: ")
                    other_wt = other_wt + " " + input("Weight of patient at " +
                                                      other_wt + ": ")
                    patient_wt = patient_wt + "; " + other_wt
                    check_wt = ask_y_n_statement.ask_y_n(
                        "Is weight at any other time point mentioned in report "
                        "(with date, if given)?")
                drug_table = drug_table_enter(file_number, drug_table)
                data_drug = col_drug[1:]
                data_drug_list = []
                for index in data_drug:
                    data_drug = "; ".join(list(drug_table.loc[:, index]))
                    data_drug_list.append(data_drug)
                drug_cyc, cyc_number, drug_freq, drug_doses, drug_units = data_drug_list
                check_drug_tox = False
                while not check_drug_tox:
                    toxicity = tox_table(file_number, drug_cyc, toxicity)
                    check_drug_tox = review_df(toxicity)
                columns = col_tox
                tox_details = []
                for column in columns:
                    tox_detail = toxicity.loc[:, column].drop_duplicates()
                    tox_details.append(list(tox_detail))
                tox_details = ask_y_n_statement.join_lists(tox_details, "; ")
                file_number_tox, drug_tox, tox_type, tox_grade, tox_treat, tox_response, tox_cycle, change_tox \
                    = tox_details
                trast_chemo = ask_y_n_statement.ask_y_n("Trastuzumab used?")
                if trast_chemo:
                    trast_regime = ask_y_n_statement.ask_option(
                        "Trastuzumab use was", ["Sequential", "Concurrent"])
                    trast_chemo = "Trastuzumab used"
                    trast_courses = input(
                        "Number of courses of trastuzumab/herceptin taken: ")
                else:
                    trast_chemo, trast_regime, trast_courses, therapy_side = (
                        "Trastuzumab not used", ) * 4
                date_complete = ask_y_n_statement.check_date(
                    "Date of completion of Adjuvant Chemotherapy: ")
                complete_chemo = ask_y_n_statement.ask_y_n(
                    "Was Adjuvant Chemotherapy completed as per schedule?")
                if complete_chemo:
                    reason_incomplete = "Adjuvant Chemotherapy completed as per schedule"
                else:
                    reason_incomplete = ask_y_n_statement.ask_option(
                        "Reason for discontinuation", [
                            "Toxicity", "Reluctance of patient",
                            "Progression on chemotherapy",
                            "Advised by treating doctor",
                            "Death due to toxicity",
                            "Death due to progressive disease",
                            "Preferred treatment at another centre",
                            "Death due to unrelated cause",
                            "Patient was unable to afford treatment"
                        ])
                    reason_incomplete = "Adjuvant Chemotherapy incomplete: " + reason_incomplete
                menopause = ask_y_n_statement.ask_option(
                    "Menopausal Status", [
                        "Pre-menopausal", "Peri-menopausal", "Post-Menopausal",
                        "Other"
                    ])
                if menopause in {"Pre-menopausal", "Peri-menopausal"}:
                    ovary_status = ask_y_n_statement.ask_option(
                        "Status of ovarian function after Chemotherapy", [
                            "Menses ongoing", "Amenorrhoea on Chemo",
                            "Amenorrhoea post Chemotherapy"
                        ])
                else:
                    ovary_status = menopause
                #hormone_therapy, therapy_type, therapy_duration, therapy_side = hormone_therapy_chemo()
                hormone_therapy, therapy_type, therapy_duration, therapy_side = (
                    'NA', ) * 4
            else:
                plan_chemo, date_start_chemo, cyc_number, drug_cyc, drug_doses, drug_units, drug_freq,tox_type, \
                tox_grade, tox_treat, tox_response, tox_cycle, change_tox,chemo_response_by, chemo_response, \
                chemo_size, chemo_size_date, trast_chemo, trast_regime, trast_courses, hormone_therapy,  therapy_type, \
                therapy_duration, therapy_side, date_complete, reason_incomplete,ovary_status, patient_wt \
                    = (details_chemo,)*28
        elif chemo == 'No':
            place_chemo, plan_chemo, date_start_chemo, cyc_number, drug_cyc, drug_doses, drug_units, \
            drug_freq,tox_type, tox_grade, tox_treat, tox_response, tox_cycle, change_tox, chemo_response_by, \
            chemo_response, chemo_size, chemo_size_date, trast_chemo, trast_regime, trast_courses, hormone_therapy, \
            therapy_type, therapy_duration, therapy_side, date_complete, reason_incomplete, details_chemo, chemo, \
            ovary_status, patient_wt = ("Adjuvant Chemotherapy not given",)*31
        else:
            place_chemo, plan_chemo, date_start_chemo, cyc_number, drug_cyc, drug_doses, drug_units, drug_freq, \
            tox_type, tox_grade, tox_treat, tox_response, tox_cycle, change_tox, chemo_response_by, chemo_response, \
            chemo_size, chemo_size_date, trast_chemo, trast_regime, trast_courses, hormone_therapy, therapy_type, \
            therapy_duration,ovary_status, therapy_side, date_complete, reason_incomplete, details_chemo, patient_wt \
                = (chemo,)*30
        last_update = datetime.now().strftime("%Y-%b-%d %H:%M")
        data_list = [
            chemo, place_chemo, details_chemo, plan_chemo, date_start_chemo,
            patient_wt, drug_cyc, cyc_number, drug_freq, drug_doses,
            drug_units, tox_type, tox_grade, tox_treat, tox_response,
            tox_cycle, change_tox, reason_incomplete, date_complete,
            trast_chemo, trast_regime, trast_courses, ovary_status,
            hormone_therapy, therapy_type, therapy_duration, therapy_side,
            user_name, last_update
        ]
        col_list = names("Adjuvant_ChemoTherapy")
        check = review_input(file_number, col_list, data_list)
    return data_list, drug_table, toxicity
Beispiel #28
0
def mri_breast(file_number='test', user_name='dk'):
    module_name = "mri_breast"
    check = False
    while not check:
        mri_breast = ask_y_n_statement.ask_y_n("Has MRI-Breast been done?")
        if mri_breast:
            mri_breast = "MRI-Breast done"
            mri_breast_date = input("Date of examination of MRI: ")
            mri_breast_acc = input(
                "Accession number of MRI (Include location): ")
            mri_breast_described = ask_y_n_statement.ask_option(
                "Details described for",
                ["Right Breast", "Left Breast", "Bilateral"])
            fgt_mri = ask_y_n_statement.ask_option(
                "Ammount of Fibroglandular Tissue", [
                    "a. Almost entirely fat",
                    "b. Scattered fibroglandular tissue",
                    "d. Extreme fibroglandular tissue", "Other"
                ])
            bpe_level_mri = ask_y_n_statement.ask_option(
                "Background parenchymal enhancement Level",
                ["Minimal", "Mild", "Moderate", "Marked", "Other"])
            bpe_symm_mri = ask_y_n_statement.ask_option(
                "Background parenchymal enhancement Symmetry",
                ["Symmetric", "Asymmetric", "Other"])
            focus_mri = input("Details of Focus: ")
            mass_mri = ask_y_n_statement.ask_y_n("Are masses detected?")
            if mass_mri:
                mass_mri = "Mass Detected"
                table = "MRI_Mass"
                mri_mass_number, mass_location, mass_shape, mass_margin, mass_internal = \
                    radio_tables.multiple_mass(table, mri_breast_described)
            else:
                mass_mri = "No Mass Detected"
                mri_mass_number, mass_location, mass_quad, mass_shape, mass_margin, mass_internal = (
                    "NA", ) * 6
            asso_feat = [
                "Nipple Retraction", "Nipple Invasion", "Skin Retraction",
                "Skin Thickening", "Axillary adenopathy",
                "Pectoralis muscle invasion", "Chest wall invasion",
                "Architectural Distortion"
            ]
            asso_feat_data = []
            for index in (asso_feat):
                print("Associated feature: " + index)
                print("Detailed description can be added by choosing 'Other'")
                var = ask_y_n_statement.ask_option(index, [
                    "Right Breast", "Left Breast", "Both", "Not Present",
                    "Other"
                ])
                asso_feat_data.append(var)
            asso_feat_9 = ask_y_n_statement.ask_option(
                "Associated Feature: Skin Invasion",
                ["Direct invasion", "Inflammatory cancer", "Other"])
            asso_feat_1, asso_feat_2, asso_feat_3, asso_feat_4, asso_feat_5, asso_feat_6, asso_feat_7, \
            asso_feat_8 = asso_feat_data
            fat_lesions = ask_y_n_statement.ask_option(
                "Fat Containing Lesions", [
                    "Lymph nodes: Normal", "Lymph nodes: Abnormal",
                    "Fat necrosis", "Hamartoma", "Postoperative seroma",
                    "hematoma with fat"
                ])
            mri_breast_kinetics_initial = ask_y_n_statement.ask_option(
                "Kinetic curve assessment Signal intensity "
                "(SI)/time curve description (Initial Phase)",
                ["Slow", "Medium", "Fast", "Other"])
            mri_breast_kinetics_delayed = ask_y_n_statement.ask_option(
                "Kinetic curve assessment Signal intensity "
                "(SI)/time curve description (Delayed Phase)",
                ["Persistent", "Plateau", "Washout", "Other"])
            mri_breast_non_enhance = ask_y_n_statement.ask_option(
                "Non-enhancing findings", [
                    "Ductal precontrast high signal on T1W", "Cyst",
                    "Postoperative collections (hematoma/seroma)",
                    "Post-therapy skin thickening and trabecular "
                    "thickening", "Signal void from foreign bodies, "
                    "clips, etc.", "Other"
                ])
            mri_breast_implant = input("Implant related findings: ")
            mri_breast_lesion = ask_y_n_statement.ask_option(
                "Location of lesion",
                ["Right Breast", "Left Breast", "Both", "Not present"])
            if mri_breast_lesion in {"Right Breast", "Left Breast", "Both"}:
                mri_breast_lesion_location = radio_tables.lesion_location(
                    mri_breast_lesion)
                mri_breast_lesion_depth = input("Lesion depth: ")
            else:
                mri_breast_lesion_location, mri_breast_lesion_depth = (
                    "NA", ) * 2
            mri_breast_size = ask_y_n_statement.ask_option(
                "Size of lesion", ["<2 cm", "2-5 cm", ">5 cm", "Other"])
            mri_breast_dist = ask_y_n_statement.ask_option(
                "Distance from Skin (cm)", ["<0.5 cm", ">0.5 cm", "Other"])
            mri_breast_pect = input("Distance from Pectoralis Major (cm): ")
            mri_breast_birad = ask_y_n_statement.ask_y_n(
                "Does the report include a BI-RAD assessment/Diagnosis?")
            if mri_breast_birad:
                mri_breast_birad = radio_tables.birads()
            else:
                mri_breast_birad = "No BI-RAD Category given in report"
        else:
            mri_breast = "MRI-Breast not done"
            mri_breast_date, mri_breast_acc, fgt_mri, bpe_level_mri, bpe_symm_mri, focus_mri, mass_mri, mri_mass_number, \
            mass_location, mass_quad, mass_shape, mass_margin, mass_internal, asso_feat_1, asso_feat_2, asso_feat_3, \
            asso_feat_4, asso_feat_5, asso_feat_6, asso_feat_7, asso_feat_8, asso_feat_9, fat_lesions, \
            mri_breast_lesion, mri_breast_lesion_location, mri_breast_lesion_depth, mri_breast_kinetics_initial, \
            mri_breast_kinetics_delayed, mri_breast_non_enhance, mri_breast_implant, mri_breast_size, mri_breast_dist, \
            mri_breast_pect, mri_breast_birad, mri_breast_described = (mri_breast,) * 35
        last_update = datetime.now().strftime("%Y-%b-%d %H:%M")
        data_list = [
            mri_breast, mri_breast_date, mri_breast_acc, mri_breast_described,
            fgt_mri, bpe_level_mri, bpe_symm_mri, focus_mri, mass_mri,
            mri_mass_number, mass_location, mass_shape, mass_margin,
            mass_internal, asso_feat_1, asso_feat_2, asso_feat_3, asso_feat_4,
            asso_feat_5, asso_feat_6, asso_feat_7, asso_feat_8, asso_feat_9,
            fat_lesions, mri_breast_kinetics_initial,
            mri_breast_kinetics_delayed, mri_breast_non_enhance,
            mri_breast_implant, mri_breast_lesion, mri_breast_lesion_location,
            mri_breast_lesion_depth, mri_breast_size, mri_breast_dist,
            mri_breast_pect, mri_breast_birad, user_name, last_update
        ]
        columns_list = names(module_name)
        check = add_update_sql.review_input(file_number, columns_list,
                                            data_list)
    return tuple(data_list)
Beispiel #29
0
def mammography(file_number='test'):
    module_name = "mammography"
    check = False
    while not check:
        mammo = ask_y_n_statement.ask_y_n(
            "Are mammography results available for this patient?")
        if not mammo:
            check_mammo = ask_y_n(
                "Is the diagnostic radiological report present?")
            if check_mammo:
                mammo = "Mammography not done for diagnosis"
            else:
                mammo = "Requires Follow-up"
            tomo, mammo_date, mammo_place, mammo_indication, mammo_breast, mass_number, mammo_mass_location, \
            mammo_mass_shape, mammo_mass_margin, mammo_mass_nipple_cm, mammo_mass_size, mammo_mass_size_unit, calc_number, \
            calc_location, calc_type, mammo_birad, mammo_impression, skin_lesion = (mammo,) * 18
        else:
            tomo = ask_y_n_statement.ask_y_n(
                "Have 3D Tomography images also been acquired?")
            if tomo:
                tomo = "Yes"
                print(
                    "Please include 3d-Tomo observations in Mammography results"
                )
            else:
                tomo = "No"
            mammo = "Mammography done"
            mammo_date = input("Date of mammography: ")
            mammo_place = ask_y_n("Was exam peformed at PCCM?",
                                  yes_ans="PCCM",
                                  no_ans="Outside")
            if mammo_place == "Outside":
                mammo_place = input(
                    "Please input Radiologist name and place (Name; Place): ")
            mammo_indication = input("Indication for mammography: ")
            mammo_breast = ask_y_n_statement.ask_option(
                "Details described for",
                ["Right Breast", "Left Breast", "Bilateral"])
            mammo_mass_location = ask_y_n_statement.ask_y_n(
                "Is there any mass/lesion detected")
            if mammo_mass_location:
                table = "Mammography_Mass"
                mass_number, mammo_mass_location, mammo_mass_shape, mammo_mass_margin, mammo_mass_nipple_cm, \
                mammo_mass_size, mammo_mass_size_unit = radio_tables.multiple_mass(table, mammo_breast)
            else:
                mass_number, mammo_mass_location, mammo_mass_shape, mammo_mass_margin, mammo_mass_nipple_cm, \
                mammo_mass_size, mammo_mass_size_unit= ("No mass detected", )*7
            calc = ask_y_n_statement.ask_y_n("Is Calcification present?")
            if calc:
                calc_number, calc_location, calc_type = radio_tables.cal_table(
                    file_number, mammo_breast)
            else:
                calc_number, calc_location, calc_type = (
                    "No Calcification detected", ) * 3
            mammo_birad = ask_y_n_statement.ask_y_n(
                "Does the report include a BI-RAD assessment/diagnosis?")
            if mammo_birad:
                mammo_birad = radio_tables.birads()
            else:
                mammo_birad = "BI-RAD not assigned in report"
            skin_lesion = input(
                "Please input description of skin lesion if present: ")
            mammo_impression = input("Input Impression(if available): ")
        data_list = [
            mammo, mammo_date, mammo_place, mammo_indication, mammo_breast,
            mass_number, mammo_mass_location, mammo_mass_shape,
            mammo_mass_margin, mammo_mass_nipple_cm, mammo_mass_size,
            mammo_mass_size_unit, calc_number, calc_location, calc_type,
            skin_lesion, mammo_birad, mammo_impression, tomo
        ]
        columns_list = names(module_name)
        check = add_update_sql.review_input(file_number, columns_list,
                                            data_list)
    return tuple(data_list)
Beispiel #30
0
def sonomammo(file_number='test', user_name="dk"):
    module_name = "sonomammo"
    check = False
    while not check:
        sonomammo = ask_y_n_statement.ask_y_n(
            "Are sonomammography results available for this patient?")
        if sonomammo:
            sonomammo = "Sono-Mammography done"
            sonomammo_date = input("Date of examination of Sono-mammography: ")
            sonomammo_place = input("")
            sonomammo_breast = ask_y_n_statement.ask_option(
                "Details described for",
                ["Right Breast", "Left Breast", "Bilateral"])
            mass_sonomammo = ask_y_n_statement.ask_y_n(
                "Is there any mass detected")
            if mass_sonomammo:
                mass_sonomammo = 'Mass/Lesion Detected'
                table = "SonnoMammography_Mass"
                mass_number, sonomammo_mass_location, sonomammo_mass_location_clock, sonomammo_masss_shape, \
                sonomammo_mass_margin, sonomammo_mass_echo, sonomammo_mass_size, sonomammo_mass_size_unit\
                    = radio_tables.multiple_mass(table, sonomammo_breast)
            else:
                mass_sonomammo, mass_number, sonomammo_mass_location, sonomammo_mass_location_clock, \
                sonomammo_masss_shape, sonomammo_mass_margin, sonomammo_mass_echo, sonomammo_mass_size, sonomammo_mass_size_unit = \
                    ("No Mass Detected",) * 9
            sonomammo_calc = ask_y_n_statement.ask_option(
                "Calcification", [
                    "Right Breast", "Left Breast", "Bilateral", "Not present",
                    "Other"
                ])
            if sonomammo_calc != "Not present":
                sonomammo_calc_type = ask_y_n_statement.ask_option(
                    "Calcification location", [
                        "Calcifications in a mass",
                        "Calcifications outside of a mass",
                        "Intraductal calcifications"
                    ])
            else:
                sonomammo_calc_type = "NA"
            sonomammo_vasc = ask_y_n_statement.ask_option(
                "Vascularity",
                ["Absent", "Internal vascularity", "Vessels in rim", "Other"])
            sono_birad = ask_y_n_statement.ask_y_n(
                "Does the report include a BI-RAD assessment/Diagnosis?")
            if sono_birad:
                sonomammo_birad = radio_tables.birads()
            else:
                sonomammo_birad = "NA"
            sonomammo_impression = input("Input Impression(if available): ")
        else:
            check_mammo = ask_y_n(
                "Is the diagnostic radiological report present?")
            if check_mammo:
                sonomammo = "Sonomammography not done for diagnosis"
            else:
                sonomammo = "Requires Follow-up"
            sonomammo_date, sonomammo_breast, mass_sonomammo, mass_number, sonomammo_mass_location, \
            sonomammo_masss_shape, sonomammo_mass_margin, sonomammo_mass_echo, sonomammo_mass_location_clock, \
            sonomammo_mass_size, sonomammo_mass_size_unit, sonomammo_calc, sonomammo_calc_type, \
            sonomammo_vasc,sonomammo_birad, sonomammo_impression \
                = (sonomammo,) * 16
        last_update = datetime.now().strftime("%Y-%b-%d %H:%M")
        data_list = [
            sonomammo, sonomammo_date, sonomammo_breast, mass_sonomammo,
            mass_number, sonomammo_mass_location,
            sonomammo_mass_location_clock, sonomammo_masss_shape,
            sonomammo_mass_margin, sonomammo_mass_echo, sonomammo_mass_size,
            sonomammo_mass_size_unit, sonomammo_calc, sonomammo_calc_type,
            sonomammo_vasc, sonomammo_birad, sonomammo_impression, user_name,
            last_update
        ]
        columns_list = names(module_name)
        check = add_update_sql.review_input(file_number, columns_list,
                                            data_list)
    return tuple(data_list)