def edit_data(conn, cursor, file_number, user_name): table = "Radiotherapy" col_list = names.names_radiation() enter = review_data(conn, cursor, table, file_number, col_list) if enter: data = radiation(file_number, user_name) update_multiple(conn, cursor, table, col_list, file_number, data)
def edit_data(self): print(self.print_statements[0]) col_list = names(self.module_list[0]) enter = sql.review_data_key(self.conn, self.cursor, self.table_name, key_name='fk', key_value=self.fk, columns=col_list, col_name='surgery_block_id', col_value=self.surgery_block_id) if enter: data = self.surgery_block_information_0() sql.update_multiple(self.conn, self.cursor, self.table_name, col_list, self.file_number, data) print(self.print_statements[1]) col_list = names(self.module_list[1]) enter = sql.review_data_key(self.conn, self.cursor, self.table_name, key_name='fk', key_value=self.fk, columns=col_list, col_name='surgery_block_id', col_value=self.surgery_block_id) if enter: data, block_desc_df = self.surgery_block_information_1 sql.update_multiple_key(self.conn, self.cursor, self.table_name, col_list, key_name='fk', key_value=self.fk, data=data) block_desc_df.to_sql("block_data", self.conn, index=False, if_exists="append") print(self.print_statements[2]) col_list = names(self.module_list[2]) enter = sql.review_data_key(self.conn, self.cursor, self.table_name, key_name='fk', key_value=self.fk, columns=col_list, col_name='surgery_block_id', col_value=self.surgery_block_id) if enter: data = self.surgery_block_information_2() sql.update_multiple_key(self.conn, self.cursor, self.table_name, col_list, key_name='fk', key_value=self.fk, data=data) print(self.print_statements[3]) col_list = names(self.module_list[3]) enter = sql.review_data_key(self.conn, self.cursor, self.table_name, key_name='fk', key_value=self.fk, columns=col_list, col_name='surgery_block_id', col_value=self.surgery_block_id) if enter: data = self.surgery_block_information_3() sql.update_multiple_key(self.conn, self.cursor, self.table_name, col_list, key_name='fk', key_value=self.fk, data=data)
def cancer_table(conn, cursor, file_number): table_cancer = "Previous_Cancer_History" type_of_cancer_list = [] year_diagnosis_list = [] treat_all = [] type_all = [] duration_all = [] data_return = [] add_cancer = True while add_cancer: type_of_cancer = input("Type of Cancer: ") type_of_cancer_list.append(type_of_cancer) year_diagnosis = input("Year of diagnosis: ") year_diagnosis_list.append(year_diagnosis) col = ("File_number, Type_Cancer, Year_diagnosis") data = file_number, type_of_cancer, year_diagnosis insert(conn, cursor, table_cancer, col, data) print("Please enter the type of treatment used: ") treatment = [ "Surgery", "Radiation", "Chemotherapy", "Hormone", "Alternative", "HomeRemedy" ] treat_list = [] type_list = [] duration_list = [] treated, type, duration = ("NA", ) * 3 for index in treatment: treat = ask_y_n(index) if treat: treat_list.append(index) type_treat = input("Type of " + index) type_list.append(type_treat) duration_treat = input("Duration of " + index) duration_list.append(duration_treat) data = index, type_treat, duration_treat columns = [index, ("Type_" + index), ("Duration_" + index)] treated = "; ".join(treat_list) type = "; ".join(type_list) duration = "; ".join(duration_list) update_multiple(conn, cursor, table_cancer, columns, file_number, data) elif not treat: index_no = "No " + index type_treat, duration_treat = ("NA", ) * 2 data = index_no, type_treat, duration_treat columns = [index, ("Type_" + index), ("Duration_" + index)] update_multiple(conn, cursor, table_cancer, columns, file_number, data) treat_all.append(treated) type_all.append(type) duration_all.append(duration) add_cancer = ask_y_n("Additional cancer history") all_data = [ type_of_cancer_list, year_diagnosis_list, treat_all, type_all, duration_all ] for index in all_data: data_joint = "|".join(index) data_return.append(data_joint) return tuple(data_return)
def cancer_table(conn, cursor, file_number): table_cancer = "previous_cancer_history" type_of_cancer_list = [] year_diagnosis_list = [] treat_all = [] type_all = [] duration_all = [] data_return = [] add_cancer = True while add_cancer: type_of_cancer = input("Type of Cancer: ") type_of_cancer_list.append(type_of_cancer) year_diagnosis = input("Year of diagnosis: ") year_diagnosis_list.append(year_diagnosis) col = ("File_number, Type_Cancer, Year_diagnosis") data = file_number, type_of_cancer, year_diagnosis sql.insert(conn, cursor, table_cancer, col, data) print("Please enter the type of treatment used: ") treat_list = [] type_list = [] duration_list = [] treated, type, duration = ("NA", ) * 3 for treatment in PatientInfo.previous_cancer_treatment: treat = ask_y_n(treatment) if treat: treat_list.append(treatment) type_treat = input("Type of " + treatment) type_list.append(type_treat) duration_treat = input("Duration of " + treatment) duration_list.append(duration_treat) data = treatment, type_treat, duration_treat columns = [ treatment, ("type_" + treatment), ("duration_" + treatment) ] treated = "; ".join(treat_list) type = "; ".join(type_list) duration = "; ".join(duration_list) sql.update_multiple(conn, cursor, table_cancer, columns, file_number, data) elif not treat: index_no = "No " + treatment type_treat, duration_treat = ("NA", ) * 2 data = index_no, type_treat, duration_treat columns = [ treatment, ("type_" + treatment), ("duration_" + treatment) ] sql.update_multiple(conn, cursor, table_cancer, columns, file_number, data) treat_all.append(treated) type_all.append(type) duration_all.append(duration) add_cancer = ask_y_n("Additional cancer history") all_data = [ type_of_cancer_list, year_diagnosis_list, treat_all, type_all, duration_all ] for index in all_data: data_joint = "|".join(index) data_return.append(data_joint) return tuple(data_return)
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)
def add_data(conn, cursor, file_number, user_name): table = "radiology" #file_row(cursor, file_number) enter = ask_y_n("Enter Mammography Report?") if enter: data = mammography(conn, cursor, file_number) add_update_sql.update_multiple(conn, cursor, table, names("mammography"), file_number, data) enter = ask_y_n("Enter 3D Tomosynthesis?") if enter: data = tomosynthesis(file_number) add_update_sql.update_multiple(conn, cursor, table, names("tomosynthesis"), 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(conn, cursor, file_number) 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(conn, cursor, file_number, user_name) add_update_sql.update_multiple(conn, cursor, table, names("mri_breast"), file_number, data)
def edit_data(self): table = "neo_adjuvant_therapy" enter = sql.review_data(self.conn, self.cursor, table, self.file_number, names(table)) if enter: sql.delete_rows(self.cursor, 'nact_drug_table', "file_number", self.file_number) sql.delete_rows(self.cursor, 'nact_tox_table', "file_number", self.file_number) data = self.nact_test() data_sql, drug_table, tox_response = data sql.update_multiple(self.conn, self.cursor, table, names(table), self.file_number, data_sql) drug_table.to_sql("nact_drug_table", self.conn, index=False, if_exists="append") tox_response.to_sql("nact_tox_table", self.conn, index=False, if_exists="append") print("clip information") module = "clip_information" col_list = names(module) enter = sql.review_data(self.conn, self.cursor, table, self.file_number, col_list) if enter: data = self.clip_information() sql.update_multiple(self.conn, self.cursor, table, col_list, self.file_number, data)
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)
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)
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)
def add_data(conn, cursor, file_number, user_name): #file_row(cursor, file_number) table = "hormonetherapy_survival" enter = ask.ask_y_n("Enter Hormone Therapy Details?") if enter: col_list = names.names_longterm(module_name="hormone") data = hormone(file_number) update_multiple(conn, cursor, table, col_list, file_number, data) enter = ask.ask_y_n("Enter Recurrence and follow-up status?") if enter: col_list = names.names_longterm(module_name="metastasis") data = metastasis(file_number, user_name) update_multiple(conn, cursor, table, col_list, file_number, data)
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")
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)
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)
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: tables = ['Calcification_Mammography', 'Mammography_Multiple_Mass'] for i in tables: add_update_sql.delete_multiple(cursor, i, file_number) data = mammography(conn, cursor, file_number) add_update_sql.update_multiple(conn, cursor, table, col_list, file_number, data) print("3D-Tomosynthesis") col_list = names("tomosynthesis") enter = add_update_sql.review_data(conn, cursor, table, file_number, col_list) if enter: data = tomosynthesis(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: add_update_sql.delete_multiple(cursor, 'SonnoMammography_Multiple_Mass', file_number) data = sonomammo(conn, cursor, file_number) 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: add_update_sql.delete_multiple(cursor, 'MRI_Multiple_Mass', file_number) data = mri_breast(conn, cursor, file_number, user_name) add_update_sql.update_multiple(conn, cursor, table, col_list, file_number, data)
def edit_data(conn, cursor, file_number, user_name): table = "hormonetherapy_survival" print("Hormone Therapy Details") col_list = names.names_longterm(module_name="hormone") enter = review_data(conn, cursor, table, file_number, col_list) if enter: data = hormone(file_number) update_multiple(conn, cursor, table, col_list, file_number, data) print("Recurrence and follow-up status") col_list = names.names_longterm(module_name="metastasis") enter = review_data(conn, cursor, table, file_number, col_list) if enter: data = metastasis(file_number, user_name) update_multiple(conn, cursor, table, col_list, file_number, data)
def add_data(conn, cursor, file_number, user_name): table = "clinical_exam" #file_row(cursor, file_number) enter = ask.ask_y_n("Enter Clinical Examination information") if enter: data = clinical_exam_initial(file_number, user_name) add_update_sql.update_multiple( conn, cursor, table, pccm_names.name_clinical("clinical_exam_initial"), file_number, data) enter = ask.ask_y_n("Enter Nipple Cytology report?") if enter: data = nipple_cytology(file_number) add_update_sql.update_multiple( conn, cursor, table, pccm_names.name_clinical("nipple_cytology"), file_number, data)
def edit_data(conn, cursor, file_number, user_name): table = "clinical_exam" print("Initial Clinical Examination") col_list = pccm_names.name_clinical("clinical_exam_initial") enter = add_update_sql.review_data(conn, cursor, table, file_number, col_list) if enter: data = clinical_exam_initial(file_number, user_name) add_update_sql.update_multiple(conn, cursor, table, col_list, file_number, data) print("Nipple Cytology") col_list = pccm_names.name_clinical("nipple_cytology") enter = add_update_sql.review_data(conn, cursor, table, file_number, col_list) if enter: data = nipple_cytology(file_number) add_update_sql.update_multiple(conn, cursor, table, col_list, file_number, data)
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")
def edit_data(conn, cursor, file_number, user_name): table = "patient_information_history" print("Patient Biographical Information") col_list = pccm_names.names_info("bio_info") enter = review_data(conn, cursor, table, file_number, col_list) if enter: data = bio_info(file_number) update_multiple(conn, cursor, table, col_list, file_number, data) col_list = pccm_names.names_info("phys_act") + pccm_names.names_info( "habits") + pccm_names.names_info("nut_supplements") print("Patient habits") enter = review_data(conn, cursor, table, file_number, col_list) if enter: data_phys = phys_act(conn, cursor, file_number) data_hab = habits(file_number) data_nut = nut_supplements(conn, cursor, file_number) data = data_phys + data_hab + data_nut update_multiple(conn, cursor, table, col_list, file_number, data) print("Patient family and reproductive details") col_list = pccm_names.names_info("family_details") enter = review_data(conn, cursor, table, file_number, col_list) if enter: data = family_details(conn, cursor, file_number) update_multiple(conn, cursor, table, col_list, file_number, data) print("Patient and family medical history") col_list = pccm_names.names_info("med_history") + pccm_names.names_info( "cancer_history") + pccm_names.names_info("family_cancer") enter = review_data(conn, cursor, table, file_number, col_list) if enter: data_med = med_history(conn, cursor, file_number) data_can = cancer_history(conn, cursor, file_number) data_fam = family_cancer(conn, cursor, file_number) data = data_med + data_can + data_fam update_multiple(conn, cursor, table, col_list, file_number, data) print("Patient Symptoms") col_list = pccm_names.names_info("det_by") + pccm_names.names_info( "breast_symptoms") enter = review_data(conn, cursor, table, file_number, col_list) if enter: data_det = det_by(file_number) data_symp = breast_symptoms(file_number, user_name) data = data_det + data_symp update_multiple(conn, cursor, table, col_list, file_number, data) print_info(cursor, file_number)
def other_symp(conn, cursor, file_number, table): import sql.add_update_sql as sql add_symp = True all_data = [] while add_symp: other_symp = input("Type of symptom: ") symp_breast_right = input("Right Breast y/n: ") if str.lower(symp_breast_right) == "y": symp_breast_right = other_symp symp_duration_right = input( "Duration of symptoms in right breast: ") else: symp_breast_right = None symp_duration_right = None symp_breast_left = input("Left Breast y/n: ") if str.lower(symp_breast_left) == "y": symp_breast_left = other_symp symp_duration_left = input("Duration of symptoms in left breast: ") else: symp_breast_left = None symp_duration_left = None RB = [symp_breast_right, symp_duration_right] LB = [symp_breast_left, symp_duration_left] data = [RB, LB] all_data.append(data) add_symp = ask.ask_y_n("Include more symptoms?") rb = get_rb_lb(all_data, 0) rb_symp = list(filter(None, get_rb_lb(rb, 0))) rb_dur = list(filter(None, get_rb_lb(rb, 1))) lb = get_rb_lb(all_data, 1) lb_symp = list(filter(None, get_rb_lb(lb, 0))) lb_dur = list(filter(None, get_rb_lb(lb, 1))) data = [rb_symp, rb_dur, lb_symp, lb_dur] for index in range(0, len(data)): if not data[index]: data[index] = ["No other symptoms"] else: data[index] = ["; ".join(data[index])] data_flat = [item for sublist in data for item in sublist] new_data = tuple(data_flat) columns = "RB_Other_Symptoms", "RB_Other_Symptoms_duration", "LB_Other_Symptoms", "RB_Other_Symptoms_duration" sql.update_multiple(conn, cursor, table, columns, file_number, new_data) return (new_data)
def add_data(self): table = "neo_adjuvant_therapy" data = self.nact_test() data_sql, drug_table, tox_response = data sql.update_multiple(self.conn, self.cursor, table, names(table), self.file_number, data_sql) drug_table.to_sql("nact_drug_table", self.conn, index=False, if_exists="append") tox_response.to_sql("nact_tox_table", self.conn, index=False, if_exists="append") enter = ask.ask_y_n("Input Clip Information") if enter: data = self.clip_information() col_list = names("clip_information") sql.update_multiple(self.conn, self.cursor, table, col_list, self.file_number, data)
def edit_data(conn, cursor, file_number, user_name): table = "surgery_seport" 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)
def add_data(self, old_col, df): if df is not None: dat_rows = df.shape[0] print(df.shape) # joinDb = JoinDB(db_new=self.dB_path, db_old=self.dB_path, # table=self.table) # file_list = join_db.add_file_number() for row in range(dat_rows): dat = list(df.loc[row]) file_number = dat[0] print(file_number) dat_add = dat[1:] print(dat_add) sql.add_pk_fk_to_table(self.conn, self.cursor, self.table, col_name='file_number', pk=file_number) sql.update_multiple(self.conn, self.cursor, self.table, columns=old_col, file_number=file_number, data=dat_add)
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)
def add_data(conn, cursor, file_number, user_name): table = "surgery_seport" #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)
def edit_data(conn, cursor, file_number, user_name): table = "Clinical_Exam" print("Initial Clinical Examination") col_list = pccm_names.name_clinical("clinical_exam_initial") enter = add_update_sql.review_data(conn, cursor, table, file_number, col_list) if enter: data = clinical_exam_initial(file_number, user_name) add_update_sql.update_multiple(conn, cursor, table, col_list, file_number, data) print("Nipple Cytology") col_list = pccm_names.name_clinical("nipple_cytology") enter = add_update_sql.review_data(conn, cursor, table, file_number, col_list) if enter: data = nipple_cytology(file_number) add_update_sql.update_multiple(conn, cursor, table, col_list, file_number, data) print("Other Tests (USG Abdomen, PET Scan, Bone Scan, CECT Abdomen and Thorax)") col_list = pccm_names.name_clinical("other_test") enter = add_update_sql.review_data(conn, cursor, table, file_number, col_list) if enter: data = other_test(file_number) add_update_sql.update_multiple(conn, cursor, table, col_list, file_number, data)
def add_data(conn, cursor, file_number, user_name): table = "Radiotherapy" col_list = names.names_radiation() data = radiation(file_number, user_name) update_multiple(conn, cursor, table, col_list, file_number, data)
def cal_table(file_number, conn, cursor): import helper_function.ask_y_n_statement as ask import sql.add_update_sql as add_update_sql import helper_function.pccm_names as pccm_names table = "Calcification_Mammography" mass_number = int(input("Number of groups of calcifications detected? ")) location, quad, depth, dist, pect, type, calc_type, calc_diag, distribution = [ list([]) for _ in range(9) ] for index in range(0, mass_number): check = False while not check: mass_id = index + 1 mass_location = ask_y_n_statement.ask_option( "Location of calcification group " + str(mass_id), ["Right Breast", "Left Breast"]) location.append(mass_location) location_quad = lesion_location(mass_location) quad.append(location_quad) calc_depth = ask_y_n_statement.ask_option( "Depth of group " + str(mass_id), ["Anterior", "Middle", "Posterior", "Other"]) calc_dist = ask_y_n_statement.ask_option( "Distance from nipple of group " + str(mass_id), ["<0.5 cm", ">0.5 cm", "Other"]) pect_check = ask_y_n_statement.ask_y_n( "Is distance from Pectoralis Major described for group " + str(mass_id)) if pect_check: calc_pect = input( "Distance from Pectoralis Major (cm) of group " + str(mass_id) + ": ") else: calc_pect = "NA" depth.append(calc_depth) dist.append(calc_dist) pect.append(calc_pect) mammo_calcification = ask_y_n_statement.ask_option( "Calcification Type", [ "Skin", "Vascular", "Coarse or 'Popcorn-like'", "Large Rod-like", "Round and punctate", "Eggshell or Rim", "Dystrophic", "Suture", "Amorphous", "Coarse Heterogeneous", "Fine Pleomorphic", "Fine Linear or Fine Linear Branching", "Other" ]) calc_type.append(mammo_calcification) if mammo_calcification in { "Skin", "Vascular", "Coarse or 'Popcorn-like'", "Large Rod-like", "Round and punctate", "Eggshell or Rim", "Dystrophic", "Suture" }: mammo_calcification_type = "Typically Benign" print("Calcification Type is " + mammo_calcification_type) check = ask_y_n_statement.ask_y_n( "Is Calcification type correct?") elif mammo_calcification in { "Amorphous", "Coarse Heterogeneous", "Fine Pleomorphic", "Fine Linear or Fine Linear Branching" }: mammo_calcification_type = "Suspicious Morphology" print("Calcification Type is " + mammo_calcification_type) check = ask_y_n_statement.ask_y_n( "Is Calcification type correct?") else: mammo_calcification_type = input("Calcification type " + mammo_calcification + "? ") if not check: mammo_calcification_type = input("Calcification type " + mammo_calcification + "? ") calc_diag.append(mammo_calcification_type) mammo_calcification_distribution = ask_y_n_statement.ask_option( "Distribution of calcification", ["Diffuse", "Regional", "Grouped", "Linear", "Segmental"]) distribution.append(mammo_calcification_distribution) mass_id = "Group " + str(index + 1) data_list = [ file_number, mass_id, mass_location, location_quad, calc_depth, calc_dist, calc_pect, mammo_calcification, mammo_calcification_type, mammo_calcification_distribution ] col_list = pccm_names.names_radio(table) check = add_update_sql.review_input(file_number, col_list, data_list) add_update_sql.update_multiple(conn, cursor, table, col_list, file_number, data_list) all_data = [[str(mass_number)], location, quad, depth, dist, pect, calc_type, calc_diag, distribution] data_return = ask_y_n_statement.join_lists(all_data, "; ") return tuple(data_return)
def add_gen_info(conn, cursor, file_number, user_name, folders): table = "Patient_Information_History" #file_row(cursor, file_number) enter = ask_y_n("Enter Patient Biographical Information") if enter: data = bio_info(file_number) update_multiple(conn, cursor, table, pccm_names.names_info("bio_info"), file_number, data) enter = ask_y_n("Enter Patient habits") if enter: data = phys_act(conn, cursor, file_number) update_multiple(conn, cursor, table, pccm_names.names_info("phys_act"), file_number, data) data = habits(file_number) update_multiple(conn, cursor, table, pccm_names.names_info("habits"), file_number, data) data = nut_supplements(conn, cursor, file_number) update_multiple(conn, cursor, table, pccm_names.names_info("nut_supplements"), file_number, data) enter = ask_y_n("Enter Patient family and reproductive details?") if enter: data = family_details(conn, cursor, file_number) update_multiple(conn, cursor, table, pccm_names.names_info("family_details"), file_number, data) enter = ask_y_n("Enter Patient medical history?") if enter: data = med_history(conn, cursor, file_number) update_multiple(conn, cursor, table, pccm_names.names_info("med_history"), file_number, data) data = cancer_history(conn, cursor, file_number) update_multiple(conn, cursor, table, pccm_names.names_info("cancer_history"), file_number, data) enter = ask_y_n("Enter patient family cancer history") if enter: data = family_cancer(conn, cursor, file_number) update_multiple(conn, cursor, table, pccm_names.names_info("family_cancer"), file_number, data) enter = ask_y_n("Enter Patient Symptoms?") if enter: data = det_by(file_number) update_multiple(conn, cursor, table, pccm_names.names_info("det_by"), file_number, data) data = breast_symptoms(file_number, user_name) update_multiple(conn, cursor, table, pccm_names.names_info("breast_symptoms"), file_number, data) print_info(cursor, file_number, folders)