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 db_dict(table, module): db_tables = { "Patient_Information_History": names.names_info(module), "Biopsy_Report_Data": names.names_biopsy_new(module), "Radiology": names.names_radio(module), "Neo_Adjuvant_Therapy": names.names_nact(module), "Surgery_Report": names.names_surgery_information(module), "Surgery_Block_Report_Data": names.names_surgery(module), "Adjuvant_ChemoTherapy": names.names_chemotherapy(module), "Radiotherapy": names.names_radiation(), "HormoneTherapy_Survival": names.names_longterm(module), "Follow_up_Data": names.name_follow_up() } cols = db_tables.get(table) return cols
def db_dict(table, module): db_tables = { "patient_information_history": names.names_info(module), "radiology": names.names_radio(module), 'pet_reports': names.names_pet(module), 'biopsy_path_report_data': names.names_biopsy(module), "neo_adjuvant_therapy": names.names_nact(module), "surgery_report": names.names_surgery_information(module), 'surgery_path_report_data': names.names_surgery(module), "adjuvant_chemotherapy": names.names_chemotherapy(module), "radiotherapy": names.names_radiation(), "hormonetherapy_survival": names.names_longterm(module), "follow_up_data": names.name_follow_up(), 'block_list': names.block_list(module) } cols = db_tables.get(table) return cols
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
path = os.path.join(folder, db_name) conn_all = sqlite3.connect(path) cursor_all = conn_all.cursor() file_number = "File_number" table = "Patient_Information_History" if table_check(cursor_all, table) == 0: cursor_all.execute('CREATE TABLE {tn}({nf})'\ .format(tn=table, nf=file_number)) module_names = ["bio_info", "phys_act", "habits", "nut_supplements", "family_details", "med_history", "cancer_history", "family_cancer", "det_by", "breast_symptoms"] for index in module_names: col_name = pccm_names.names_info(index) add_columns(cursor_all, table, col_name) table = "Radiotherapy" if table_check(cursor_all, table) == 0: column = ", ".join(pccm_names.names_radiation()) cols_file = "File_number, "+column cursor_all.execute('CREATE TABLE {tn}({nf})'.format(tn=table, nf=cols_file)) table = "Follow_up_Data" if table_check(cursor_all, table) == 0: column = ", ".join(pccm_names.name_follow_up()) cols_file = "File_number, " + column cursor_all.execute('CREATE TABLE {tn}({nf})'.format(tn=table, nf=cols_file)) table = "HormoneTherapy_Recurrence_Survival" if table_check(cursor_all, table) == 0: column = "File_number" cursor_all.execute('CREATE TABLE {tn}({nf})'.format(tn=table, nf=column)) module_names = ["hormone", "metastasis"] for index in module_names:
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)
import pandas as pd import modules.pccm_names as names import os import sqlite3 folders = 'D:/repos/pccm_db/main/DB/from_linux' file = "PCCM_BreastCancerDB_all_data.db" ex_file = 'Output_radiology_12062018.xlsx' path = os.path.join(folders, file) ex_path = os.path.join(folders, ex_file) conn = sqlite3.connect(path) table = "Radiotherapy" col_list = ["File_number"] + names.names_radiation() sql = ('SELECT ' + ", ".join(col_list[:-2]) + " FROM '" + table + "'") df = pd.read_sql(sql, conn) writer = pd.ExcelWriter(ex_path, engine='xlsxwriter') df.to_excel(writer, sheet_name=table) table = "HormoneTherapy_Recurrence_Survival" col_list = [ "File_number" ] + names.names_longterm("hormone") + names.names_longterm("metastasis") sql = ('SELECT ' + ", ".join(col_list[:-2]) + " FROM '" + table + "'") df = pd.read_sql(sql, conn) df.to_excel(writer, sheet_name="Hormone_RecurrenceSurvival") table = "Follow_up_Data" col_list = ["File_number"] + names.name_follow_up() sql = ('SELECT ' + ", ".join(col_list[:-2]) + " FROM '" + table + "'") df = pd.read_sql(sql, conn)