コード例 #1
0
 def bio_info(self):
     module_name = "bio_info"
     new_data = ['NA'] * 16
     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"])
         height_cm, height_feet, height_inch, weight, bmi = ['NA'] * 5
         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 = 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(self.file_number, columns_list, new_data)
     return new_data
コード例 #2
0
 def surgery_block_information_3(self):
     module_name = self.module_list[3]
     review_surgery_date, review_surgery_source, review_surgery_diagnosis, review_surgery_diagnosis_comment, \
     review_surgery_block_id, review_surgery_er, review_surgery_er_percent, review_surgery_pr, review_surgery_pr_percent, \
     review_surgery_her2, review_surgery_her2_grade, review_surgery_fish, review_surgery_ki67 = ['NA', ] * 13
     data_list = ['NA', ] * 13
     check = False
     while not check:
         review = ask.ask_y_n('Has a review (of diagnosis or IHC details) been done of this surgery block?')
         if review:
             review_surgery_date = ask.check_date('Date of review (if multiple dates?): ')
             review_surgery_source = input(
                 'Name of Review Laboratory (Enter multiple if required Lab_test): ')
             review_surgery_diagnosis = input('Enter diagnosis of review: ')
             review_surgery_diagnosis_comment = input('Additional comments for review diagnosis: ')
             review_surgery_block_id = self.surgery_block_id
             block_id = ask.ask_y_n('Has the block been relabelled in the review?')
             if block_id:
                 old_block_id = input('Please enter old block id: ')
                 new_block_id = input('Please enter new block id: ')
                 review_surgery_block_id = old_block_id + ' relabelled to ' + new_block_id
             review_ihc = ask.ask_y_n('Has the IHC result for any marker been reviewed by another lab?')
             if review_ihc:
                 review_surgery_er, review_surgery_er_percent, review_surgery_pr, review_surgery_pr_percent, \
                 review_surgery_her2, review_surgery_her2_grade, review_surgery_fish, review_surgery_ki67 = \
                     BlockDescription.ihc_report('review_surgery')
         data_list = [review_surgery_date, review_surgery_source, review_surgery_diagnosis,
                      review_surgery_diagnosis_comment, review_surgery_block_id, review_surgery_er,
                      review_surgery_er_percent, review_surgery_pr, review_surgery_pr_percent, review_surgery_her2,
                      review_surgery_her2_grade, review_surgery_fish, review_surgery_ki67]
         col_list = names(module_name)
         check = sql.review_input(self.file_number, col_list[:-2], data_list)
     data = data_list + [self.user_name, sql.last_update()]
     return data
コード例 #3
0
def metastasis(file_number, user_name):
    check = False
    while not check:
        met_has = ask.ask_y_n(
            "Has the patient been examined for metastatic disease?")
        if not met_has:
            met_has = "Not examined for metastatic disease"
        else:
            met_has = "Examined for metastatic disease"
        date_last = ask.check_date("Date of last follow-up: ")
        recur = ask.ask_y_n("Has the patient experienced a recurrence?")
        if recur:
            time_recur = input("Time to disease recurrence: ")
            nature_recur = ask.ask_option("Nature of recurrence",
                                          ["Distant", "Local", "Other"])
            if nature_recur == "Distant":
                distant_site = input("Site of distant recurrence: ")
            else:
                distant_site = "NA"
        else:
            time_recur, nature_recur, distant_site = ("NA", ) * 3
        status = patient_status()
        data_list = [
            met_has, date_last, time_recur, nature_recur, distant_site, status,
            user_name,
            last_update()
        ]
        col_list = names.names_longterm("metastasis")
        check = review_input(file_number, col_list, data_list)
    return data_list
コード例 #4
0
 def report(self):
     data_list = ask.default_data_list(self.col_list_all)
     check = False
     while not check:
         reason_report = ask.ask_option(
             "What is the purpose of this report"
             "?", MultiTest.test_reason_imaging)
         report_date = ask.check_date("Date of examination of ABVS: ")
         abvs_acc = input("Accession number of ABVS: ")
         abvs_lesion = ask.ask_option("Location of lesion",
                                      MultiTest.breast_cancer)
         if abvs_lesion in {MultiTest.breast_cancer}:
             abvs_lesion_data = radio_tables.lesion_location(abvs_lesion)
         else:
             abvs_lesion_data = "NA"
         abvs_size = ask.ask_option("Size of lesion",
                                    ["<2 cm", "2-5 cm", ">5 cm", "Other"])
         abvs_dist = ask.ask_option("Distance from Skin (cm)",
                                    ["<0.5 cm", ">0.5 cm", "Other"])
         abvs_pect = input("Distance from Pectoralis Major (cm): ")
         abvs_diagnosis = ask.ask_option("ABVS Diagnosis", Radio.diagnosis)
         data_list = [
             self.file_number, reason_report, report_date, abvs_acc,
             abvs_lesion, abvs_lesion_data, abvs_size, abvs_dist, abvs_pect,
             abvs_diagnosis
         ]
         check = sql.review_input(self.file_number, self.col_list_all[:-2],
                                  data_list)
     data_list = data_list + [self.user_name, sql.last_update()]
     return data_list
コード例 #5
0
 def pet_report_identifier(self):
     module_name = self.module_list[0]
     check = False
     report_identifier = ['NA'] * 12
     while not check:
         pet_scan_date = ask.check_date('Please enter PET report date: ')
         pet_scan_number = input(
             'Please enter PET scan number as given on the report: ')
         pet_scan_source = input(
             'Please enter the facility at which PET scan was done: ')
         pet_scan_reg_number = input(
             "Please enter PET report registration number: ")
         pet_scan_history = input(
             'Please input patient history as given on report: ')
         pet_carcinoma_status = ask.ask_option(
             'Please enter breast cancer status',
             MultiTest.carcinoma_status)
         pet_cancer_location = ask.ask_list(
             'What is the location of the cancer', MultiTest.breast_cancer)
         pet_recurrence = ask.ask_y_n(
             'Does the patient have a previously detected recurrence/mets?')
         if pet_recurrence:
             pet_recurrence_known = input(
                 'Please describe the recurrence/metastasis: ')
         else:
             pet_recurrence_known = 'no_known_recurrence_or_metastasis'
         pet_procedure_body_region = ask.ask_list(
             "Region of body monitored by PET scan", PetReport.body_region)
         pet_procedure_fdg_dose_mci = ask.check_number_input(
             "Please enter dose of 18F-FDG used in mCi. ",
             "(Please enter only dose. If given in other units "
             "enter under additional notes.): ")
         pet_procedure_bsl = input(
             "Please enter basal sugar level with units as given: ")
         pet_scanner_name = ask.ask_list('Please enter name of scanner',
                                         PetReport.machine_name)
         pet_procedure_additional_notes = input(
             'Please enter additional notes, if any for PET scan and patient '
             'conditions: ')
         report_identifier = [
             self.file_number, pet_scan_date, pet_scan_number,
             pet_scan_source, pet_scan_reg_number, pet_scan_history,
             pet_carcinoma_status, pet_cancer_location,
             pet_recurrence_known, pet_procedure_body_region,
             pet_procedure_fdg_dose_mci, pet_procedure_bsl,
             pet_scanner_name, pet_procedure_additional_notes
         ]
         columns_list = names(module_name)
         check = sql.review_input(self.file_number, columns_list,
                                  report_identifier)
     return report_identifier
コード例 #6
0
 def det_by(self):
     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(self.file_number, columns_list, data_list)
     return data_list
コード例 #7
0
 def clip_information(self):
     clip_number, clip_date, clip_cycle = ['NA, '] * 3
     data_list = clip_number, clip_date, clip_cycle
     check = False
     while not check:
         clip = ask.ask_y_n("Was Clip inserted for surgery?")
         if clip:
             clip_number = input("Number of clips inserted: ")
             clip_date = ask.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 = sql.review_input(self.file_number, col_list, data_list)
     return data_list
コード例 #8
0
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)
コード例 #9
0
 def surgery_block_information_0(self):
     module_name = self.module_list[0]
     check = False
     data_list = ['NA']*17
     surgery_block_data_type = 'primary'
     while not check:
         data_type = ask.ask_y_n("Is surgery type: '" + surgery_block_data_type + "'")
         if not data_type:
             surgery_block_data_type = ask.ask_option("Type of surgery", ['revision', 'recurrence'])
         block_list_table = BlockInformation(self.conn, self.cursor, self.file_number)
         block_data = ['block_sr_number', 'block_location', 'current_block_location', 'block_series']
         block_sr_number, block_location, current_block_location, surgery_block_series = \
             block_list_table.get_block_information(self.surgery_block_id, block_data)
         surgery_block_source = ask.ask_option("Pathology Lab (source of block)", PathReports.path_labs)
         breast_cancer_yes_no = ask.ask_y_n('Is this a case of breast cancer (Unilateral OR Bilateral)',
                                            yes_ans="breast_cancer_yes", no_ans="breast_cancer_no")
         pathology_report_available_yes_no = ask.ask_y_n('Is the pathology report available', yes_ans="yes",
                                                         no_ans="no")
         nat = ask.ask_y_n('Has Neo-Adjuvant therapy been administered to the patient (NACT or NAHT)?')
         if nat:
             nact = ask.ask_list('What type of therapy has been givent to the patient?',
                                 ['NACT', 'NAHT', 'NACT_and_NAHT'])
             neoadjuvant_therapy = nact.lower() + '_yes'
             surgery_block_primary_tissue = 'treated_tissue'
         else:
             neoadjuvant_therapy = 'nact_no'
             surgery_block_primary_tissue = 'primary_tissue'
         date_of_surgery = ask.check_date("Date of Surgery: ")
         surgeon_s = ask.ask_option("Name of the Surgeon/s", PathReports.surgeon)
         surgery_hospital_id = input("Hospital ID: ")
         surgery_lesion_site = ask.ask_list("Lesion on", ["right_breast", "left_breast", "bilateral"])
         surgery_type = self.bilateral_treatment(surgery_lesion_site, 'Type of surgery', PathReports.surgery_type)
         data_list = [self.file_number, surgery_block_data_type, block_sr_number, block_location,
                      current_block_location, self.surgery_block_id, self.surgery_number_of_blocks,
                      surgery_block_series, breast_cancer_yes_no, pathology_report_available_yes_no,
                      neoadjuvant_therapy, str(surgery_block_primary_tissue).lower(), surgery_block_source,
                      date_of_surgery, surgeon_s, surgery_hospital_id, surgery_lesion_site, surgery_type]
         columns_list = names(module_name)
         check = sql.review_input(self.file_number, columns_list, data_list)
     return data_list
コード例 #10
0
 def biopsy_report_info(self):
     module = 'biopsy_report_info'
     col_list = names.names_biopsy(module)
     check = False
     data_list = [self.file_number] + (['To be done'] * 18)
     while not check:
         block_list_table = BlockInformation(self.conn, self.cursor,
                                             self.file_number)
         block_data = [
             'block_sr_number', 'block_location', 'current_block_location',
             'blocks_received_at_pccm', 'block_series'
         ]
         block_sr_number, block_location, current_block_location, blocks_received_at_pccm, biopsy_block_series = \
             block_list_table.get_block_information(block_id=self.biopsy_block_id, block_data=block_data)
         fnac = ask.ask_list('FNAC done for breast lesion?',
                             ['fnac_breast_yes', 'fnac_breast_no'])
         if fnac == 'fnac_breast_no':
             fnac_breast, fnac_breast_date, fnac_slide_id, fnac_diagnosis, fnac_diagnosis_comments = (
                 fnac, ) * 5
         else:
             fnac_breast = ask.ask_list('FNAC location', [
                 'left_breast', 'right_breast', 'requires_specialist_input'
             ])
             fnac_breast_date = ask.check_date('Date of FNAC test: ')
             fnac_slide_id = input('Enter FNAC slide ID: ')
             fnac_diagnosis = input(
                 'Enter diagnosis for FNAC breast as given in report: ')
             fnac_diagnosis_comments = input(
                 'Enter additional comments for FNAC diagnosis: ')
         biopsy_date = ask.check_date('Date of Biopsy: ')
         reason_path_report = ask.ask_list('Reason for pathology report', [
             'diagnosis', 'bilateral_diagnosis', 'review_biopsy',
             'nact_follow up', 'recurrence_diagnosis', 'revision_surgery',
             'requires_specialist_input'
         ])
         biopsy_site = ask.ask_list('Biopsy_site', [
             'left_breast', 'right_breast', 'left_axilla', 'right_axilla',
             'requires_specialist_input'
         ])
         biopsy_report_pccm = ask.ask_list(
             "Is the biopsy report available?", [
                 "biopsy_report_pccm_yes", "biopsy_report_pccm_no",
                 'doctors_notes_available', 'path_history_notes',
                 'requires_specialist_input'
             ])
         if biopsy_report_pccm != 'biopsy_report_pccm_no':
             biopsy_block_source = ask.ask_option('Source of Biopsy Block',
                                                  PathReports.path_labs)
             biopsy_lab_id = input("Biopsy Lab ID/SID: ")
         else:
             biopsy_block_source, biopsy_lab_id = ('NAv', ) * 2
         biopsy_ihc_report_pccm = ask.ask_list(
             "Is the IHC report available?", [
                 "biopsy_ihc_report_pccm_yes", "biopsy_ihc_report_pccm_no",
                 'doctors_notes_available', 'path_history_notes_available',
                 'requires_specialist_input'
             ])
         data_list = [
             self.file_number, block_sr_number, block_location,
             current_block_location, blocks_received_at_pccm, fnac_breast,
             fnac_breast_date, fnac_slide_id, fnac_diagnosis,
             fnac_diagnosis_comments, reason_path_report, biopsy_site,
             biopsy_report_pccm, biopsy_ihc_report_pccm,
             self.biopsy_block_id, self.biopsy_number_of_blocks,
             biopsy_block_series, biopsy_date, biopsy_block_source,
             biopsy_lab_id
         ]
         print(data_list)
         check = sql.review_input(self.file_number, col_list, data_list)
     data = data_list
     return data
コード例 #11
0
    def report(self):
        data_list = ask.default_data_list(self.col_list_all)
        check = False
        while not check:
            reason_report = ask.ask_option(
                "What is the purpose of this repor"
                "t?", MultiTest.test_reason_imaging)
            report_date = ask.check_date("Date of examination of ultrsound: ")
            mammo_place = ask.ask_y_n("Was exam peformed at PCCM?",
                                      yes_ans="PCCM",
                                      no_ans="Outside")
            if mammo_place == "Outside":
                sonomammo_place = input("Please input Radiologist name and"
                                        " place (Name; Place): ")
            else:
                sonomammo_place = mammo_place
            sonomammo_breast = ask.ask_option("Details described for",
                                              MultiTest.breast_cancer)
            mass_sonomammo = ask.ask_y_n("Is there any mass detected")
            breast = sonomammo_breast
            masscalc = radio_tables.MassCalcification(self.table, breast,
                                                      self.file_number,
                                                      self.user_name)
            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 = masscalc.multiple_mass()
            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.ask_option("Calcification",
                                            MultiTest.breast_cancer)
            if sonomammo_calc in MultiTest.breast_cancer:
                sonomammo_calc_type = ask.ask_option("Calcification location",
                                                     Radio.calcification)
            else:
                sonomammo_calc_type = "NA"
            sonomammo_vasc = ask.ask_option("Vascularity", Radio.vascularity)
            sono_birad = ask.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): ")
            node_description = ask.ask_y_n(
                'Does the report include description of nodes?')
            if node_description:
                sonomammo_node_description = input(
                    'Please enter description of nodes: ')
                sonomammo_node_size = input(
                    'Size of node if reported without unit (else enter NA): ')
                sonomammo_node_size_unit = input('Unit of node size')
            else:
                sonomammo_node_description, sonomammo_node_size, sonomammo_node_size_unit = (
                    'nodes_not_described', ) * 3
            data_list = [
                self.file_number, reason_report, report_date, sonomammo_place,
                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_node_description,
                sonomammo_node_size, sonomammo_node_size_unit,
                sonomammo_impression
            ]
            check = sql.review_input(self.file_number, self.col_list_all[:-2],
                                     data_list)
        data_list = data_list + [self.user_name, sql.last_update()]
        return data_list
コード例 #12
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
コード例 #13
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
コード例 #14
0
    def report(self):
        data_list = ask.default_data_list(self.col_list_all)
        check_mammo = ask.ask_option("What is the purpose of this report?",
                                     MultiTest.test_reason_imaging)
        reason_report = check_mammo
        check = False
        while not check:
            mammo = ask.ask_y_n("Are mammography results available for this "
                                "patient?")
            if mammo:
                tomo = ask.ask_y_n("Have 3D Tomography images also been "
                                   "acquired?")
                if tomo:
                    tomography_y_n = "Yes"
                    print("Please include 3d-Tomo observations in Mammography "
                          "results")
                else:
                    tomography_y_n = "No"
                report_date = ask.check_date("Date of mammography: ")
                mammo_place = ask.ask_y_n("Was exam peformed at PCCM?",
                                          yes_ans="PCCM",
                                          no_ans="Outside")
                if mammo_place == "Outside":
                    mammography_place = input("Please input Radiologist name "
                                              "and place (Name; Place): ")
                else:
                    mammography_place = mammo_place
                mammography_indication = input("Indication for mammography: ")
                mammography_breast = ask.ask_option("Details described for",
                                                    MultiTest.breast_cancer)
                # masscalc = radio_tables.MassCalcification(self.table,
                #   mass_breast,
                #   self.file_number,
                #   self.user_name)
                mammo_mass = ask.ask_y_n("Is there any mass/lesion detected? ")
                mass_all = []
                mass_data = ['no_mass_detected']
                mass_all.append(mass_data)
                [
                    mammography_massnumber, mammography_masslocation,
                    mammography_massshape, mammography_massmargin,
                    mammography_massnipple_cm, mammography_masssize,
                    mammography_masssize_unit
                ] = ("No mass detected", ) * 7
                if mammo_mass:
                    mass_breast = ask.ask_option(
                        'What is the location of the'
                        ' lesions?', MultiTest.breast_cancer)

                    masscalc = radio_tables.MassCalcification(
                        self.table, mass_breast, self.file_number,
                        self.user_name)
                    # mass_data = mass.multiple_mass()
                    mass_data = masscalc.multiple_mass()
                    mammography_massnumber, mammography_masslocation,
                    mammography_massshape, mammography_massmargin,
                    mammography_massnipple_cm, mammography_masssize,
                    mammography_masssize_unit = mass_data[:-2]
                mammography_calcificationnumber,
                mammography_calcificationlocation,
                mammography_calcificationtype,
                mammography_calcification_comments = ("No Calcification"
                                                      " detected", ) * 4
                calc = ask.ask_y_n("Is Calcification present?")
                if calc:
                    mammography_calcificationnumber,
                    mammography_calcificationlocation,
                    mammography_calcificationtype,
                    mammography_calcification_comments = radio_tables.cal_table(
                        self.file_number, mammography_breast)
                mammography_skin_involvement = input("Please input description"
                                                     " of skin involvement if "
                                                     "present: ")
                mammography_node_description, mammography_node_size,
                mammography_node_size_unit = ('nodes_not_described', ) * 3
                node_description = ask.ask_y_n('Does the report include '
                                               'description of nodes?')
                if node_description:
                    mammography_node_description = input('Please enter '
                                                         'description of nodes'
                                                         ': )')
                    mammography_node_size,
                    longest_dimension = ask.check_size_input()
                    mammography_node_size_unit = 'NA'
                    if mammography_node_size != 'NA':
                        mammography_node_size_unit = ask.ask_list(
                            'Unit of node size: ', MultiTest.size_unit)
                mammo_birad = ask.ask_y_n('Does the report include a BI-RAD'
                                          'assessment/diagnosis?')
                if mammo_birad:
                    mammography_birad = radio_tables.birads()
                else:
                    mammography_birad = "BI-RAD not assigned in report"
                mammography_impression = input('Input Impression(if available'
                                               '): "')
                data_list = [
                    reason_report, report_date, mammography_place,
                    mammography_indication, mammography_breast,
                    mammography_massnumber, mammography_masslocation,
                    mammography_massshape, mammography_massmargin,
                    mammography_massnipple_cm, mammography_masssize,
                    mammography_masssize_unit, mammography_calcificationnumber,
                    mammography_calcificationlocation,
                    mammography_calcificationtype,
                    mammography_calcification_comments,
                    mammography_skin_involvement, mammography_node_description,
                    mammography_node_size, mammography_node_size_unit,
                    mammography_birad, mammography_impression, tomography_y_n,
                    self.user_name, sql.last_update
                ]
                data_list = [self.file_number] + data_list
            else:
                data_list = [self.file_number] + data_list
            check = sql.review_input(self.file_number, self.col_list_all[:-2],
                                     data_list)
        data_list = data_list + [self.user_name, sql.last_update()]
        return data_list
コード例 #15
0
 def report(self):
     data_list = ask.default_data_list(self.col_list_all)
     check = False
     while not check:
         reason_report = ask.ask_option(
             "What is the purpose of this report?",
             MultiTest.test_reason_imaging)
         report_date = ask.check_date("Date of examination: ")
         mri_place = ask.ask_y_n("Was exam peformed at PCCM?",
                                 yes_ans="PCCM",
                                 no_ans="Outside")
         mri_breast_acc = input("Accession number of MRI: ")
         mri_breast_described = ask.ask_option("Details described for",
                                               MultiTest.breast_cancer)
         fgt_mri = ask.ask_option("Ammount of Fibroglandular Tissue", [
             "a. Almost entirely fat", "b. Scattered fibroglandular tissue",
             "d. Extreme fibroglandular tissue", "Other"
         ])
         bpe_level_mri = ask.ask_option(
             "Background parenchymal enhancement Level",
             ["Minimal", "Mild", "Moderate", "Marked", "Other"])
         bpe_symm_mri = ask.ask_option(
             "Background parenchymal enhancement Symmetry",
             ["Symmetric", "Asymmetric", "Other"])
         focus_mri = input("Details of Focus: ")
         mass_mri = ask.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.ask_option(index, MultiTest.breast_cancer)
             asso_feat_data.append(var)
         asso_feat_9 = ask.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.ask_option("Fat Containing Lesions", [
             "Lymph nodes: Normal", "Lymph nodes: Abnormal", "Fat necrosis",
             "Hamartoma", "Postoperative seroma", "hematoma with fat"
         ])
         mri_breast_kinetics_initial = ask.ask_option(
             "Kinetic curve assessment Signal intensity "
             "(SI)/time curve description (Initial Phase)",
             ["Slow", "Medium", "Fast", "Other"])
         mri_breast_kinetics_delayed = ask.ask_option(
             "Kinetic curve assessment Signal intensity "
             "(SI)/time curve description (Delayed Phase)",
             ["Persistent", "Plateau", "Washout", "Other"])
         mri_breast_non_enhance = ask.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.ask_option("Location of lesion",
                                            MultiTest.breast_cancer)
         if mri_breast_lesion in {MultiTest.breast_cancer}:
             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.ask_option(
             "Size of lesion", ["<2 cm", "2-5 cm", ">5 cm", "Other"])
         mri_breast_dist = ask.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.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"
         data_list = [
             self.file_number, reason_report, report_date, mri_place,
             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
         ]
         check = sql.review_input(self.file_number, self.col_list_all[:-2],
                                  data_list)
     data_list = data_list + [self.user_name, sql.last_update()]
     return data_list
コード例 #16
0
    def edit_block_id(self):
        file_number = 'test'
        check_file = False
        while not check_file:
            print('add_update_patient')
            file_number = input("Enter File Number: ")
            print("File Number: " + file_number)
            check_file = ask.ask_y_n("Is this file number correct")
        action = ask.ask_list('What values are to be updated?', [
            'patient_name', 'mr_number', 'date_of_birth', 'date_first_visit',
            'block_sr_number', 'block_location', 'block_type', 'block_id',
            'current_block_location', 'blocks_received_at_pccm',
            'number_of_blocks', 'block_series', 'consent'
        ])
        columns_action = [action] + ['update_by', 'last_update']
        update_user = [self.user_name, sql.last_update()]
        if action == 'consent':
            data = list(self.get_consent(file_number)) + update_user
            print(data)
            sql.update_multiple_key(self.conn,
                                    self.cursor,
                                    self.table_name,
                                    columns=[
                                        'consent_discussed', 'consent',
                                        'update_by', 'last_update'
                                    ],
                                    key_name='file_number',
                                    key_value=file_number,
                                    data=data)
        elif action in {
                'patient_name', 'block_sr_number', 'block_location',
                'blocks_received_at_pccm', 'mr_number', 'date_of_birth',
                'date_first_visit'
        }:
            data_old = sql.get_value_no_error(col_name=action,
                                              table=self.table_name,
                                              pk=file_number,
                                              pk_name='file_number',
                                              cursor=self.cursor)
            print(action + ' is currently set as: ' + data_old)
            change = ask.ask_y_n('Do you want to change this?')
            if change:
                data_new = ['NA'] + update_user
                check = False
                while not check:
                    if action in {
                            'blocks_recieved_at_pccm', 'date_of_birth',
                            'date_first_visit'
                    }:
                        data = ask.check_date('Please enter ' + action + ': ')
                    elif action == 'block_location':
                        data = block_location_format()
                    else:
                        data = input('Please input ' + action)
                    if action in BlockList.unique_values:
                        check = sql.check_value_not_exist(
                            self.cursor, action, data, self.table_name)
                    else:
                        check = True
                    data_new = [data] + update_user
                sql.update_multiple_key(self.conn,
                                        self.cursor,
                                        self.table_name,
                                        columns=columns_action,
                                        key_name='file_number',
                                        key_value=file_number,
                                        data=data_new)
        elif action in {
                'current_block_location', 'number_of_blocks', 'block_series',
                'block_type', 'block_id'
        }:
            check = False
            block_list = sql.extract_select_column_key(self.conn,
                                                       self.columns,
                                                       self.table_name,
                                                       col_select='block_id',
                                                       key_name='file_number',
                                                       key_value=file_number)

            block_id = ask.ask_list(
                action + ' information is to be entered for: ', block_list)
            pk = sql.extract_select_column_key(self.conn,
                                               self.columns_db,
                                               self.table_name,
                                               col_select='pk',
                                               key_name='block_id',
                                               key_value=block_id)
            # function returns a set so need to convert to str.
            pk = list(pk)[0]
            data = action
            while not check:
                print('BlockList.edit_values[action]: ',
                      BlockList.edit_values[action])
                data = ask.ask_list(action + ' of ' + block_id,
                                    BlockList.edit_values[action])
                if action in BlockList.unique_values:
                    check = sql.check_value_not_exist(self.cursor, action,
                                                      data, self.table_name)
                else:
                    check = True
            if data is set:
                data = list(data)
            data_new = [data] + update_user
            print(data_new, pk)
            sql.update_multiple_key(self.conn,
                                    self.cursor,
                                    self.table_name,
                                    columns=columns_action,
                                    key_name='pk',
                                    key_value=str(pk),
                                    data=data_new)
コード例 #17
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
コード例 #18
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
コード例 #19
0
 def add_block_id(self, file_number):
     block_df = self.block_data
     pk = uuid.uuid4().hex
     data_list = self.columns
     check = False
     while not check:
         check_name = False
         while not check_name:
             patient_name = input('Please enter patient name: '),
             print('Patient name: ' + str(patient_name))
             check_name = ask.ask_y_n('Is name correct')
         mr_number = self.check_block_value_in_db(
             input_statement='Please enter MR number: ',
             value_name='mr_number',
             integer=True)
         date_of_birth = self.get_value_and_check_value(
             col_name='date_of_birth',
             file_number=file_number,
             input_statement='Please input patient date of birth '
             '(format: dd.mm.yyyy): ',
             integer=False)
         date_first_visit = ask.check_date(
             'Please enter date of first visit: ')
         block_sr_number = self.check_block_value_in_db(
             input_statement='Please enter block serial number: ',
             value_name='block_sr_number',
             integer=True)
         block_pccm = ask.ask_y_n(
             'Have these blocks been recieved at PCCM?')
         block_location, blocks_received_at_pccm = [
             'NA',
         ] * 2
         if block_pccm:
             block_location_check = False
             while not block_location_check:
                 block_location = block_location_format()
                 block_location_check = sql.check_value_not_exist(
                     self.cursor,
                     value_name='block_location',
                     value=block_location,
                     table=self.table_name)
             blocks_received_at_pccm = ask.check_date_or_today(
                 'Please enter date blocks recieved at PCCM (or '
                 'today): ')
         consent_discussed, consent = self.get_consent(file_number)
         block_id = self.check_block_value_in_db(
             input_statement='Please enter block id: ',
             value_name='block_id',
             integer=False)
         block_type = ask.ask_list('Block type', ['biopsy', 'surgery'])
         if blocks_received_at_pccm == 'NA':
             number_of_blocks, block_series, current_block_location = [
                 'NA',
             ] * 3
         else:
             number_of_blocks = ask.check_number_input(
                 'Please enter number of blocks recieved at PCCM: ',
                 'Number of blocks has to be a whole number or NA')
             block_series = input(
                 "Series of blocks recieved (Please enter series in the form A-B and separate "
                 "series by '|' e.g, A-B|E): ")
             current_block_location = ask.ask_list(
                 'Current location of block',
                 BlockList.edit_values['current_block_location'])
         data_list = [
             pk, file_number, patient_name, mr_number, date_of_birth,
             date_first_visit, block_sr_number, block_location, block_type,
             block_id, current_block_location, blocks_received_at_pccm,
             number_of_blocks, block_series,
             str(consent_discussed), consent, self.user_name,
             sql.last_update()
         ]
         block_df.loc[pk] = data_list
         check, block_df = sql.review_df_row(block_df)
     return data_list[1:], pk
コード例 #20
0
    def follow_up(self):
        follow = True
        follow_index = 0
        col_list = ["file_number"] + names()

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