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))
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
def hormone_therapy_chemo(): 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: ") elif hormone_therapy == 'No': hormone_therapy = "No hormone therapy given" therapy_type, therapy_duration, therapy_side = (hormone_therapy,) * 3 else: therapy_type, therapy_duration, therapy_side = (hormone_therapy, )*3 return hormone_therapy, therapy_type, therapy_duration, therapy_side
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
def biopsy_details(self, df_cols): data_list_df = pd.DataFrame(columns=df_cols) 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 + ' report only') block_sr, block_location, block_id, block_number = ('block_not_available',) * 4 block_check = ask.ask_y_n('Are the biopsy blocks available?') if block_check: block_sr = input("Biopsy Block Serial Number: ") block_location = BlockDescription.block_location() block_id = input("Biopsy Block ID (include series identifiers): ") block_number = input("Number of blocks: ") biopsy_date = ask.check_date("Date of Biopsy: ") biopsy_lab_id = input("Biopsy Lab ID/SID: ") print('Please input all data for ' + breast + ' block only') biopsy_type = ask.ask_option("Biopsy Type", ["Direct", "USG Guided", "VAB", "Tru-cut", "Steriotactic", 'Core', 'Excision', 'FNAC', "Other"]) category = "Tumour biopsy diagnosis" options = ['Benign', "Ductal carcinoma in situ(DCIS) with microinvasion", "Ductal carcinoma in situ(DCIS) without microinvasion", "Lobular Carcinoma in Situ (LCS)", "Invasive Ductal Carcinoma (IDC)", "Invasive Lobular Carcinoma (ILC)", "Granulamatous Mastitis", "Papillary Carcinoma", "Phylloid Carcinoma", "Invasive Mammary Carcinoma", "Invasive Breast Carcinoma", "Other"] tumour_diagnosis = ask.ask_option(category, options) tumour_grade = ask.ask_option("Tumour Biopsy Diagnosis", ["I", "II", "III"]) lymph_emboli = ask.ask_y_n_na(question="Are Lymphovascular emboli seen?", yes_ans='Lymphovascular_emboli_biopsy_yes', no_ans='Lymphovascular_emboli_biopsy_no', na_ans='Data not in report') dcis_biopsy = ask.ask_y_n_na(question="Does the biopsy show DCIS", yes_ans="DCIS_biopsy_yes", no_ans="DCIS_biopsy_no", na_ans="Data not in report") df_data = [block_sr, block_location, block_id, block_number, biopsy_date, biopsy_lab_id, biopsy_type, tumour_diagnosis, tumour_grade, lymph_emboli, dcis_biopsy] 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 return data_list_df, breast_biopsy
def biopsy_details(self, block_id): check = False while not check: print('Please input all data for ' + block_id + ' report only') biopsy_date = ask.check_date("Date of Biopsy: ") biopsy_source = ask.ask_option('Source of Biopsy Block', ['Golwilkar Lab', 'AG Diagnostics', 'Ruby Hall Clinic']) biopsy_lab_id = input("Biopsy Lab ID/SID: ") biopsy_type = ask.ask_option("Biopsy Type", ["Trucut", "VAB", 'Excision', 'FNAC']) biopsy_diagnosis = input('Enter the diagnosis in its full form (eg., Infiltrating Duct Carcinoma): ') biopsy_comments = input('Enter any additional comments on the diagnosis: ') tumour_grade = ask.ask_option("Tumour Biopsy Diagnosis", ["I", "II", "III"]) lymph_emboli = ask.ask_y_n_na(question="Are Lymphovascular emboli seen?", yes_ans='Lymphovascular_emboli_biopsy_seen', no_ans='Lymphovascular_emboli_biopsy_not_seen', na_ans='Data not in report') dcis_biopsy = ask.ask_y_n_na(question="Does the biopsy show DCIS", yes_ans="DCIS_biopsy_yes", no_ans="DCIS_biopsy_no", na_ans="Data not in report") data_list = [biopsy_date, biopsy_source, biopsy_lab_id, biopsy_type, biopsy_diagnosis, biopsy_comments, tumour_grade, lymph_emboli, dcis_biopsy] col_list = names.names_biopsy_x('biopsy_details') check = sql.review_input(self.file_number, col_list, data_list) return data_list
def biopsy_report_info(self, file_number='test'): check = False while not check: block_id = BiopsyData.migrate_block_data(self) reason_biopsy = ask.ask_option('Reason_for_Biopsy', ['Diagnostic', 'Follow-up', 'NACT follow-up', 'Recurrence']) biopsy_site = ask.ask_option('Biopsy_site', ['Left Breast', 'Right Breast', ' Left Axilla', 'Right Axilla']) 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") if block_id == 'NA': block_id = input('Block id: ') block_series = input('Block series: ') no_of_blocks = 'NA' else: block_series = set(sql.get_block_id_multiple(col_name='block_series', table='Block_list', file_number=self.file_number, cursor=self.cursor, block_type=block_id)) no_of_blocks = set(sql.get_block_id_multiple(col_name='no_of_blocks', table='Block_list', file_number=self.file_number, cursor=self.cursor, block_type=block_id)) block_details = [block_id, block_series, no_of_blocks,reason_biopsy, biopsy_site, biopsy_report_pccm, ihc_report_pccm] biopsy_details = [biopsy_report_pccm] * 9 if biopsy_report_pccm == 'Biopsy_report_PCCM_yes': biopsy_details = BiopsyData.biopsy_details(self, block_id) elif biopsy_report_pccm == 'Biopsy_report_PCCM_no': biopsy_details = ['Requires Follow-up'] * 9 ihc_details = [ihc_report_pccm] * 11 if ihc_report_pccm == 'IHC_report_PCCM_yes': ihc_details = BiopsyData.ihc_data(self, block_id) elif biopsy_report_pccm == 'IHC_report_PCCM_no': ihc_details = ['Requires Follow-up'] * 9 last_update = datetime.now().strftime("%Y-%b-%d %H:%M") col_list = names.names_biopsy_x('block_details') check = sql.review_input(file_number, col_list, block_details) data_list = block_details, biopsy_details, ihc_details + [last_update] + [self.user_name] return data_list
def family_cancer(conn, cursor, file_number): module_name = "family_cancer" check = False while not check: family_cancer_history_y_n = ask_y_n_na('Cancer history in Family') if family_cancer_history_y_n == 'Yes': family_cancer = family_cancer_table(conn, cursor, file_number) family_cancer_history_y_n = "Family History of Cancer" elif family_cancer_history_y_n == 'No': family_cancer_history_y_n = "No Family History of Cancer" family_cancer = "No Family History of Cancer" else: family_cancer = family_cancer_history_y_n data_list = [family_cancer_history_y_n, family_cancer] columns_list = pccm_names.names_info(module_name) check = review_input(file_number, columns_list, data_list) return (tuple(data_list))
def phys_act(conn, cursor, file_number): module_name = "phys_act" check = False while not check: phys_act = ask_y_n_na("Any Physical Activities ?") if phys_act == 'Yes': phys = physical_activity_table(conn, cursor, file_number) phys_act = "Physical Activities Performed" phys_act_done, phys_act_freq = phys elif phys_act == 'No': phys_act = "No Physical Activities" phys_act_done, phys_act_freq = ("No Physical Activities", ) * 2 else: phys_act_done, phys_act_freq = (phys_act, ) * 2 data_list = [phys_act, phys_act_done, phys_act_freq] columns_list = pccm_names.names_info(module_name) check = review_input(file_number, columns_list, data_list) return (tuple(data_list))
def nut_supplements(conn, cursor, file_number): module_name = "nut_supplements" check = False while not check: nut_supplements = ask_y_n_na("Nutritional supplements taken") if nut_supplements == 'Yes': nuts = nut_supp_table(conn, cursor, file_number) nut_supplements = "Nutritional supplements taken" elif nut_supplements == 'No': nut_supplements = "No nutritional supplements taken" nuts = ("No nutritional supplements taken", ) * 3 else: nuts = (nut_supplements, ) * 3 nuts_type, nuts_quant, nuts_dur = nuts data_list = [nut_supplements, nuts_type, nuts_quant, nuts_dur] columns_list = pccm_names.names_info(module_name) check = review_input(file_number, columns_list, data_list) return (tuple(data_list))
def med_history(conn, cursor, file_number): module_name = "med_history" check = False while not check: medical_history_y_n = ask_y_n_na("Any Other Medical History ?") if medical_history_y_n == 'Yes': med_hist = med_history_table(conn, cursor, file_number) medical_history_y_n = "Previous medical history present" elif medical_history_y_n == 'No': medical_history_y_n = "No previous medical history present" med_hist = ("No previous medical history present", ) * 3 else: med_hist = (medical_history_y_n, ) * 3 condition_hist, diagnosis_date_hist, treatment_hist = med_hist data_list = [ medical_history_y_n, condition_hist, diagnosis_date_hist, treatment_hist ] columns_list = pccm_names.names_info(module_name) check = review_input(file_number, columns_list, data_list) return (tuple(data_list))
def cancer_history(conn, cursor, file_number): module_name = "cancer_history" check = False while not check: previous_cancer_history_y_n = ask_y_n_na( "Previous history of cancer ?") if previous_cancer_history_y_n == 'Yes': previous_cancer = cancer_table(conn, cursor, file_number) previous_cancer_history_y_n = "Previous history of cancer" elif previous_cancer_history_y_n == 'No': previous_cancer_history_y_n = "No previous history of cancer" previous_cancer = ("No previous history of cancer", ) * 5 else: previous_cancer = (previous_cancer_history_y_n, ) * 5 type_of_cancer_list, year_diagnosis_list, treat_all, type_all, duration_all = previous_cancer data_list = [ previous_cancer_history_y_n, type_of_cancer_list, year_diagnosis_list, treat_all, type_all, duration_all ] columns_list = pccm_names.names_info(module_name) check = review_input(file_number, columns_list, data_list) return (tuple(data_list))
def ihc_data(self, block_id): module_name = "ihc_data" columns_list = names.names_biopsy_x(module_name) check = False while not check: print('Please input all data for ' + block_id + ' block only') tumour_er, tumour_er_percent, tumour_pr, tumour_pr_percent, tumour_her2, tumour_her2_grade, \ tumour_fish, tumour_ki67 = BlockDescription.ihc_report('Tumour_biopsy') fnac = ask.ask_y_n_na(question="Lymph Node biopsy FNAC", 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"]) data_list = [tumour_er, tumour_er_percent, tumour_pr, tumour_pr_percent, tumour_her2, tumour_her2_grade, tumour_fish, tumour_ki67, fnac, fnac_location, fnac_diagnosis] check = sql.review_input(self.file_number, columns_list, data_list) return data_list
def radiation (file_number, user_name): check = False while not check: radio = ask_y_n_statement.ask_y_n("Radiotherapy Recieved?") if not radio: radio = ask_y_n_statement.ask_option("Reason for not recieving radiotherapy", ["Not indicated", "Unable to afford", "Patients reluctance", "Logistic concerns"]) radio_date, radio_type, imrt, radio_tox, radio_delayed_tox, radio_finish, radio_location, radio_onco = ("NA", )*8 else: radio = "Radiation therapy recieved" radio_date = input("Date of starting radiotherapy") radio_type = ask_y_n_statement.ask_option("Type of radiotherapy", ["Cobalt", "Linear Accelerator " "based treatment", "Not known", "Other"]) imrt = ask_y_n_statement.ask_y_n_na("Did the patient opt for Intensity Modulated/3Dimensional conformal radiotherapy (" "IMRT/3DCRT)") if imrt == "Yes": imrt = "patient opted for Intensity Modulated/3Dimensional conformal radiotherapy (IMRT/3DCRT)" if imrt == "No": imrt = ask_y_n_statement.ask_option("Reasons for not opting for IMRT/3DCRT", ["Financial", "Not advised", "Not known"]) radio_tox = ask_y_n_statement.ask_option("Did radiotherapy related acute toxicity occur?", ["Yes", "No","Not known"]) if radio_tox == "Yes": radio_tox = input("Type of toxicity: ") radio_delayed_tox = ask_y_n_statement.ask_option("Did radiotherapy related delayed toxicity occur?", ["Yes", "No", "Not known"]) radio_finish = input ("Date of finishing radiotherapy: ") radio_location = input("Location of radiotherapy: ") radio_onco = ask_y_n_statement.ask_option("Name of Radiation Oncologist", ["Dr. Gautam Sharan", "Other"]) last_update = datetime.now().strftime("%Y-%b-%d %H:%M") data_list = [radio, radio_date, radio_type, imrt, radio_tox, radio_delayed_tox, radio_finish, radio_location, radio_onco, user_name, last_update] col_list =names.names_radiation() check = review_input(file_number, col_list, data_list) return data_list
def family_details(conn, cursor, file_number): module_name = "family_details" check = False while not check: marital_status = input('Marital Status :') siblings = ask_y_n_na('Siblings') if siblings == 'Yes': siblings_number = input("Number of siblings: ") sisters = input('Sisters :') brothers = input('Brothers :') elif siblings == 'No': siblings_number, sisters, brothers = "No Siblings", "0", "0" else: siblings_number, sisters, brothers = (siblings, ) * 3 children_y_n = ask_y_n_na('Children') if children_y_n == 'Yes': children_number = input("Number of children: ") daughters = input('Daughters :') sons = input('Sons :') elif children_y_n == 'No': children_number, daughters, sons = "No Children", "0", "0" else: children_number, daughters, sons = (children_y_n, ) * 3 menarche = input('Age at menarche (yrs): ') category = "Menopausal Status" options = [ "Pre-menopausal", "Peri-menopausal", "Post-Menopausal", "Other" ] menopause = ask_option(category, options) menopause_age = menopause if menopause == "Post-Menopausal": menopause_age = input('Age at menopause (yrs): ') lmp = "Last menstrual period " + menopause_age + " yrs" period_type = "NA" else: lmp = input("Date of last menstrual period: ") category = "Type of Period" options = ["Regular", "Irregular", "Other"] period_type = ask_option(category, options) number_pregnancy = input( "Number of pregnancies (enter Requires Follow-up if no data given): " ) if number_pregnancy == "0": age_first_preg, age_last_preg, number_term, number_abortion, age_first, age_last, twice_birth, \ breast_feeding_data, kid_feeding, duration_feeding, breast_usage = ('No children',) * 11 elif number_pregnancy == "Requires Follow-up": age_first_preg, age_last_preg, number_term, number_abortion, age_first, age_last, twice_birth, \ breast_feeding_data, kid_feeding, duration_feeding, breast_usage = ('Requires Follow-up',) * 11 else: number_term = input( "Pregnancy carried to term (include abortion after 6 months): " ) number_abortion = input("Number of abortions: ") age_first_preg = input("Age at first pregnancy: ") age_last_preg = "NA" try: sql = ( 'SELECT Age_at_First_Visit_yrs FROM Patient_Information_History WHERE File_number = \'' + file_number + "'") cursor.execute(sql) age = cursor.fetchall() age_mother = age[0][0] except: age_mother = input("Age at first visit to clinic") if children_number == 'No Children': age_first, age_last, twice_birth, breast_feeding_data, kid_feeding, \ duration_feeding, breast_usage = (children_number,) * 7 elif children_y_n == 'Yes': age_first = input("Age of first child: ") if age_first_preg == "NA": age_first_preg = str(int(age_mother) - int(age_first)) if int(children_number) > 1: age_last = input("Age of last child: ") age_last_preg = input("Age at last pregnancy: ") if age_last_preg == "NA": age_last_preg = str(int(age_mother) - int(age_last)) twice_birth = ask_y_n("Two births in a year (not twins)", "Two births in a year", "No two births in a year") else: age_last = age_first age_last_preg, twice_birth = ("NA", ) * 2 breast_feeding = ask_y_n("Breast feeding?") if breast_feeding: breast_feeding_data = "Breast feeding" feed_details = feed_duration(conn, cursor, file_number, children_number) else: breast_feeding_data = "No Breast feeding" feed_details = ("NA", ) * 3 kid_feeding, duration_feeding, breast_usage = feed_details else: age_first, age_last, twice_birth, breast_feeding_data, kid_feeding, \ duration_feeding, breast_usage = (children_y_n,) * 7 fert_treat_y_n = ask_y_n_na( "Have any fertility treatments ever been used") if fert_treat_y_n == 'Yes': fert_treat = "Fertility Treatment used" type_fert = input("Type of fertility treatment used: ") detail_fert = input("Details of fertility treatment used:") cycles_fert = input( "Number of cycles of fertility treatment taken: ") success_fert = ask_y_n( "Did fertility treatment result in successful pregnancy? ", "Pregnancy from Treatment", "No pregnancy from treatment") elif fert_treat_y_n == "No": fert_treat = "No Fertility Treatment used" type_fert, detail_fert, cycles_fert, success_fert = ( "No Fertility Treatment used", ) * 4 else: fert_treat, type_fert, detail_fert, cycles_fert, success_fert = ( fert_treat_y_n, ) * 5 birth_control = ask_y_n_na("Birth control used?") if birth_control == 'Yes': type_birth_control = ask_option("Type of birth control used", ["Birth control pills", "Other"]) detail_birth_control = input("Details of birth control used: ") duration_birth_control = input("Duration of birth control use: ") elif birth_control == 'No': type_birth_control, detail_birth_control, duration_birth_control = ( "No birth control used", ) * 3 else: type_birth_control, detail_birth_control, duration_birth_control = ( birth_control, ) * 3 data_list = [ marital_status, siblings_number, sisters, brothers, children_number, daughters, sons, menarche, menopause, menopause_age, lmp, period_type, number_pregnancy, number_term, number_abortion, age_first, age_first_preg, age_last, age_last_preg, twice_birth, breast_feeding_data, kid_feeding, duration_feeding, breast_usage, fert_treat, type_fert, detail_fert, cycles_fert, success_fert, type_birth_control, detail_birth_control, duration_birth_control ] columns_list = pccm_names.names_info(module_name) check = review_input(file_number, columns_list, data_list) return tuple(data_list)
def habits(file_number): module_name = "habits" check = False while not check: category = "Diet" options = ["Vegetarian", "Non-Vegetarian", "Ovo-Vegetarian", "Other"] diet = ask_option(category, options) alcohol = ask_y_n_na("Alcohol consumption") if alcohol == 'Yes': alcohol_consump = "Alcohol Consumption" alcohol_age = input( "Consumption of alcohol from which age (yrs): ") alcohol_quant = input("Quantity of alcohol consumed per week: ") alcohol_duration = input("Duration of alcohol consumption: ") alcohol_comments = input( "Additional comments for alcohol consumption: ") elif alcohol == 'No': alcohol_consump = "No Alcohol Consumption" alcohol_age, alcohol_quant, alcohol_duration, alcohol_comments = ( "No Alcohol Consumption", ) * 4 else: alcohol_consump, alcohol_age, alcohol_quant, alcohol_duration, alcohol_comments = ( alcohol, ) * 5 data_list_alc = [ diet, alcohol_consump, alcohol_age, alcohol_quant, alcohol_duration, alcohol_comments ] tobacco = ask_y_n_na("Tobacco exposure (Passive and/or Active)") if tobacco == 'Yes': tobacco = "Tobacco consumption" exposure_type = ask_option("Mode of exposure to Tobacco", ["Passive", "Active", "Other"]) if exposure_type == "Passive": tobacco_type_partic = ask_option( "Mode of passive consumption", ["Home", "Work", "Commute", "Social Interactions"]) if tobacco_type_partic == "Home": tobacco_type_who = input("What is the specific source?") tobacco_passive = tobacco_type_partic + ( " : ") + tobacco_type_who else: tobacco_passive = tobacco_type_partic else: tobacco_passive = "NA" tobacco_type = ask_option("Type of tobacco use", [ "Cigarette", "Beedi", "Gutkha", "Pan Masala", "Jarda/Maava", "Hookah", "Nicotine Patch", "Mishri", "Other" ]) tobacco_age = input( "Consumption of tobacco from which age (yrs): ") tobacco_freq = input("Frequency of tobacco consumption: ") tobacco_quant = input("Quantity of tobacco consumed per week: ") tobacco_duration = input("Duration of tobacco consumption: ") tobacco_comments = input( "Additional comments for tobacco consumption: ") elif tobacco == 'No': tobacco = "No Tobacco Consumption" exposure_type, tobacco_type, tobacco_passive, tobacco_age, tobacco_freq, tobacco_quant, tobacco_duration, \ tobacco_comments = ("No Tobacco Consumption",) * 8 else: exposure_type, tobacco_type, tobacco_passive, tobacco_age, tobacco_freq, tobacco_quant, tobacco_duration, \ tobacco_comments = (tobacco,) * 8 other_del_habits = input( "Other Deleterious Habits (if present give details): ") data_list_tob = [ tobacco, exposure_type, tobacco_passive, tobacco_type, tobacco_age, tobacco_freq, tobacco_quant, tobacco_duration, tobacco_comments, other_del_habits ] columns_list = pccm_names.names_info(module_name) data_list = data_list_alc + data_list_tob check = review_input(file_number, columns_list, data_list) return tuple(data_list)
def hormone(file_number): check = False while not check: hormone = ask_y_n_statement.ask_y_n("Hormone therapy indicated?") if not hormone: hormone = "Hormone therapy not indicated" hormone_recieved, hormone_date, hormone_type, hormone_duration, hormone_disc, hormone_ovary,hormone_outcome, \ hormone_follow_up, hormone_recur = ("NA", )*9 else: hormone = "Hormone therapy indicated" hormone_recieved = ask_y_n_statement.ask_y_n( "Was Hormone therapy recieved?") if hormone_recieved: hormone_recieved = "Hormone therapy recieved" hormone_date = input("Date of starting hormone therapy: ") hormone_type = ask_y_n_statement.ask_option( "Type of hormone therapy", [ "Tamoxifen", "Anastrazole", "Injectables", "Letrozole", "Others" ]) if hormone_type == "Injectables": details = input( "Please provide details of injectables recieved: ") hormone_type = hormone_type + ": " + details hormone_duration = input( "Duration of hormone therapy (years): ") hormone_disc = ask_y_n_statement.ask_option( "What is the current status of hormone therapy. " "Give specific reasons if discontinued prematurely " "(or not taken at all)", [ 'Therapy is ongoing', "Completion of planned course", "Adverse Effects", "Stopped by patient", "Progression of disease", "Other" ]) ovary = ask_y_n_statement.ask_y_n_na( "Has ovarian surpression been used?") if ovary == 'Yes': hormone_ovary = ask_y_n_statement.ask_option( "Type of ovarian surpression used", ["Surgery", "Drug"]) if hormone_ovary == "Drug": details = input( "Please provide details of drug used: ") hormone_ovary = hormone_ovary + ": " + details else: hormone_ovary = ovary hormone_outcome = input("Outcome of hormone therapy: ") hormone_follow_up = input("Follow up after hormone therapy: ") hormone_recur = ask_y_n_statement.ask_y_n( "Was there recurrence after hormone therapy?", "Recurrence", "No recurrence") else: hormone_recieved = "No hormone therapy recieved" hormone_date, hormone_type, hormone_duration, hormone_disc, hormone_ovary, hormone_outcome, \ hormone_follow_up, hormone_recur = ("NA", )*8 data_list = [ hormone, hormone_recieved, hormone_date, hormone_type, hormone_duration, hormone_disc, hormone_ovary, hormone_outcome, hormone_follow_up, hormone_recur ] col_list = names.names_longterm("hormone") check = review_input(file_number, col_list, data_list) return data_list
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)
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
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
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)
def node_excision(file_number): check = False while not check: surgery_guide, frozen, gross_tumour, skin, nodes, number_lymph, level_lymph, sentinel_method, sentinel_blue, \ sentinel_hot, sentinel_blue_hot, sentinel_non_blue_hot, sentinel_palpable = (" ",)*13 guide_add = True guide = [] while guide_add: surgery_guide = ask_option("Excision guided by", [ "Palpation", "USG guided", "Wire placement guided", 'Gamma camera guided', 'Clipped node' ]) guide.append(surgery_guide) guide_add = ask_y_n("Add another method to guide?") surgery_guide = "; ".join(guide) frozen_samples = ask_option_y_n( "Any samples sent for histopathology (frozen)?") if frozen_samples == 'Yes': frozen_samples = [] sn_frozen = ask_y_n( "Sentinel Node sent for histopathology (frozen)?", yes_ans="Sentinel Node") if sn_frozen == 'Sentinel Node': frozen_samples.append(sn_frozen) specimen_frozen = ask_y_n_na( "Specimen sent for histopathology (frozen)?") if specimen_frozen == 'Yes': nipple_frozen = ask_y_n_na( "Under Nipple Surface sent for histopathology (frozen)?", yes_ans='Under Nipple Surface') if nipple_frozen == 'Under Nipple Surface': frozen_samples.append(nipple_frozen) other_frozen = ask_y_n_na( "Any other specimen sent for histopathology (frozen)?") if other_frozen == 'Yes': other_frozen = input( "Type of tissue sent for histopathology (frozen): ") frozen_samples.append(other_frozen) frozen = "; ".join(frozen_samples) else: frozen = "NA" gross_tumour = input("Size of tumour on cross section (cm): ") skin = ask_option_y_n("Skin involved", yes_ans="Skin involved", no_ans="Skin not involved") nodes = ask_option("Nodes excised", [ "Sentinel Node", "Sentinel and Axillary Nodes", "Axillary Nodes only", "Other" ]) number_lymph = input("Number of lymph nodes excised (if available): ") level_lymph = ask_option( "Level of lymph node excised", ["I", "II", "III", "Data not available", "Other"]) if nodes == 'Axillary Nodes only': sentinel_method, sentinel_blue, sentinel_hot, sentinel_blue_hot, sentinel_non_blue_hot, sentinel_palpable = \ ('No Sentinel Node excised', )*6 else: sentinel_method = ask_option("Method of labelling Sentinel Node", [ "Isotope", "Blue Dye", "Isotope + Blue Dye", "Not done", "Other" ]) sentinel_blue = ask_option_y_n("Blue Node", yes_ans="Blue Node", no_ans="No Blue Node") sentinel_hot = ask_option_y_n("Hot Node", yes_ans="Hot Node", no_ans="No Hot Node") sentinel_blue_hot = ask_option_y_n("Blue Hot Node", yes_ans="Blue Hot Node", no_ans="No Blue Hot Node") sentinel_non_blue_hot = ask_option_y_n( "Non Blue, Hot Node", yes_ans="Non Blue, Hot Node", no_ans="No Non Blue, Hot Node") sentinel_palpable = ask_option_y_n("Palpable Node", yes_ans="Palpable Node", no_ans="No Palpable Node") data_list = [ surgery_guide, frozen, gross_tumour, skin, nodes, number_lymph, level_lymph, sentinel_method, sentinel_blue, sentinel_hot, sentinel_blue_hot, sentinel_non_blue_hot, sentinel_palpable ] col_list = names("node_excision") check = add_update_sql.review_input(file_number, col_list, data_list) return data_list