예제 #1
0
def cal_table(file_number, mammo_breast):
    import helper_function.pccm_names as pccm_names
    table = "calcification_mammography"
    mass_number = gf.get_number_lt(1, 3)
    try:
        number_calc = int(mass_number)
    except ValueError:
        number_calc = 1
    location, calc_type, calicification_comments = [list([]) for _ in range(3)]
    for index in range(0, number_calc):
        mass_id = index + 1
        if mammo_breast == "Bilateral":
            mass_location = gf.get_choice(["Right Breast", "Left Breast"])
        else:
            mass_location = mammo_breast
        location.append(mass_location)
        mammo_calcification = gf.get_choice([
            "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)
        mass_id = "Group " + str(index + 1)
        comment = 'na'
        calicification_comments.append(comment)
        data_list = [
            file_number, mass_id,
            str(mass_location), mammo_calcification, comment
        ]
        col_list = pccm_names.names_radio_mass(table)
    all_data = [[str(mass_number)], location, calc_type,
                calicification_comments]
    data_return = ask.join_lists(all_data, "; ")
    return tuple(data_return)
def feed_duration(file_number, children_number):
    table = "breast_feeding"
    child_list, feeding_duration_list, feeding_details_list = [], [], []
    child_number = int(children_number)
    for index in range(0, child_number):
        kid = str(index + 1)
        kid_add = "Child " + kid
        child_list.append(kid_add)
        feeding_duration = str(gf.get_number_lt(1, 36))
        feeding_duration_list.append(feeding_duration)
        feeding_details = gf.get_choice(PatientInfo.breast_feeding)
        feeding_details_list.append(feeding_details)
    data_list = [child_list, feeding_duration_list, feeding_details_list]
    data_return = join_lists(data_list, "; ")
    return (data_return)
def feed_duration(conn, cursor, file_number, children_number):
    table = "breast_feeding"
    child_list, feeding_duration_list, feeding_details_list = [], [], []
    child_number = int(children_number)
    for index in range(0, child_number):
        kid = str(index + 1)
        kid_add = "Child " + kid
        child_list.append(kid_add)
        feeding_duration = input("Breast feeding duration for " + kid_add +
                                 " (months) ?")
        feeding_duration_list.append(feeding_duration)
        feeding_details = ask_option("Breast feeding for child " + kid,
                                     PatientInfo.breast_feeding)
        feeding_details_list.append(feeding_details)
        columns = 'file_number, child_number, feeding_duration, breast_usage_feeding'
        data = file_number, kid, feeding_duration, feeding_details
        sql.insert(conn, cursor, table, columns, data)
    data_list = [child_list, feeding_duration_list, feeding_details_list]
    data_return = join_lists(data_list, "; ")
    return (data_return)
예제 #4
0
def cal_table(file_number, mammo_breast):
    import helper_function.pccm_names as pccm_names
    table = "calcification_mammography"
    mass_number = ask.check_number_input("Number of groups of calcifications"
                                         " detected? ", error='Please enter'
                                         'number of calcification groups'
                                         'detected only')
    try:
        number_calc = int(mass_number)
    except ValueError:
        number_calc = 1
    location, calc_type, calicification_comments = [list([]) for _ in range(3)]
    for index in range(0, number_calc):
        check = False
        while not check:
            mass_id = index + 1
            if mammo_breast == "Bilateral":
                mass_location = ask.ask_option("Location of calcification"
                                               "group " + str(mass_id),
                                               ["Right Breast", "Left Breast"])
            else:
                mass_location = mammo_breast
            location.append(mass_location)
            mammo_calcification = ask.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)
            mass_id = "Group " + str(index + 1)
            comment = input('Additional comments for calcification: ')
            calicification_comments.append(comment)
            data_list = [file_number, mass_id, str(mass_location),
                         mammo_calcification, comment]
            col_list = pccm_names.names_radio_mass(table)
            check = sql.review_input(file_number, col_list, data_list)
    all_data = [[str(mass_number)], location, calc_type,
                calicification_comments]
    data_return = ask.join_lists(all_data, "; ")
    return tuple(data_return)

    @staticmethod
    def lesion_size():
        mass_size = ask.check_size_input("Mass dimensions (without unit): ")
        mass_size_unit = 'NA'
        if mass_size != 'NA':
            mass_size_unit = ask.ask_list("Mass dimensions unit: ",
                                          RadioTables.mass_units)
        mass_name = "lesion_" + str(mass_id)
        mass_dimension, mass_longest_dimension = mass_size
        mass_longest_dimension = ask.convert_mm_to_cm(
                                 mass_longest_dimension, mass_size_unit)
        return mass_size, mass_size_unit, mass_longest_dimension
예제 #5
0
def post_surgery(file_number, user_name):
    check = False
    while not check:
        check_drain = ask_y_n('Was drain inserted post surgery?')
        drain, total_drain = ('No drain used', )*2
        if check_drain:
            drain = input("Drain removal date: ")
            total_drain = input("Total drain days: ")
        post_comp = ask_y_n("Did post-surgery complications occur?")
        if post_comp:
            df_complications_col = ["Day", "Complication", "Treatment"]
            df_complications = pd.DataFrame(columns = df_complications_col)
            day_add = True
            index = 0
            while day_add:
                comp =surgery_tables.surg_complications("post_surgery_comp")
                day = "Day "+input("Days post surgery: ")
                treatment_list = []
                complication = []
                for i in comp:
                    data = ask_y_n("On "+str(day)+ " did post surgery complication "+i+" occur?")
                    if data:
                        complication.append(i)
                        treatment = ask_option("What treatment was done for "+str(i),
                                               surgery_tables.surg_complications("surgical_treatment"))
                        if treatment == 'Non surgical treatment':
                            treatment = input ("What type of non surgical treatment was used?")
                        else:
                            treatment = "Surgical treatment - "+ treatment
                        treatment_list.append(treatment)
                complication= "; ".join(complication)
                treatment_list = "; ".join(treatment_list)
                data = [day, complication, treatment_list]
                df_complications.loc[index] = data
                index = index + 1
                day_add = ask_y_n("Add another day for post surgery complications? ")
            all_data = []
            for index in df_complications_col:
                data = "; ".join(list(df_complications.loc[:, index]))
                all_data.append(data)
            days, complications, treatments = all_data
        else:
            days, complications, treatments = ("No post surgical complications", )*3
        chemo = ask_option_y_n("Is chemotherapy planned?", "Chemotherapy planned", "No Chemotherapy")
        radio = ask_option_y_n("Is radiotherapy planned?", "RadiotherapyOptions planned", "No RadiotherapyOptions")
        other = ask_option_y_n("Are there any other post-surgery plans")
        if other == 'Yes':
            other = input("Please specify other post-surgery plans: ")
        elif other == 'No':
            other = "No other post surgery plans"
        recur = ask_option_y_n("Did recurrence occur post surgery?")
        if recur == 'Yes':
            recurs = []
            days_recurs = []
            late_add = True
            recur = surgery_tables.surg_complications("recurrence_sites")
            while late_add:
                day = "Day " + input("Days post surgery: ")
                for i in recur:
                    data = ask_y_n("On " + str(day) + " did " + i + " recurrence occur?")
                    if data:
                        recurs.append(i)
                if recurs == []:
                    recurs = "No recurrence post surgery"
                days_recurs.append(day)
                late_add = ask_y_n("Add another day for post surgery recurrence? ")
            all_data = [days_recurs, recurs]
            days_recurs, recurs = join_lists(all_data, "; ")
        elif recur == 'No':
            days_recurs, recurs = ("No recurrence post surgery",) * 2
        else:
            days_recurs, recurs = (recur,) * 2
        opd = input("Please input OPD notes (if any): ")
        data_list = [chemo, radio, other,drain, total_drain, days, complications, treatments, days_recurs, recurs, opd,
                     user_name, add_update_sql.last_update()]
        col_list = names("post_surgery")
        check = add_update_sql.review_input(file_number, col_list, data_list)
    return data_list
예제 #6
0
 def nact_test(self):
     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)
     nact_status, place_nact, details_nact, plan_nact, date_start_nact,
     patient_weight_nact, nact_drugs_administered, number_cycles_nact,
     cycle_weekly_frequency, drugs_totaldose, drugs_unit, toxicity_type,
     toxicity_grade, toxicity_treatment, toxicity_response,
     nact_change_due_to_toxicity, tumour_response_check_method,
     tumour_response_nact, tumour_size, tumour_size_unit,
     date_tumour_size_checked, nact_response_impression,
     nact_response_node, nact_completion_status, nact_end_date,
     trastuzumab_use_nact, trastuzumab_regime_nact,
     trastuzumab_courses_taken_nact, hormone_therapy_nact,
     hormone_therapy_type_nact, hormone_therapy_duration,
     horomone_therapy_side_effects = [
         'NA',
     ] * 33
     data_list = [
         'NA',
     ] * 30 + [self.user_name, sql.last_update()]
     check = False
     while not check:
         nact_status = ask.ask_y_n_na(
             "Has neo adjuvant therapy been done for the patient (Please check for chemotherapy and/hormone therapy)?"
         )
         if nact_status == 'Yes':
             place_nact = ask.ask_y_n_na(
                 "Has neo adjuvant therapy been done at PCCM?", "At PCCM",
                 "Outside", "Not Certain, requires follow-up")
             details_nact = ask.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_weight_nact, nact_drugs_administered, number_cycles_nact, cycle_weekly_frequency, drugs_totaldose, drugs_unit, toxicity_type, toxicity_grade, toxicity_treatment, toxicity_response, toxicity_at_cycle, nact_change_due_to_toxicity, tumour_response_check_method, tumour_response_nact, tumour_size, tumour_size_unit, date_tumour_size_checked, nact_response_impression, nact_response_node, nact_completion_status, nact_end_date, trastuzumab_use_nact, trastuzumab_regime_nact, trastuzumab_courses_taken_nact, hormone_therapy_nact, hormone_therapy_type_nact, hormone_therapy_duration, dhoromone_therapy_side_effects = (
                     details_nact, ) * 30
             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.check_date(
                     "Date of starting neo-adjuvant therapy: ")
                 patient_weight_nact = input(
                     "Weight of patient at start of therapy (in kgs): ")
                 check_wt = ask.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_weight_nact = patient_weight_nact + "; " + other_wt
                     check_wt = ask.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 = col_drug[1:]
                 data_drug_list = []
                 for index in data_drug:
                     data_drug = "; ".join(list(drug_admin.loc[:, index]))
                     data_drug_list.append(data_drug)
                 nact_drugs_administered, number_cycles_nact, cycle_weekly_frequency, drugs_totaldose, drugs_unit\
                     = data_drug_list
                 toxicity = tox_table(file_number, nact_drugs_administered,
                                      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.join_lists(tox_details, "; ")
                 print(tox_details)
                 file_number, nact_drugs_administered, toxicity_type, toxicity_grade, toxicity_treatment, toxicity_response, \
                     toxicity_at_cycle, nact_change_due_to_toxicity = tox_details
                 tumour_response_check_method = ask.ask_option(
                     "Response to NACT measured by",
                     ['Mammography', 'SonoMammography'])
                 if tumour_response_check_method not in {
                         'Mammography', 'SonoMammography'
                 }:
                     tumour_response_nact, tumour_size, tumour_size_unit, date_tumour_size_checked, nact_response_impression, \
                         nact_response_node, nact_response_impression, nact_response_node = (
                             tumour_response_check_method,)*8
                 else:
                     tumour_response_nact = ask.ask_list(
                         "Response of tumour",
                         ["Partial", "Complete", "No Effect", "Other"])
                     tumour_size = input(
                         "Tumour size (without unit, e.g., 2 x 4 x 5) after treatment: "
                     )
                     tumour_size_unit = ask.ask_option(
                         "Tumour size unit", ['mm', 'cm'])
                     date_tumour_size_checked = ask.check_date(
                         "Date tumour size checked: ")
                     nact_response_impression = input(
                         'Please input impression given in report for NACT response: '
                     )
                     nact_node = ask.ask_y_n(
                         'Does the report mention node response? ')
                     nact_response_node = 'nact_node_response_not_mentioned'
                     if nact_node:
                         nact_response_node = input(
                             'Please input statement on node response to NACT: '
                         )
                 trast_nact = ask.ask_y_n("Trastuzumab used?")
                 if trast_nact:
                     trastuzumab_regime_nact = ask.ask_option(
                         "Trastuzumab use was",
                         ["Sequential", "Concurrent"])
                     trastuzumab_use_nact = "Trastuzumab used"
                     trastuzumab_courses_taken_nact = input(
                         "Number of courses of trastuzumab/herceptin taken: "
                     )
                 else:
                     trastuzumab_use_nact, trastuzumab_regime_nact, trastuzumab_courses_taken_nact, \
                         = ("no_neo_adjuvant_trastuzumab", )*3
                 nact_end_date = ask.check_date(
                     "Date of completion of NACT: ")
                 complete_nact = ask.ask_y_n(
                     "Was NACT completed as per schedule? ")
                 if complete_nact:
                     nact_completion_status = "nact_complete"
                 else:
                     nact_completion_status = ask.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"
                         ])
                     nact_completion_status = "NACT incomplete: " + nact_completion_status
                 hormone_therapy = ask.ask_y_n_na(
                     "Was hormone therapy given?")
                 if hormone_therapy == 'Yes':
                     hormone_therapy_nact = "naht_given"
                     hormone_therapy_type_nact = ask.ask_option(
                         "Hormone therapy type",
                         ["Sequential", "Concurrent"])
                     hormone_therapy_duration = input(
                         "What was the duration of therapy? ")
                     therapy_side = ask.ask_y_n_na(
                         "Were any side effects observed ?")
                     horomone_therapy_side_effects = 'no_side_effects'
                     if therapy_side == 'Yes':
                         horomone_therapy_side_effects = input(
                             "Please give details of side effects observed: "
                         )
                     nact_naht = ask.ask_y_n(
                         'Was chemotherapy given in addition to hormone therapy?'
                     )
                     if nact_naht:
                         nact_status = 'nact_and_naht_given'
                     else:
                         nact_status = 'naht_given'
                 elif hormone_therapy == 'No':
                     hormone_therapy = "no_naht"
                     nact_status = "nact_given"
                     hormone_therapy_nact, hormone_therapy_type_nact, hormone_therapy_duration, \
                         horomone_therapy_side_effects = (
                             hormone_therapy,) * 4
                 else:
                     hormone_therapy_nact, hormone_therapy_type_nact, hormone_therapy_duration, \
                         horomone_therapy_side_effects = (
                             hormone_therapy,) * 4
                     nact_status = "nact_given"
         data_list = [
             nact_status, place_nact, details_nact, plan_nact,
             date_start_nact, patient_weight_nact, nact_drugs_administered,
             number_cycles_nact, cycle_weekly_frequency, drugs_totaldose,
             drugs_unit, toxicity_type, toxicity_grade, toxicity_treatment,
             toxicity_response, toxicity_at_cycle,
             nact_change_due_to_toxicity, tumour_response_check_method,
             tumour_response_nact, tumour_size, tumour_size_unit,
             nact_response_impression, nact_response_node,
             date_tumour_size_checked, nact_completion_status,
             nact_end_date, trastuzumab_use_nact, trastuzumab_regime_nact,
             trastuzumab_courses_taken_nact, hormone_therapy_nact,
             hormone_therapy_type_nact, hormone_therapy_duration,
             horomone_therapy_side_effects, self.user_name,
             sql.last_update()
         ]
         col_list = names("neo_adjuvant_therapy")
         check = sql.review_input(file_number, col_list, data_list)
     return data_list, drug_table, toxicity
예제 #7
0
    def surgery_block_information_1(self):
        module_name = self.module_list[1]
        data_list = ['NA', ] * 21
        block_desc_df = pd.DataFrame()
        check = False
        while not check:
            blocks = BlockDescription(fk=self.fk, file_number=self.file_number, block_id=self.surgery_block_id,
                                      block_no=self.surgery_number_of_blocks, user_name=self.user_name)
            block_desc_df, block_descriptions_all = blocks.block_description()
            breast_cancer_yes_no = sql.get_value_no_error(col_name='breast_cancer_yes_no', table=self.table_name,
                                                 pk=self.fk, cursor=self.cursor, pk_name='fk')
            if not breast_cancer_yes_no:
                breast_cancer_yes_no = ask.ask_y_n('Is this a case of breast cancer (Unilateral OR Bilateral)',
                                               yes_ans="breast_cancer_yes", no_ans="breast_cancer_no")
            surgery_lesion_site = sql.get_value_no_error(col_name='surgery_lesion_site', table=self.table_name,
                                                pk=self.file_number, cursor=self.cursor, pk_name='file_number')
            if not surgery_lesion_site:
                surgery_lesion_site = ask.ask_list("Lesion on", ["right_breast", "left_breast", "bilateral"])
            block_info = BlockInformation(self.conn, self.cursor, self.file_number)
            specimen_resection_size, margin_size, cut_margin_size, margin_report = block_info.margin_info()
            tumour_size, tumour_size_unit, tumour_grade, surgery_diagnosis, surgery_diagnosis_comments, dcis_yes_no, \
            dcis_percent, surgery_perineural_invasion, surgery_necrosis, surgery_lymphovascular_invasion, \
            percent_lymph_invasion, stromal_tils_percent, tumour_desmoplastic_response = [breast_cancer_yes_no, ] * 13
            print('breast_cancer_yes_no: ' + breast_cancer_yes_no)
            check_answer = ask.ask_y_n('Is this correct?')
            while not check_answer:
                breast_cancer_yes_no = ask.ask_y_n('Is this a case of breast cancer (Unilateral OR Bilateral)',
                                                   yes_ans="breast_cancer_yes", no_ans="breast_cancer_no")
                check_answer = ask.ask_y_n('Is this correct?')
            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_size_unit = ask.ask_list("Tumour size unit", ['mm', 'cm'])
                tumour_grade = ask.ask_option("Tumour Grade", ["I", "II", "III"])
                surgery_diagnosis = self.bilateral_treatment(surgery_lesion_site, "Surgery Diagnosis: ",
                                                             PathReports.diagnosis)
                surgery_diagnosis_comments = self.bilateral_treatment(surgery_lesion_site, 'Descriptive or indicative '
                                                                                           'notes for surgery '
                                                                                           'diagnosis: ', 'input')
                dcis_yes_no = self.bilateral_treatment(surgery_lesion_site, 'DCIS', ask.create_yes_no_options('DCIS'))
                dcis_percent = dcis_yes_no
                if 'dcis_yes' in dcis_yes_no:
                    dcis_percent = self.bilateral_treatment(surgery_lesion_site, "Percent DCIS (number only if given "
                                                                                 "else NA): ", 'input')
                surgery_perineural_invasion = self.bilateral_treatment(surgery_lesion_site, "Perineural Invasion: ",
                                                                       ask.create_yes_no_options('Perineural Invasion',
                                                                                                  yes='yes', no='no'))
                surgery_necrosis = self.bilateral_treatment(surgery_lesion_site, "Necrosis", ask.create_yes_no_options(
                    'Necrosis'))
                surgery_lymphovascular_invasion = self.bilateral_treatment(surgery_lesion_site,
                                                                           "Lymphovascular Invasion: ",
                                                                           ask.create_yes_no_options
                                                                           ('Lymphovascular Invasion'))
                percent_lymph_invasion = self.bilateral_treatment(surgery_lesion_site, "Percent Lymphocyte Invasion "
                                                                                       "Enter number only; Enter "
                                                                                       "'data_not_in_report' "
                                                                                       "if not available: ", 'input')
                stromal_tils_percent = self.bilateral_treatment(surgery_lesion_site, 'Stromal Tumor infiltrating '
                                                                                     'lymphocytes: ', 'input')
                tumour_desmoplastic_response = self.bilateral_treatment(surgery_lesion_site,
                                                                        "Tumor desmoplastic response: ",
                                                                        ask.create_yes_no_options
                                                                        ('Tumor desmoplastic response'))

            tumour_block_ref, node_block_ref, ad_normal_block_ref, red_tissue_block_ref \
                = ask.join_lists(block_descriptions_all, sep="; ")
            data_list = [specimen_resection_size, tumour_block_ref, margin_size, cut_margin_size, margin_report,
                        node_block_ref, ad_normal_block_ref, red_tissue_block_ref, tumour_size, tumour_size_unit,
                        tumour_grade, surgery_diagnosis, surgery_diagnosis_comments, dcis_yes_no, dcis_percent,
                        surgery_perineural_invasion, surgery_necrosis, surgery_lymphovascular_invasion,
                         percent_lymph_invasion, stromal_tils_percent, tumour_desmoplastic_response]
            columns_list = names(module_name)
            check = sql.review_input(self.file_number, columns_list, data_list)
        return tuple(data_list), block_desc_df
예제 #8
0
def chemotherapy(file_number, user_name):
    col_drug = names("chemo_drug_table")
    drug_table = pd.DataFrame(columns=col_drug)
    col_tox = names('chemo_tox_table')
    toxicity = pd.DataFrame(columns=col_tox)
    data_list = [
        'data_to_be_entered',
    ] * 27 + [user_name, sql.last_update()]
    check = False
    while not check:
        chemo = ask.ask_y_n_na(
            "Has adjuvant chemotherapy been done for the patient?")
        if chemo == 'Yes':
            place_chemo = ask.ask_y_n_na(
                "Has Adjuvant Chemotherapy been done at PCCM?", "At PCCM",
                "Outside", "Not Certain, requires follow-up")
            details_chemo = ask.ask_y_n(
                "Are Adjuvant Chemotherapy details available?",
                "Details Available", "Follow-up required")
            chemo = "act_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.check_date(
                    "Date of starting Adjuvant Chemotherapy: ")
                patient_wt = ask.check_number_input(
                    "Weight of patient at start of therapy (in kgs): ",
                    'Weight must '
                    'be a number')
                check_wt = ask.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.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
                toxicity = tox_table(file_number, drug_cyc, 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.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.ask_y_n("Trastuzumab used?")
                if trast_chemo:
                    trast_regime = ask.ask_option("Trastuzumab use was",
                                                  ["Sequential", "Concurrent"])
                    trast_chemo = "Trastuzumab used"
                    trast_courses = ask.check_number_input(
                        "Number of courses of trastuzumab/herceptin taken: ",
                        'Enter number only')
                else:
                    trast_chemo, trast_regime, trast_courses, therapy_side = (
                        "Trastuzumab not used", ) * 4
                date_complete = ask.check_date(
                    "Date of completion of Adjuvant Chemotherapy: ")
                complete_chemo = ask.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.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.ask_option("Menopausal Status", [
                    "Pre-menopausal", "Peri-menopausal", "Post-Menopausal",
                    "Other"
                ])
                if menopause in {"Pre-menopausal", "Peri-menopausal"}:
                    ovary_status = ask.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
        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,
            sql.last_update()
        ]
        col_list = names("adjuvant_chemotherapy")
        check = sql.review_input(file_number, col_list, data_list)
    return data_list, drug_table, toxicity
예제 #9
0
    def follow_up(self):
        follow = True
        follow_index = 0
        col_list = ["file_number"] + names()

        follow_up_data = pd.DataFrame(columns=col_list)
        while follow:
            check = False
            while not check:
                time_follow = ask.ask_option("Follow-up Period", [
                    "3 months", "6 months", "9 months", "1 year",
                    "1 year, 3 months", "1 year, 6 months", "1 year, 9 months",
                    "2 years", "2 years, 6 months", "3 years",
                    "3 years, 6 months", "4 years", "4 years, 6 months",
                    "5 years", "6 years", "7 years", "8 years", "9 years",
                    "10 years", "Other"
                ])
                follow_status = patient_status()
                follow_mammo, follow_mammo_date, follow_usg, follow_usg_date = (
                    "NA", ) * 4
                is_mammo = ask.ask_y_n('Is follow up mammogramm present?')
                if is_mammo:
                    follow_mammo_date = ask.check_date(
                        'Date of follow-up Mammograph? ')
                    follow_mammo = input(
                        "Results of Mammography (Please enter in the format (Observation(mass/calc/lesion "
                        "etc)/Location/BIRADs)): ")
                is_usg = ask.ask_y_n(
                    'Is follow up USG abdomen/Pelvis present?')
                if is_usg:
                    follow_usg_date = ask.check_date(
                        'Date of follow-up USG abdomen/Pelvis? ')
                    follow_usg = input(
                        "Results of USG abdomen/Pelvis (Please enter in the format (Observation"
                        "(mass/calc/lesion etc)/Location/BIRADs)): ")
                other_type_date, other_type, other_result = ("NA", ) * 3
                follow_other = ask.ask_y_n(
                    "Are there other reports in follow-up?")
                if follow_other:
                    other_type_date_list = []
                    other_type_list = []
                    other_result_list = []
                    while follow_other:
                        other_type_date = ask.check_date(
                            'Date of other test: ')
                        other_type = input("Type of other report: ")
                        other_result = input("Result of " + other_type + ": ")
                        other_type_date_list.append(other_type_date)
                        other_type_list.append(other_type)
                        other_result_list.append(other_result)
                        follow_other = ask.ask_y_n("Add more reports?")
                    all_data = [
                        other_type_date_list, other_type_list,
                        other_result_list
                    ]
                    all_data = ask.join_lists(all_data, "; ")
                    other_type_date, other_type, other_result = all_data
                follow_up_treatment = ask.ask_y_n(
                    'Was any oncological treatment given after follow up?')
                if not follow_up_treatment:
                    follow_up_treatment, follow_up_treatment_result = [
                        'no_treatment_given',
                    ] * 2
                else:
                    follow_up_treatment = input(
                        'What follow up treatment was given?')
                    follow_up_treatment_result = input(
                        'What was the result of follow-up treatment ' +
                        follow_up_treatment + '?')
                data_list = [
                    self.file_number, time_follow, follow_status,
                    follow_mammo_date, follow_mammo, follow_usg_date,
                    follow_usg, other_type, other_type_date, other_result,
                    follow_up_treatment, follow_up_treatment_result,
                    self.user_name,
                    sql.last_update()
                ]
                follow_up_data.loc[follow_index] = data_list
                check, follow_up_data = sql.review_df_row(follow_up_data)
            follow_index = follow_index + 1
            follow_up_period = list(follow_up_data.loc[:, "follow_up_period"])
            print("\n Follow up periods added: " +
                  "; ".join(follow_up_period) + '\n')
            follow = ask.ask_y_n("Add another follow-up period?")
        return follow_up_data