Exemple #1
0
def bio_info(file_number):
    module_name = "bio_info"
    check = False
    while not check:
        mr_number = input('MR number :')
        name = input('Name :')
        aadhaar_card = input("Aadhaar card number (if available): ")
        date_first = check_date("Date of first visit: ")
        permanent_address = input('Permanent Address :')
        current_address_check = ask_option('Current Address',
                                           ["Same as Permanent", "Different"])
        if current_address_check == "Different":
            current_address = input("Current Address: ")
        else:
            current_address = permanent_address
        phone = input('Phone :')
        email_id = input('Email_ID :')
        gender = ask_option('Gender', ["Female", "Male", "Other"])
        age_yrs = input('Age at first visit (yrs) :')
        age_diag = input('Age at diagnosis (yrs): ')
        date_of_birth = check_date('Date of Birth (dd/mm/yyyy):')
        place_birth = input('Place of Birth :')
        height = ask_option("Height unit",
                            ["cm", "feet/inches", "Height not available"])
        if height == "Height not available":
            height_cm = "NA"
            weight_kg = input('Weight (kg) (if available else enter NA) :')
            BMI = "NA"
        else:
            if height == "cm":
                height_cm = input('Height (cm) :')
            else:
                height_feet = float(input("Height (feet)"))
                height_inch = float(input("Height (inches)"))
                height_inch = height_inch + 12 * height_feet
                height_cm = str(height_inch * 2.54)
            weight_kg = input('Weight (kg) (if available else enter NA) :')
            try:
                weight = float(weight_kg)
                height = float(height_cm) / 100
                BMI = str(round(weight / (height * height)))
            except ValueError:
                BMI = 'NA'
        columns_list = pccm_names.names_info(module_name)
        new_data = [
            mr_number, name, aadhaar_card, date_first, permanent_address,
            current_address, phone, email_id, gender, age_yrs, age_diag,
            date_of_birth, place_birth, height_cm, weight_kg, BMI
        ]
        check = review_input(file_number, columns_list, new_data)
    return (tuple(new_data))
Exemple #2
0
def clip_information(file_number):
    check = False
    while not check:
        clip = ask_y_n_statement.ask_y_n("Was Clip inserted for surgery?")
        if clip:
            clip_number = input("Number of clips inserted: ")
            clip_date = ask_y_n_statement.check_date("Date of clip insertion: ")
            clip_cycle = input("Clip inserted after cycle? ")
        else:
            clip_date, clip_number, clip_cycle = ("NA", )*3
        data_list = clip_number, clip_date, clip_cycle
        col_list = names("clip_information")
        check = review_input(file_number, col_list, data_list)
    return data_list
Exemple #3
0
def det_by(file_number):
    module_name = "det_by"
    check = False
    while not check:
        category = "Current Breast Cancer Detected by"
        options = ["Self", "Physician", "Screening Camp", "Other"]
        determined_by = ask_option(category, options)
        if determined_by == "Screening Camp":
            sc_id = input("Screening Camp ID: ")
            determined_by = "Screening Camp ID " + sc_id
        det_date = check_date("Date of current breast cancer detection: ")
        columns_list = pccm_names.names_info(module_name)
        data_list = [determined_by, det_date]
        check = review_input(file_number, columns_list, data_list)
    return (tuple(data_list))
def med_history_table(conn, cursor, file_number):
    add_history = True
    diagnosis_date_list, treatment_list, condition_list = [], [], []
    while add_history:
        condition = input("Condition : ")
        condition_list.append(condition)
        diagnosis_date = check_date("Date of diagnosis: ")
        diagnosis_date_list.append(diagnosis_date)
        treatment = input("Treatment: ")
        treatment_list.append(treatment)
        history = file_number, condition, diagnosis_date, treatment
        table_med = "General_Medical_History"
        columns = "File_number, Condition, Diagnosis_date, Treatment"
        sql.insert(conn, cursor, table_med, columns, history)
        add_history = ask_y_n('Add more history')
    condition_hist = '; '.join(condition_list)
    treatment_hist = '; '.join(treatment_list)
    diagnosis_date_hist = "; ".join(diagnosis_date_list)
    return (condition_hist, diagnosis_date_hist, treatment_hist)
Exemple #5
0
 def biopsy_details(self, df_cols):
     data_list_df = pd.DataFrame(columns=df_cols)
     breast_biopsy = ask.ask_option('Breast that biopsy has been done for',
                                    ['Right Breast', 'Left Breast', 'Unilateral', "Bilateral"])
     breasts = BlockDescription.breast_list(breast_biopsy)
     for breast in breasts:
         check_breast = False
         while not check_breast:
             print('Please input all data for ' + breast + ' report only')
             block_sr, block_location, block_id, block_number = ('block_not_available',) * 4
             block_check = ask.ask_y_n('Are the biopsy blocks available?')
             if block_check:
                 block_sr = input("Biopsy Block Serial Number: ")
                 block_location = BlockDescription.block_location()
                 block_id = input("Biopsy Block ID (include series identifiers): ")
                 block_number = input("Number of blocks: ")
             biopsy_date = ask.check_date("Date of Biopsy: ")
             biopsy_lab_id = input("Biopsy Lab ID/SID: ")
             print('Please input all data for ' + breast + ' block only')
             biopsy_type = ask.ask_option("Biopsy Type",
                                          ["Direct", "USG Guided", "VAB", "Tru-cut", "Steriotactic", 'Core',
                                           'Excision', 'FNAC', "Other"])
             category = "Tumour biopsy diagnosis"
             options = ['Benign', "Ductal carcinoma in situ(DCIS) with microinvasion",
                        "Ductal carcinoma in situ(DCIS) without microinvasion", "Lobular Carcinoma in Situ (LCS)",
                        "Invasive Ductal Carcinoma (IDC)", "Invasive Lobular Carcinoma (ILC)",
                        "Granulamatous Mastitis", "Papillary Carcinoma", "Phylloid Carcinoma",
                        "Invasive Mammary Carcinoma", "Invasive Breast Carcinoma", "Other"]
             tumour_diagnosis = ask.ask_option(category, options)
             tumour_grade = ask.ask_option("Tumour Biopsy Diagnosis", ["I", "II", "III"])
             lymph_emboli = ask.ask_y_n_na(question="Are Lymphovascular emboli seen?",
                                           yes_ans='Lymphovascular_emboli_biopsy_yes',
                                           no_ans='Lymphovascular_emboli_biopsy_no', na_ans='Data not in report')
             dcis_biopsy = ask.ask_y_n_na(question="Does the biopsy show DCIS", yes_ans="DCIS_biopsy_yes",
                                          no_ans="DCIS_biopsy_no", na_ans="Data not in report")
             df_data = [block_sr, block_location, block_id, block_number, biopsy_date, biopsy_lab_id, biopsy_type,
                        tumour_diagnosis, tumour_grade, lymph_emboli, dcis_biopsy]
             print('Data entered for ' + breast + ' is as follows:\n')
             check_breast = sql.review_input(self.file_number, df_cols, df_data)
         data_list_df.loc[breast] = df_data
     return data_list_df, breast_biopsy
Exemple #6
0
 def biopsy_details(self, block_id):
     check = False
     while not check:
         print('Please input all data for ' + block_id + ' report only')
         biopsy_date = ask.check_date("Date of Biopsy: ")
         biopsy_source = ask.ask_option('Source of Biopsy Block', ['Golwilkar Lab', 'AG Diagnostics',
                                                                   'Ruby Hall Clinic'])
         biopsy_lab_id = input("Biopsy Lab ID/SID: ")
         biopsy_type = ask.ask_option("Biopsy Type", ["Trucut", "VAB", 'Excision', 'FNAC'])
         biopsy_diagnosis = input('Enter the diagnosis in its full form (eg., Infiltrating Duct Carcinoma): ')
         biopsy_comments = input('Enter any additional comments on the diagnosis: ')
         tumour_grade = ask.ask_option("Tumour Biopsy Diagnosis", ["I", "II", "III"])
         lymph_emboli = ask.ask_y_n_na(question="Are Lymphovascular emboli seen?",
                                       yes_ans='Lymphovascular_emboli_biopsy_seen',
                                       no_ans='Lymphovascular_emboli_biopsy_not_seen', na_ans='Data not in report')
         dcis_biopsy = ask.ask_y_n_na(question="Does the biopsy show DCIS", yes_ans="DCIS_biopsy_yes",
                                      no_ans="DCIS_biopsy_no", na_ans="Data not in report")
         data_list = [biopsy_date, biopsy_source, biopsy_lab_id, biopsy_type, biopsy_diagnosis, biopsy_comments,
                      tumour_grade, lymph_emboli, dcis_biopsy]
         col_list = names.names_biopsy_x('biopsy_details')
         check = sql.review_input(self.file_number, col_list, data_list)
     return data_list
Exemple #7
0
def abvs(file_number):
    module_name = "abvs"
    check = False
    while not check:
        abvs = ask_y_n_statement.ask_y_n(
            "Automated Breast Volume Scanner (ABVS) done?")
        if abvs:
            abvs = "Automated Breast Volume Scanner done"
            abvs_date = ask_y_n_statement.check_date(
                "Date of examination of ABVS: ")
            abvs_acc = input("Accession number of ABVS: ")
            abvs_lesion = ask_y_n_statement.ask_option(
                "Location of lesion",
                ["Right Breast", "Left Breast", "Both", "Not present"])
            if abvs_lesion in {"Right Breast", "Left Breast", "Both"}:
                abvs_lesion_data = radio_tables.lesion_location(abvs_lesion)
            else:
                abvs_lesion_data = "NA"
            abvs_size = ask_y_n_statement.ask_option(
                "Size of lesion", ["<2 cm", "2-5 cm", ">5 cm", "Other"])
            abvs_dist = ask_y_n_statement.ask_option(
                "Distance from Skin (cm)", ["<0.5 cm", ">0.5 cm", "Other"])
            abvs_pect = input("Distance from Pectoralis Major (cm): ")
            abvs_diagnosis = ask_y_n_statement.ask_option(
                "ABVS Diagnosis",
                ["Normal", "Benign", "Suspicious", "Diagnostic for Cancer"])
        else:
            abvs = "Automated Breast Volume Scanner not done"
            abvs_date, abvs_acc, abvs_lesion, abvs_lesion_data, abvs_size, abvs_dist, abvs_pect, \
            abvs_diagnosis = ("NA",) * 8

        data_list = [
            abvs, abvs_date, abvs_acc, abvs_lesion, abvs_lesion_data,
            abvs_size, abvs_dist, abvs_pect, abvs_diagnosis
        ]
        columns_list = names(module_name)
        check = add_update_sql.review_input(file_number, columns_list,
                                            data_list)
    return tuple(data_list)
Exemple #8
0
 def surgery_block_information_1(self, block_data_type='primary_surgery'):
     module_name = self.module_list[0]
     check = False
     while not check:
         data_type = ask.ask_y_n("Is surgery type '" + block_data_type +
                                 "'")
         if not data_type:
             block_data_type = input("Please input type of surgery: ")
         block_sr_no = input("Surgery Block Serial Number: ")
         surg_block_id = input("Surgical Block ID: ")
         surg_no_block = input(
             "Number of Blocks (please input only number): ")
         surg_block_source = input("Pathology Lab (source of block): ")
         breast_cancer_yes_no = ask.ask_y_n(
             'Is this a case of breast cancer',
             yes_ans="breast cancer_yes",
             no_ans="breast cancer_no")
         pathology_report_available_yes_no = ask.ask_y_n(
             'Is the pathology report available',
             yes_ans="yes",
             no_ans="no")
         surg_date = ask.check_date("Date of Surgery: ")
         surg_name = ask.ask_option("Name of the Surgeon/s",
                                    ["Dr. C. B. Koppiker"])
         surg_hosp_id = input("Hospital ID: ")
         lesion_side = ask.ask_option(
             "Lesion on",
             ["Right Breast", "Left Breast", 'Unilateral', "Bilateral"])
         nact = sql.get_value(
             col_name='NACT_status',
             table='Neo_Adjuvant_Therapy',
             file_number=self.file_number,
             cursor=self.cursor,
             error_statement="Please enter (Data to be filled) for NACT "
             "details here")
         surg_list = [
             'Mastectomy', 'Modified Radical Mastectomy',
             'Breast Conservation Surgery', 'Therapeutic Mammoplasty',
             'Reduction Mammoplasty', 'Lumpectomy (Wide Local Excision)',
             "Reconstruction"
         ]
         if lesion_side != "Bilateral":
             surg_type = ask.ask_option("Type Surgery", surg_list)
         else:
             print("Right Breast Surgery")
             surg_type = ask.ask_option("Type Surgery", surg_list)
             surg_type_rb = "RB: " + surg_type
             print("Left Breast Surgery")
             surg_type = ask.ask_option("Type Surgery", surg_list)
             surg_type_lb = "LB: " + surg_type
             surg_type = surg_type_rb + "; " + surg_type_lb
         data_list_1 = [
             block_data_type, block_sr_no, surg_block_id, surg_no_block,
             breast_cancer_yes_no, pathology_report_available_yes_no,
             surg_block_source, surg_date, surg_name, surg_hosp_id,
             lesion_side, nact, surg_type
         ]
         columns_list = names(module_name)
         check = sql.review_input(self.file_number, columns_list,
                                  data_list_1)
     return data_list_1
Exemple #9
0
def family_details(conn, cursor, file_number):
    module_name = "family_details"
    check = False
    while not check:
        marital_status = input('Marital Status :')
        siblings = ask_y_n_na('Siblings')
        if siblings == 'Yes':
            siblings_number = input("Number of siblings: ")
            sisters = input('Sisters :')
            brothers = input('Brothers :')
        elif siblings == 'No':
            siblings_number, sisters, brothers = "No Siblings", "0", "0"
        else:
            siblings_number, sisters, brothers = (siblings, ) * 3
        children_y_n = ask_y_n_na('Children')
        if children_y_n == 'Yes':
            children_number = input("Number of children: ")
            daughters = input('Daughters :')
            sons = input('Sons :')
        elif children_y_n == 'No':
            children_number, daughters, sons = "No Children", "0", "0"
        else:
            children_number, daughters, sons = (children_y_n, ) * 3
        menarche = input('Age at menarche (yrs): ')
        category = "Menopausal Status"
        options = [
            "Pre-menopausal", "Peri-menopausal", "Post-Menopausal", "Other"
        ]
        menopause = ask_option(category, options)
        menopause_age = menopause
        if menopause == "Post-Menopausal":
            menopause_age = input('Age at menopause (yrs): ')
            lmp = "Last menstrual period " + menopause_age + " yrs"
            period_type = "NA"
        else:
            lmp = check_date("Date of last menstrual period: ")
            category = "Type of Period"
            options = ["Regular", "Irregular", "Other"]
            period_type = ask_option(category, options)
        number_pregnancy = input(
            "Number of pregnancies (enter Requires Follow-up if no data given): "
        )
        if number_pregnancy == "0":
            age_first_preg, age_last_preg, number_term, number_abortion, age_first, age_last, twice_birth, \
            breast_feeding_data, kid_feeding, duration_feeding, breast_usage = ('No children',) * 11
        elif number_pregnancy == "Requires Follow-up":
            age_first_preg, age_last_preg, number_term, number_abortion, age_first, age_last, twice_birth, \
            breast_feeding_data, kid_feeding, duration_feeding, breast_usage = ('Requires Follow-up',) * 11
        else:
            number_term = input(
                "Pregnancy carried to term (include abortion after 6 months): "
            )
            number_abortion = input("Number of abortions: ")
            age_first_preg = input("Age at first pregnancy: ")
            age_last_preg = "NA"
            try:
                sql = (
                    'SELECT Age_at_First_Visit_yrs FROM Patient_Information_History WHERE File_number = \''
                    + file_number + "'")
                cursor.execute(sql)
                age = cursor.fetchall()
                age_mother = age[0][0]
            except:
                age_mother = input("Age at first visit to clinic")
            if children_number == 'No Children':
                age_first, age_last, twice_birth, breast_feeding_data, kid_feeding, \
                duration_feeding, breast_usage = (children_number,) * 7
            elif children_y_n == 'Yes':
                age_first = input("Age of first child: ")
                if age_first_preg == "NA":
                    age_first_preg = str(int(age_mother) - int(age_first))
                if int(children_number) > 1:
                    age_last = input("Age of last child: ")
                    age_last_preg = input("Age at last pregnancy: ")
                    if age_last_preg == "NA":
                        age_last_preg = str(int(age_mother) - int(age_last))
                    twice_birth = ask_y_n("Two births in a year (not twins)",
                                          "Two births in a year",
                                          "No two births in a year")
                else:
                    age_last = age_first
                    age_last_preg, twice_birth = ("NA", ) * 2
                breast_feeding = ask_y_n("Breast feeding?")
                if breast_feeding:
                    breast_feeding_data = "Breast feeding"
                    feed_details = feed_duration(conn, cursor, file_number,
                                                 children_number)
                else:
                    breast_feeding_data = "No Breast feeding"
                    feed_details = ("NA", ) * 3
                kid_feeding, duration_feeding, breast_usage = feed_details
            else:
                age_first, age_last, twice_birth, breast_feeding_data, kid_feeding, \
                duration_feeding, breast_usage = (children_y_n,) * 7
        fert_treat_y_n = ask_y_n_na(
            "Have any fertility treatments ever been used")
        if fert_treat_y_n == 'Yes':
            fert_treat = "Fertility Treatment used"
            type_fert = input("Type of fertility treatment used: ")
            detail_fert = input("Details of fertility treatment used:")
            cycles_fert = input(
                "Number of cycles of fertility treatment taken: ")
            success_fert = ask_y_n(
                "Did fertility treatment result in successful pregnancy? ",
                "Pregnancy from Treatment", "No pregnancy from treatment")
        elif fert_treat_y_n == "No":
            fert_treat = "No Fertility Treatment used"
            type_fert, detail_fert, cycles_fert, success_fert = (
                "No Fertility Treatment used", ) * 4
        else:
            fert_treat, type_fert, detail_fert, cycles_fert, success_fert = (
                fert_treat_y_n, ) * 5
        birth_control = ask_y_n_na("Birth control used?")
        if birth_control == 'Yes':
            type_birth_control = ask_option("Type of birth control used",
                                            ["Birth control pills", "Other"])
            detail_birth_control = input("Details of birth control used: ")
            duration_birth_control = input("Duration of birth control use: ")
        elif birth_control == 'No':
            type_birth_control, detail_birth_control, duration_birth_control = (
                "No birth control used", ) * 3
        else:
            type_birth_control, detail_birth_control, duration_birth_control = (
                birth_control, ) * 3
        data_list = [
            marital_status, siblings_number, sisters, brothers,
            children_number, daughters, sons, menarche, menopause,
            menopause_age, lmp, period_type, number_pregnancy, number_term,
            number_abortion, age_first, age_first_preg, age_last,
            age_last_preg, twice_birth, breast_feeding_data, kid_feeding,
            duration_feeding, breast_usage, fert_treat, type_fert, detail_fert,
            cycles_fert, success_fert, type_birth_control,
            detail_birth_control, duration_birth_control
        ]
        columns_list = pccm_names.names_info(module_name)
        check = review_input(file_number, columns_list, data_list)
    return tuple(data_list)
Exemple #10
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)
    check = False
    while not check:
        chemo = ask_y_n_statement.ask_y_n_na(
            "Has adjuvant chemotherapy been done for the patient?")
        if chemo == 'Yes':
            place_chemo = ask_y_n_statement.ask_y_n_na(
                "Has Adjuvant Chemotherapy been done at PCCM?", "At PCCM",
                "Outside", "Not Certain, requires follow-up")
            details_chemo = ask_y_n_statement.ask_y_n(
                "Are Adjuvant Chemotherapy details available?",
                "Details Available", "Follow-up required")
            chemo = "Adjuvant Chemotherapy given"
            if details_chemo == "Follow-up required":
                plan_chemo, date_start_chemo, cyc_number, drug_cyc, drug_doses, drug_units, tox_type, tox_grade, \
                tox_treat, tox_response, tox_cycle, change_tox,chemo_response_by, chemo_response, chemo_size, \
                chemo_size_date, trast_chemo, trast_regime, trast_courses,date_complete, reason_incomplete, \
                hormone_therapy, therapy_type, therapy_duration, therapy_side, ovary_status, patient_wt, drug_freq\
                    = (details_chemo,)*28
            elif details_chemo == "Details Available":
                plan_chemo = input(
                    "What is the plan of Adjuvant Chemotherapy (for eg., "
                    "4 cycles AC followed by 12 cycles Paclitaxel):")
                date_start_chemo = ask_y_n_statement.check_date(
                    "Date of starting Adjuvant Chemotherapy: ")
                patient_wt = input(
                    "Weight of patient at start of therapy (in kgs): ")
                check_wt = ask_y_n_statement.ask_y_n(
                    "Is weight at any other time point mentioned in report?")
                while check_wt:
                    other_wt = input("Time point at which weight mentioned: ")
                    other_wt = other_wt + " " + input("Weight of patient at " +
                                                      other_wt + ": ")
                    patient_wt = patient_wt + "; " + other_wt
                    check_wt = ask_y_n_statement.ask_y_n(
                        "Is weight at any other time point mentioned in report "
                        "(with date, if given)?")
                drug_table = drug_table_enter(file_number, drug_table)
                data_drug = col_drug[1:]
                data_drug_list = []
                for index in data_drug:
                    data_drug = "; ".join(list(drug_table.loc[:, index]))
                    data_drug_list.append(data_drug)
                drug_cyc, cyc_number, drug_freq, drug_doses, drug_units = data_drug_list
                check_drug_tox = False
                while not check_drug_tox:
                    toxicity = tox_table(file_number, drug_cyc, toxicity)
                    check_drug_tox = review_df(toxicity)
                columns = col_tox
                tox_details = []
                for column in columns:
                    tox_detail = toxicity.loc[:, column].drop_duplicates()
                    tox_details.append(list(tox_detail))
                tox_details = ask_y_n_statement.join_lists(tox_details, "; ")
                file_number_tox, drug_tox, tox_type, tox_grade, tox_treat, tox_response, tox_cycle, change_tox \
                    = tox_details
                trast_chemo = ask_y_n_statement.ask_y_n("Trastuzumab used?")
                if trast_chemo:
                    trast_regime = ask_y_n_statement.ask_option(
                        "Trastuzumab use was", ["Sequential", "Concurrent"])
                    trast_chemo = "Trastuzumab used"
                    trast_courses = input(
                        "Number of courses of trastuzumab/herceptin taken: ")
                else:
                    trast_chemo, trast_regime, trast_courses, therapy_side = (
                        "Trastuzumab not used", ) * 4
                date_complete = ask_y_n_statement.check_date(
                    "Date of completion of Adjuvant Chemotherapy: ")
                complete_chemo = ask_y_n_statement.ask_y_n(
                    "Was Adjuvant Chemotherapy completed as per schedule?")
                if complete_chemo:
                    reason_incomplete = "Adjuvant Chemotherapy completed as per schedule"
                else:
                    reason_incomplete = ask_y_n_statement.ask_option(
                        "Reason for discontinuation", [
                            "Toxicity", "Reluctance of patient",
                            "Progression on chemotherapy",
                            "Advised by treating doctor",
                            "Death due to toxicity",
                            "Death due to progressive disease",
                            "Preferred treatment at another centre",
                            "Death due to unrelated cause",
                            "Patient was unable to afford treatment"
                        ])
                    reason_incomplete = "Adjuvant Chemotherapy incomplete: " + reason_incomplete
                menopause = ask_y_n_statement.ask_option(
                    "Menopausal Status", [
                        "Pre-menopausal", "Peri-menopausal", "Post-Menopausal",
                        "Other"
                    ])
                if menopause in {"Pre-menopausal", "Peri-menopausal"}:
                    ovary_status = ask_y_n_statement.ask_option(
                        "Status of ovarian function after Chemotherapy", [
                            "Menses ongoing", "Amenorrhoea on Chemo",
                            "Amenorrhoea post Chemotherapy"
                        ])
                else:
                    ovary_status = menopause
                #hormone_therapy, therapy_type, therapy_duration, therapy_side = hormone_therapy_chemo()
                hormone_therapy, therapy_type, therapy_duration, therapy_side = (
                    'NA', ) * 4
            else:
                plan_chemo, date_start_chemo, cyc_number, drug_cyc, drug_doses, drug_units, drug_freq,tox_type, \
                tox_grade, tox_treat, tox_response, tox_cycle, change_tox,chemo_response_by, chemo_response, \
                chemo_size, chemo_size_date, trast_chemo, trast_regime, trast_courses, hormone_therapy,  therapy_type, \
                therapy_duration, therapy_side, date_complete, reason_incomplete,ovary_status, patient_wt \
                    = (details_chemo,)*28
        elif chemo == 'No':
            place_chemo, plan_chemo, date_start_chemo, cyc_number, drug_cyc, drug_doses, drug_units, \
            drug_freq,tox_type, tox_grade, tox_treat, tox_response, tox_cycle, change_tox, chemo_response_by, \
            chemo_response, chemo_size, chemo_size_date, trast_chemo, trast_regime, trast_courses, hormone_therapy, \
            therapy_type, therapy_duration, therapy_side, date_complete, reason_incomplete, details_chemo, chemo, \
            ovary_status, patient_wt = ("Adjuvant Chemotherapy not given",)*31
        else:
            place_chemo, plan_chemo, date_start_chemo, cyc_number, drug_cyc, drug_doses, drug_units, drug_freq, \
            tox_type, tox_grade, tox_treat, tox_response, tox_cycle, change_tox, chemo_response_by, chemo_response, \
            chemo_size, chemo_size_date, trast_chemo, trast_regime, trast_courses, hormone_therapy, therapy_type, \
            therapy_duration,ovary_status, therapy_side, date_complete, reason_incomplete, details_chemo, patient_wt \
                = (chemo,)*30
        last_update = datetime.now().strftime("%Y-%b-%d %H:%M")
        data_list = [
            chemo, place_chemo, details_chemo, plan_chemo, date_start_chemo,
            patient_wt, drug_cyc, cyc_number, drug_freq, drug_doses,
            drug_units, tox_type, tox_grade, tox_treat, tox_response,
            tox_cycle, change_tox, reason_incomplete, date_complete,
            trast_chemo, trast_regime, trast_courses, ovary_status,
            hormone_therapy, therapy_type, therapy_duration, therapy_side,
            user_name, last_update
        ]
        col_list = names("Adjuvant_ChemoTherapy")
        check = review_input(file_number, col_list, data_list)
    return data_list, drug_table, toxicity
Exemple #11
0
def nact_test(file_number, user_name):
    col_drug = names("NACT_Drug_Table")
    drug_table = pd.DataFrame(columns=col_drug)
    col_tox = names('NACT_Tox_table')
    toxicity = pd.DataFrame(columns=col_tox)
    check = False
    while not check:
        nact = ask_y_n_statement.ask_y_n_na("Has neo adjuvant therapy been done for the patient (Please check for "
                                            "chemotherapy and/hormone therapy)?")
        if nact == 'Yes':
            place_nact = ask_y_n_statement.ask_y_n_na("Has neo adjuvant therapy been done at PCCM?", "At PCCM",
                                                      "Outside", "Not Certain, requires follow-up")
            details_nact = ask_y_n_statement.ask_y_n("Are neo adjuvant therapy details available?", "Details Available",
                                                     "Follow-up required")
            if details_nact == "Follow-up required":
                plan_nact, date_start_nact, patient_wt, cyc_number, drug_cyc, drug_doses, drug_units, drug_freq, \
                tox_type, tox_grade, tox_treat, tox_response, tox_cycle, change_tox,nact_response_by, nact_response, \
                nact_size, nact_size_unit, nact_size_date, trast_nact, trast_regime, trast_courses, date_complete, \
                reason_incomplete, hormone_therapy,  therapy_type, therapy_duration, therapy_side = (details_nact,)*28
            elif details_nact == "Details Available":
                plan_nact = input("What is the plan of NACT (for eg., 4 cycles AC followed by 12 cycles Paclitaxel; "
                                  "Include hormone therapy plan here):")
                date_start_nact = ask_y_n_statement.check_date("Date of starting neo-adjuvant therapy: ")
                patient_wt = input("Weight of patient at start of therapy (in kgs): ")
                check_wt = ask_y_n_statement.ask_y_n("Is weight at any other time point mentioned in report "
                                                     "(with date, if given)?")
                while check_wt:
                    other_wt = input("Time point at which weight mentioned: ")
                    other_wt = other_wt + " " + input("Weight of patient at " + other_wt + ": ")
                    patient_wt = patient_wt + "; " + other_wt
                    check_wt = ask_y_n_statement.ask_y_n("Is weight at any other time point mentioned in report "
                                                         "(with date, if given)?")
                drug_admin = drug_table_enter(file_number, drug_table)
                data_drug = ['Number_cycle', 'Drug', 'Drug_dose', 'Dose_unit', 'Cycle_frequency_per_week']
                data_drug_list = []
                for index in data_drug:
                    data_drug = "; ".join(list(drug_admin.loc[:, index]))
                    data_drug_list.append(data_drug)
                cyc_number, drug_cyc, drug_doses, drug_units, drug_freq = data_drug_list
                check_drug_tox = False
                while not check_drug_tox:
                    toxicity = tox_table(file_number, drug_cyc, toxicity)
                    check_drug_tox = review_df(toxicity)
                columns = col_tox
                tox_details = []
                for column in columns:
                    tox_detail = toxicity.loc[:, column].drop_duplicates()
                    tox_details.append(list(tox_detail))
                tox_details = ask_y_n_statement.join_lists(tox_details, "; ")
                file_number_tox, drug_tox, tox_type, tox_grade, tox_treat, tox_response, tox_cycle, change_tox \
                    = tox_details
                nact_response_by = ask_y_n_statement.ask_option("Response to NACT measured by", ['Mammography',
                                                                                                 'SonoMammography'])
                if nact_response_by == "Data not in Report" or nact_response_by == "Requires Follow-up":
                    nact_response, nact_size, nact_size_unit, nact_size_date = (nact_response_by,)*4
                else:
                    nact_response = ask_y_n_statement.ask_option("Response of tumour",
                                                                 ["Partial", "Complete", "No Effect", "Other"])
                    nact_size = input("Tumour size (without unit, e.g., 2 x 4 x 5) after treatment: ")
                    nact_size_unit = ask_y_n_statement.ask_option("Tumour size unit", ['mm', 'cm'])
                    nact_size_date = ask_y_n_statement.check_date("Date tumour size checked: ")
                trast_nact = ask_y_n_statement.ask_y_n("Trastuzumab used?")
                if trast_nact:
                    trast_regime = ask_y_n_statement.ask_option("Trastuzumab use was", ["Sequential", "Concurrent"])
                    trast_nact = "Trastuzumab used"
                    trast_courses = input("Number of courses of trastuzumab/herceptin taken: ")
                else:
                    trast_nact, trast_regime, trast_courses, therapy_side = ("Trastuzumab not used", )*4
                date_complete = ask_y_n_statement.check_date("Date of completion of NACT: ")
                complete_nact = ask_y_n_statement.ask_y_n("Was NACT completed as per schedule? ")
                if complete_nact:
                    reason_incomplete = "NACT completed as per schedule"
                else:
                    reason_incomplete = ask_y_n_statement.ask_option("Reason for discontinuation",
                                                                     ["Toxicity", "Reluctance of patient",
                                                                      "Progression on chemotherapy",
                                                                      "Advised by treating doctor",
                                                                      "Death due to toxicity",
                                                                      "Death due to progressive disease",
                                                                      "Preferred treatment at another centre",
                                                                      "Death due to unrelated cause",
                                                                      "Patient was unable to afford treatment"])
                    reason_incomplete = "NACT incomplete: " + reason_incomplete
                hormone_therapy = ask_y_n_statement.ask_y_n_na("Was hormone therapy given?")
                if hormone_therapy == 'Yes':
                    hormone_therapy = "Hormone therapy given"
                    therapy_type = ask_y_n_statement.ask_option("Hormone therapy type", ["Sequential", "Concurrent"])
                    therapy_duration = input("What was the duration of therapy? ")
                    therapy_side = ask_y_n_statement.ask_y_n_na("Were any side effects observed ?")
                    if therapy_side == 'Yes':
                        therapy_side = input("Please give details of side effects observed: ")
                    nact_naht = ask_y_n_statement.ask_y_n('Was chemotherapy given in addition to hormone therapy?')
                    if nact_naht:
                        nact = 'NACT and NAHT given'
                    else:
                        nact = 'NAHT given'
                elif hormone_therapy == 'No':
                    hormone_therapy = "No hormone therapy given"
                    nact = "NACT given"
                    therapy_type, therapy_duration, therapy_side = (hormone_therapy,) * 3
                else:
                    therapy_type, therapy_duration, therapy_side = (hormone_therapy,) * 3
                    nact = "NACT given"
            else:
                plan_nact, date_start_nact, cyc_number, drug_cyc, drug_doses, drug_units, drug_freq, tox_type, \
                tox_grade, tox_treat, tox_response, tox_cycle, change_tox, nact_response_by, nact_response, nact_size, \
                nact_size_unit, nact_size_date, trast_nact, trast_regime, trast_courses, hormone_therapy,  \
                therapy_type, therapy_duration, therapy_side, date_complete, reason_incomplete, patient_wt \
                    = (details_nact,)*28
        elif nact == 'No':
            place_nact, plan_nact, date_start_nact, cyc_number, drug_cyc, drug_doses, drug_units, drug_freq, tox_type, \
            tox_grade, tox_treat, tox_response, tox_cycle, change_tox, nact_response_by, nact_response, \
            nact_size, nact_size_unit, nact_size_date, trast_nact, trast_regime, trast_courses, hormone_therapy,  \
            therapy_type, therapy_duration, therapy_side, date_complete, reason_incomplete, details_nact, nact, \
            patient_wt = ("NACT/NAHT not given",)*31
        else:
            place_nact, plan_nact, date_start_nact, cyc_number, drug_cyc, drug_doses, drug_units,  drug_freq, tox_type,\
            tox_grade, tox_treat, tox_response, tox_cycle, change_tox, nact_response_by, nact_response, \
            nact_size, nact_size_unit, nact_size_date, trast_nact, trast_regime, trast_courses, hormone_therapy,  \
            therapy_type, therapy_duration, therapy_side, date_complete, reason_incomplete, details_nact, patient_wt \
                = (nact,)*30

        last_update = datetime.now().strftime("%Y-%b-%d %H:%M")
        data_list = [nact,  place_nact,  details_nact,  plan_nact,  date_start_nact, patient_wt, drug_cyc,
                     cyc_number, drug_freq, drug_doses,  drug_units, tox_type, tox_grade, tox_treat, tox_response,
                     tox_cycle,  change_tox, nact_response_by, nact_response, nact_size, nact_size_unit, nact_size_date,
                     reason_incomplete, date_complete, trast_nact, trast_regime, trast_courses, hormone_therapy,
                     therapy_type, therapy_duration, therapy_side, user_name, last_update]
        col_list = names("Neo_Adjuvant_Therapy")
        check = review_input(file_number, col_list, data_list)
    return data_list, drug_table, toxicity
Exemple #12
0
def mri_breast(file_number='test', user_name='dk'):
    module_name = "mri_breast"
    check = False
    while not check:
        mri_breast = ask_y_n_statement.ask_y_n("Has MRI-Breast been done?")
        if mri_breast:
            mri_breast = "MRI-Breast done"
            mri_breast_date = ask_y_n_statement.check_date(
                "Date of examination of MRI: ")
            mri_breast_acc = input(
                "Accession number of MRI (Include location): ")
            mri_breast_described = ask_y_n_statement.ask_option(
                "Details described for",
                ["Right Breast", "Left Breast", "Bilateral"])
            fgt_mri = ask_y_n_statement.ask_option(
                "Ammount of Fibroglandular Tissue", [
                    "a. Almost entirely fat",
                    "b. Scattered fibroglandular tissue",
                    "d. Extreme fibroglandular tissue", "Other"
                ])
            bpe_level_mri = ask_y_n_statement.ask_option(
                "Background parenchymal enhancement Level",
                ["Minimal", "Mild", "Moderate", "Marked", "Other"])
            bpe_symm_mri = ask_y_n_statement.ask_option(
                "Background parenchymal enhancement Symmetry",
                ["Symmetric", "Asymmetric", "Other"])
            focus_mri = input("Details of Focus: ")
            mass_mri = ask_y_n_statement.ask_y_n("Are masses detected?")
            if mass_mri:
                mass_mri = "Mass Detected"
                table = "MRI_Mass"
                mri_mass_number, mass_location, mass_shape, mass_margin, mass_internal = \
                    radio_tables.multiple_mass(table, mri_breast_described)
            else:
                mass_mri = "No Mass Detected"
                mri_mass_number, mass_location, mass_quad, mass_shape, mass_margin, mass_internal = (
                    "NA", ) * 6
            asso_feat = [
                "Nipple Retraction", "Nipple Invasion", "Skin Retraction",
                "Skin Thickening", "Axillary adenopathy",
                "Pectoralis muscle invasion", "Chest wall invasion",
                "Architectural Distortion"
            ]
            asso_feat_data = []
            for index in (asso_feat):
                print("Associated feature: " + index)
                print("Detailed description can be added by choosing 'Other'")
                var = ask_y_n_statement.ask_option(index, [
                    "Right Breast", "Left Breast", "Both", "Not Present",
                    "Other"
                ])
                asso_feat_data.append(var)
            asso_feat_9 = ask_y_n_statement.ask_option(
                "Associated Feature: Skin Invasion",
                ["Direct invasion", "Inflammatory cancer", "Other"])
            asso_feat_1, asso_feat_2, asso_feat_3, asso_feat_4, asso_feat_5, asso_feat_6, asso_feat_7, \
            asso_feat_8 = asso_feat_data
            fat_lesions = ask_y_n_statement.ask_option(
                "Fat Containing Lesions", [
                    "Lymph nodes: Normal", "Lymph nodes: Abnormal",
                    "Fat necrosis", "Hamartoma", "Postoperative seroma",
                    "hematoma with fat"
                ])
            mri_breast_kinetics_initial = ask_y_n_statement.ask_option(
                "Kinetic curve assessment Signal intensity "
                "(SI)/time curve description (Initial Phase)",
                ["Slow", "Medium", "Fast", "Other"])
            mri_breast_kinetics_delayed = ask_y_n_statement.ask_option(
                "Kinetic curve assessment Signal intensity "
                "(SI)/time curve description (Delayed Phase)",
                ["Persistent", "Plateau", "Washout", "Other"])
            mri_breast_non_enhance = ask_y_n_statement.ask_option(
                "Non-enhancing findings", [
                    "Ductal precontrast high signal on T1W", "Cyst",
                    "Postoperative collections (hematoma/seroma)",
                    "Post-therapy skin thickening and trabecular "
                    "thickening", "Signal void from foreign bodies, "
                    "clips, etc.", "Other"
                ])
            mri_breast_implant = input("Implant related findings: ")
            mri_breast_lesion = ask_y_n_statement.ask_option(
                "Location of lesion",
                ["Right Breast", "Left Breast", "Both", "Not present"])
            if mri_breast_lesion in {"Right Breast", "Left Breast", "Both"}:
                mri_breast_lesion_location = radio_tables.lesion_location(
                    mri_breast_lesion)
                mri_breast_lesion_depth = input("Lesion depth: ")
            else:
                mri_breast_lesion_location, mri_breast_lesion_depth = (
                    "NA", ) * 2
            mri_breast_size = ask_y_n_statement.ask_option(
                "Size of lesion", ["<2 cm", "2-5 cm", ">5 cm", "Other"])
            mri_breast_dist = ask_y_n_statement.ask_option(
                "Distance from Skin (cm)", ["<0.5 cm", ">0.5 cm", "Other"])
            mri_breast_pect = input("Distance from Pectoralis Major (cm): ")
            mri_breast_birad = ask_y_n_statement.ask_y_n(
                "Does the report include a BI-RAD assessment/Diagnosis?")
            if mri_breast_birad:
                mri_breast_birad = radio_tables.birads()
            else:
                mri_breast_birad = "No BI-RAD Category given in report"
        else:
            mri_breast = "MRI-Breast not done"
            mri_breast_date, mri_breast_acc, fgt_mri, bpe_level_mri, bpe_symm_mri, focus_mri, mass_mri, mri_mass_number,\
            mass_location, mass_quad, mass_shape, mass_margin, mass_internal, asso_feat_1, asso_feat_2, asso_feat_3, \
            asso_feat_4, asso_feat_5, asso_feat_6, asso_feat_7, asso_feat_8, asso_feat_9, fat_lesions,\
            mri_breast_lesion, mri_breast_lesion_location, mri_breast_lesion_depth, mri_breast_kinetics_initial, \
            mri_breast_kinetics_delayed, mri_breast_non_enhance, mri_breast_implant, mri_breast_size, mri_breast_dist, \
            mri_breast_pect, mri_breast_birad, mri_breast_described = (mri_breast,) * 35
        last_update = datetime.now().strftime("%Y-%b-%d %H:%M")
        data_list = [
            mri_breast, mri_breast_date, mri_breast_acc, mri_breast_described,
            fgt_mri, bpe_level_mri, bpe_symm_mri, focus_mri, mass_mri,
            mri_mass_number, mass_location, mass_shape, mass_margin,
            mass_internal, asso_feat_1, asso_feat_2, asso_feat_3, asso_feat_4,
            asso_feat_5, asso_feat_6, asso_feat_7, asso_feat_8, asso_feat_9,
            fat_lesions, mri_breast_kinetics_initial,
            mri_breast_kinetics_delayed, mri_breast_non_enhance,
            mri_breast_implant, mri_breast_lesion, mri_breast_lesion_location,
            mri_breast_lesion_depth, mri_breast_size, mri_breast_dist,
            mri_breast_pect, mri_breast_birad, user_name, last_update
        ]
        columns_list = names(module_name)
        check = add_update_sql.review_input(file_number, columns_list,
                                            data_list)
    return tuple(data_list)
Exemple #13
0
def sonomammo(file_number='test', user_name="dk"):
    module_name = "sonomammo"
    check = False
    while not check:
        sonomammo = ask_y_n_statement.ask_y_n(
            "Are sonomammography results available for this patient?")
        if sonomammo:
            sonomammo = "Sono-Mammography done"
            sonomammo_date = ask_y_n_statement.check_date(
                "Date of examination of Sono-mammography: ")
            sonomammo_place = input("")
            sonomammo_breast = ask_y_n_statement.ask_option(
                "Details described for",
                ["Right Breast", "Left Breast", "Bilateral"])
            mass_sonomammo = ask_y_n_statement.ask_y_n(
                "Is there any mass detected")
            if mass_sonomammo:
                mass_sonomammo = 'Mass/Lesion Detected'
                table = "SonnoMammography_Mass"
                mass_number, sonomammo_mass_location, sonomammo_mass_location_clock, sonomammo_masss_shape, \
                sonomammo_mass_margin, sonomammo_mass_echo, sonomammo_mass_size, sonomammo_mass_size_unit\
                    = radio_tables.multiple_mass(table, sonomammo_breast)
            else:
                mass_sonomammo, mass_number, sonomammo_mass_location, sonomammo_mass_location_clock, \
                sonomammo_masss_shape, sonomammo_mass_margin, sonomammo_mass_echo, sonomammo_mass_size, \
                sonomammo_mass_size_unit = ("No Mass Detected",) * 9
            sonomammo_calc = ask_y_n_statement.ask_option(
                "Calcification", [
                    "Right Breast", "Left Breast", "Bilateral", "Not present",
                    "Other"
                ])
            if sonomammo_calc != "Not present":
                sonomammo_calc_type = ask_y_n_statement.ask_option(
                    "Calcification location", [
                        "Calcifications in a mass",
                        "Calcifications outside of a mass",
                        "Intraductal calcifications"
                    ])
            else:
                sonomammo_calc_type = "NA"
            sonomammo_vasc = ask_y_n_statement.ask_option(
                "Vascularity",
                ["Absent", "Internal vascularity", "Vessels in rim", "Other"])
            sono_birad = ask_y_n_statement.ask_y_n(
                "Does the report include a BI-RAD assessment/Diagnosis?")
            if sono_birad:
                sonomammo_birad = radio_tables.birads()
            else:
                sonomammo_birad = "NA"
            sonomammo_impression = input("Input Impression(if available): ")
        else:
            check_mammo = ask_y_n(
                "Is the diagnostic radiological report present?")
            if check_mammo:
                sonomammo = "Sonomammography not done for diagnosis"
            else:
                sonomammo = "Requires Follow-up"
            sonomammo_date, sonomammo_breast, mass_sonomammo, mass_number, sonomammo_mass_location, \
            sonomammo_masss_shape, sonomammo_mass_margin, sonomammo_mass_echo, sonomammo_mass_location_clock, \
            sonomammo_mass_size, sonomammo_mass_size_unit, sonomammo_calc, sonomammo_calc_type, \
            sonomammo_vasc,sonomammo_birad, sonomammo_impression \
                = (sonomammo,) * 16
        last_update = datetime.now().strftime("%Y-%b-%d %H:%M")
        data_list = [
            sonomammo, sonomammo_date, sonomammo_breast, mass_sonomammo,
            mass_number, sonomammo_mass_location,
            sonomammo_mass_location_clock, sonomammo_masss_shape,
            sonomammo_mass_margin, sonomammo_mass_echo, sonomammo_mass_size,
            sonomammo_mass_size_unit, sonomammo_calc, sonomammo_calc_type,
            sonomammo_vasc, sonomammo_birad, sonomammo_impression, user_name,
            last_update
        ]
        columns_list = names(module_name)
        check = add_update_sql.review_input(file_number, columns_list,
                                            data_list)
    return tuple(data_list)
Exemple #14
0
def mammography(file_number='test'):
    module_name = "mammography"
    check = False
    while not check:
        mammo = ask_y_n_statement.ask_y_n(
            "Are mammography results available for this patient?")
        if not mammo:
            check_mammo = ask_y_n(
                "Is the diagnostic radiological report present?")
            if check_mammo:
                mammo = "Mammography not done for diagnosis"
            else:
                mammo = "Requires Follow-up"
            tomo, mammo_date, mammo_place, mammo_indication, mammo_breast, mass_number, mammo_mass_location, \
            mammo_mass_shape, mammo_mass_margin, mammo_mass_nipple_cm, mammo_mass_size, mammo_mass_size_unit,\
            calc_number, calc_location, calc_type, mammo_birad, mammo_impression, skin_lesion = (mammo,) * 18
        else:
            tomo = ask_y_n_statement.ask_y_n(
                "Have 3D Tomography images also been acquired?")
            if tomo:
                tomo = "Yes"
                print(
                    "Please include 3d-Tomo observations in Mammography results"
                )
            else:
                tomo = "No"
            mammo = "Mammography done"
            mammo_date = ask_y_n_statement.check_date("Date of mammography: ")
            mammo_place = ask_y_n("Was exam peformed at PCCM?",
                                  yes_ans="PCCM",
                                  no_ans="Outside")
            if mammo_place == "Outside":
                mammo_place = input(
                    "Please input Radiologist name and place (Name; Place): ")
            mammo_indication = input("Indication for mammography: ")
            mammo_breast = ask_y_n_statement.ask_option(
                "Details described for",
                ["Right Breast", "Left Breast", "Bilateral"])
            mammo_mass_location = ask_y_n_statement.ask_y_n(
                "Is there any mass/lesion detected")
            if mammo_mass_location:
                table = "Mammography_Mass"
                mass_number, mammo_mass_location, mammo_mass_shape, mammo_mass_margin, mammo_mass_nipple_cm, \
                mammo_mass_size, mammo_mass_size_unit = radio_tables.multiple_mass(table, mammo_breast)
            else:
                mass_number, mammo_mass_location, mammo_mass_shape, mammo_mass_margin, mammo_mass_nipple_cm, \
                mammo_mass_size, mammo_mass_size_unit= ("No mass detected", )*7
            calc = ask_y_n_statement.ask_y_n("Is Calcification present?")
            if calc:
                calc_number, calc_location, calc_type = radio_tables.cal_table(
                    file_number, mammo_breast)
            else:
                calc_number, calc_location, calc_type = (
                    "No Calcification detected", ) * 3
            skin_lesion = input(
                "Please input description of skin lesion if present: ")
            mammo_birad = ask_y_n_statement.ask_y_n(
                "Does the report include a BI-RAD assessment/diagnosis?")
            if mammo_birad:
                mammo_birad = radio_tables.birads()
            else:
                mammo_birad = "BI-RAD not assigned in report"
            mammo_impression = input("Input Impression(if available): ")
        data_list = [
            mammo, mammo_date, mammo_place, mammo_indication, mammo_breast,
            mass_number, mammo_mass_location, mammo_mass_shape,
            mammo_mass_margin, mammo_mass_nipple_cm, mammo_mass_size,
            mammo_mass_size_unit, calc_number, calc_location, calc_type,
            skin_lesion, mammo_birad, mammo_impression, tomo
        ]
        columns_list = names(module_name)
        check = add_update_sql.review_input(file_number, columns_list,
                                            data_list)
    return tuple(data_list)