示例#1
0
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
示例#2
0
def hormone_therapy_chemo():
    hormone_therapy = ask.ask_y_n_na("Was hormone therapy given?")
    if hormone_therapy == 'Yes':
        hormone_therapy = "Hormone therapy given"
        therapy_type = ask.ask_option("Hormone therapy type",
                                      ["Sequential", "Concurrent"])
        therapy_duration = input("What was the duration of therapy? ")
        therapy_side = ask.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
示例#3
0
 def family_cancer(self):
     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(self.conn, self.cursor,
                                                 self.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(self.file_number, columns_list, data_list)
     return data_list
示例#4
0
 def nut_supplements(self):
     module_name = "nut_supplements"
     data_list = ['NA'] * 4
     check = False
     while not check:
         nutrition = ask_y_n_na("Nutritional supplements taken")
         if nutrition == 'Yes':
             nuts = nut_supp_table(self.conn, self.cursor, self.file_number)
             nutrition = "Nutritional supplements taken"
         elif nutrition == 'No':
             nutrition = "No nutritional supplements taken"
             nuts = ("No nutritional supplements taken", ) * 3
         else:
             nuts = (nutrition, ) * 3
         nuts_type, nuts_quant, nuts_dur = nuts
         data_list = [nutrition, nuts_type, nuts_quant, nuts_dur]
         columns_list = pccm_names.names_info(module_name)
         check = review_input(self.file_number, columns_list, data_list)
     return data_list
示例#5
0
 def phys_act(self):
     module_name = "phys_act"
     check = False
     data_list = ['NA'] * 3
     while not check:
         activity = ask_y_n_na("Any Physical Activities ?")
         if activity == 'Yes':
             phys = physical_activity_table(self.conn, self.cursor,
                                            self.file_number)
             activity = "Physical Activities Performed"
             phys_act_done, phys_act_freq = phys
         elif activity == 'No':
             activity = "No Physical Activities"
             phys_act_done, phys_act_freq = ("No Physical Activities", ) * 2
         else:
             phys_act_done, phys_act_freq = (activity, ) * 2
         data_list = [activity, phys_act_done, phys_act_freq]
         columns_list = pccm_names.names_info(module_name)
         check = review_input(self.file_number, columns_list, data_list)
     return data_list
示例#6
0
 def med_history(self):
     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(self.conn, self.cursor,
                                          self.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(self.file_number, columns_list, data_list)
     return data_list
示例#7
0
 def cancer_history(self):
     module_name = "cancer_history"
     data_list = ['NA'] * 6
     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(self.conn, self.cursor,
                                            self.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(self.file_number, columns_list, data_list)
     return data_list
示例#8
0
def hormone(file_number):
    check = False
    while not check:
        hormone = ask.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.ask_y_n("Was Hormone therapy recieved?")
            if hormone_recieved:
                hormone_recieved = "Hormone therapy recieved"
                hormone_date = ask.check_date(
                    "Date of starting hormone therapy: ")
                hormone_type = ask.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.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.ask_y_n_na("Has ovarian surpression been used?")
                if ovary == 'Yes':
                    hormone_ovary = ask.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.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
示例#9
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
示例#10
0
    def habits(self):
        module_name = "habits"
        check = False
        while not check:
            diet = ask_option("Diet", PatientInfo.diet)
            alcohol = ask_y_n_na("Alcohol consumption",
                                 na_ans='data_not_available')
            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)",
                                 na_ans='data_not_available')
            if tobacco == 'Yes':
                tobacco = "Tobacco consumption"
                exposure_type = ask_option("Mode of exposure to Tobacco",
                                           PatientInfo.tobacco_exposure)
                if exposure_type == "Passive":
                    tobacco_type_partic = ask_option(
                        "Mode of passive consumption",
                        PatientInfo.passive_tobacco)
                    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",
                                          PatientInfo.type_tobacco)
                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(self.file_number, columns_list, data_list)
        return data_list
示例#11
0
 def family_details(self):
     module_name = "family_details"
     check = False
     while not check:
         marital_status = input('Marital Status :')
         siblings = ask_y_n_na('Siblings', na_ans='data_not_available')
         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', na_ans='data_not_available')
         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): ')
         menopause = ask_option("Menopausal Status",
                                PatientInfo.menopause_status)
         menopause_age = menopause
         if menopause == "Post-Menopausal":
             menopause_age = input('Age at menopause (yrs): ')
             lmp = "Last menstrual period " + menopause_age + " yrs"
         else:
             lmp = check_date("Date of last menstrual period: ")
         period_type = ask_option("Type of Period",
                                  PatientInfo.menstrual_type)
         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 = \'"
                     + self.file_number + "'")
                 self.cursor.execute(sql)
                 age = self.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(self.conn, self.cursor,
                                                  self.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(self.file_number, columns_list, data_list)
     return data_list
示例#12
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
示例#13
0
 def pet_report_findings(self):
     module_name = self.module_list[1]
     report_findings = [
         'NA',
     ] * 21
     report_list = []
     check = False
     while not check:
         pet_general_findings = input(
             'Please enter general findings of PET scan: ')
         for region in PetReport.pet_regions:
             print('\n' + region.title() + ' Report\n')
             normal_report = input('Please enter normal features of ' +
                                   str(region) +
                                   ' region. Separate features by'
                                   ' ";": ')
             abnormal = ask.ask_y_n('Are there any abnormal features in ' +
                                    str(region) + ' region?')
             if abnormal:
                 abnormal_report = input(
                     'Please enter abnormal features of ' + str(region) +
                     'region. Separate '
                     'features by ";": ')
             else:
                 abnormal_report = 'no_abnormal_features'
             report_list = report_list + [normal_report, abnormal_report]
         pet_head_neck_normal_report, pet_head_neck_abnormal_report, pet_thorax_normal_report, \
         pet_thorax_abnormal_report, pet_abdomen_pelvis_normal_report, pet_abodmen_pelvis_abnormal_report, \
         pet_musculoskeletal_normal_report, pet_musculoskeletal_abnormal_report = report_list
         pet_impression = input('Please enter PET impressions statements: ')
         pet_primary_disease = ask.ask_y_n(
             'Does the report describe a primary untreated breast cancer?',
             yes_ans='primary_disease',
             no_ans='not_primary_disease')
         pet_local_spread = ask.ask_y_n_na(
             'Does the report describe local/regional spread of the disease?',
             yes_ans='local_spread_present',
             no_ans='no_local_spread',
             na_ans='local_spread_resolved')
         pet_recurrence = ask.ask_y_n_na(
             'Does the report describe recurrence of the disease?',
             yes_ans='recurrence_present',
             no_ans='no_recurrence_present',
             na_ans='possible_recurrence')
         pet_distant_metastasis = ask.ask_y_n_na(
             'Does the report describe distant metastasis of the disease?',
             yes_ans='metastasis',
             no_ans='no_metastasis',
             na_ans='possible_metastasis')
         report_findings = [
             pet_general_findings, pet_head_neck_normal_report,
             pet_head_neck_abnormal_report, pet_thorax_normal_report,
             pet_thorax_abnormal_report, pet_abdomen_pelvis_normal_report,
             pet_abodmen_pelvis_abnormal_report,
             pet_musculoskeletal_normal_report,
             pet_musculoskeletal_abnormal_report, pet_impression,
             pet_primary_disease, pet_local_spread, pet_recurrence,
             pet_distant_metastasis
         ]
         columns_list = names(module_name)
         check = sql.review_input(self.file_number, columns_list,
                                  report_findings)
     return report_findings