def tumour_biopsy_data(self): module_name = "tumour_biopsy_data" columns_list = names(module_name) df_cols = columns_list[:-2] data_list_df = pd.DataFrame(columns=df_cols) try: ihc_biopsy = sql.get_value(col_name='IHC_report_PCCM_yes_no', table=self.table, file_number=self.file_number, cursor=self.cursor) except sqlite3.Error: ihc_biopsy = ask.ask_y_n_na("Is the IHC report available?", yes_ans="IHC_report_PCCM_yes", no_ans="IHC_report_PCCM_no", na_ans="IHC Not Done") check = False while not check: try: breast_biopsy = sql.get_value(col_name='Breast_Biopsy', table=self.table, file_number=self.file_number, cursor=self.cursor) except sqlite3.Error: 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 + ' block only') tumour_er, tumour_er_percent, tumour_pr, tumour_pr_percent, tumour_her2, tumour_her2_grade, \ tumour_fish, tumour_ki67 = (ihc_biopsy, )* 8 if ihc_biopsy == 'IHC_report_PCCM_yes': ihc_data = BlockDescription.ihc_report() tumour_er, tumour_er_percent, tumour_pr, tumour_pr_percent, tumour_her2, tumour_her2_grade, \ tumour_fish, tumour_ki67 = ihc_data fnac = ask.ask_y_n_na(question=("Lymph Node biopsy FNAC for " + breast), yes_ans="Lymph_Node_biopsy_FNAC_yes", no_ans="Lymph_Node_biopsy_FNAC_no", na_ans="Data not in report") fnac_location, fnac_diagnosis = (fnac,) * 2 if fnac == "Lymph_Node_biopsy_FNAC_yes": fnac_location = input("Please enter lymph node biopsy location: ") fnac_diagnosis = ask.ask_option("Lymph Node biopsy diagnosis", ["Lymph_Node_biopsy_malignant", "Lymph_Node_biopsy_non_malignant", "Data not in report"]) df_data = [tumour_er, tumour_er_percent, tumour_pr, tumour_pr_percent, tumour_her2, tumour_her2_grade, tumour_fish, tumour_ki67, fnac, fnac_location, fnac_diagnosis] 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 data_list = BlockDescription.rb_lb_data(data_list_df, df_cols) check = sql.review_input(self.file_number, columns_list, data_list) last_update = datetime.now().strftime("%Y-%b-%d %H:%M") data_list = data_list+[last_update]+[self.user_name] return data_list
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
def surgery_block_information_3(self): module_name = self.module_list[2] check = False while not check: surgery_er, surgery_er_percent, surgery_pr, surgery_pr_percent, surgery_her2, surgery_her2_grade, \ surgery_fish, surgery_ki67, = BlockDescription.ihc_report() sentinel, sent_number_rem, sent_number_pos = SurgeryBlockData.node_details( "Sentinel") ax, ax_number_rem, ax_number_pos = SurgeryBlockData.node_details( "Axillary") ap, ap_number_rem, ap_number_pos = SurgeryBlockData.node_details( "Apical") per_spread = ask.ask_y_n_na("Perinodal Spread", yes_ans='Yes', no_ans='No', na_ans='Data not in Report') supra_inv = ask.ask_y_n_na("Supraclavicular Node Involvment", yes_ans='Yes', no_ans='No', na_ans='Data not in Report') data_list = [ surgery_er, surgery_er_percent, surgery_pr, surgery_pr_percent, surgery_her2, surgery_her2_grade, surgery_fish, surgery_ki67, sentinel, sent_number_rem, sent_number_pos, ax, ax_number_rem, ax_number_pos, ap, ap_number_rem, ap_number_pos, per_spread, supra_inv ] columns_list = names(module_name) check = sql.review_input(self.file_number, columns_list, data_list) return (tuple(data_list))
def mammo_mass(self, mass_id): print(self.table, mass_id) check = False data_list = ask.default_data_list(self.col_list) while not check: mass_location = self.mammo_breast if self.mammo_breast == "bilateral": mass_location = ask.ask_option("Location of mass " + str(mass_id), RadioTables.breast) mass_quadrant = ask.ask_list('Quadrant location of lesion', Radio.lesion_quadrant) mammo_mass_shape = ask.ask_option("Shape of mass", RadioTables.mass_shape) mammo_mass_margin = ask.ask_option("Margins of mass", RadioTables.mass_margin) mass_nipple = input("Distance from nipple (cm): ") mass_dimension, mass_size_unit, mass_longest_dimension = self.lesion_size() modality = self.table data_list = [self.file_number, mass_location, mass_name, mass_quadrant, mammo_mass_shape, mammo_mass_margin, mass_nipple, mass_dimension, mass_longest_dimension, mass_size_unit, modality] check = sql.review_input(self.file_number, columns=self.col_list, data=data_list) data_list = data_list + [self.user_name, sql.last_update()] return data_list
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
def mri_mass(self, mass_id): check = False data_list = ask.default_data_list(self.col_list) while not check: if self.mammo_breast == "bilateral": mass_location = ask.ask_option("Location of mass " + str( mass_id), RadioTables.breast) else: mass_location = self.mammo_breast check_t1_t2 = ask.ask_y_n('Are both T1 and T2 image analysis' 'available for this mass?') type_of_imaging = ['T1', 'T2'] if not check_t1_t2: type_of_imaging = ask.ask_list('Observation of this mass is a' 'result of which type of' 'imaging? ', RadioTables.mri_image_type) data_list = self.mri_mass_detail(type_of_imaging, mass_id) if type_of_imaging in {'T1', 'T2'}: data_list = [('{0}_{1}'.format(type_of_imaging, data)) for data in data_list] mass_name = "Lesion " + str(mass_id) data_list = [self.file_number, mass_location, mass_name]+data_list check = sql.review_input(self.file_number, columns=self.col_list, data=data_list) data_list = [data_list] + [self.user_name, sql.last_update()] data_list = data_list + [self.user_name, sql.last_update()] return data_list
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 = input("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_old.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 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))
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
def metastasis_symp(file_number): module_name = "metastasis_symp" check = False while not check: met_none = ask_y_n("Metastatis Symptoms Present?") met = [] if not met_none: met = [["No Metastatis Symptoms"]] else: met_bone = ask_y_n("Bone Pain") if met_bone: met.append(["Bone Pain"]) met_cough = ask_y_n("Cough") if met_cough: met.append(["Cough"]) met_jaundice = ask_y_n("Jaundice") if met_jaundice: met.append(["Jaundice"]) met_headache = ask_y_n("Headache") if met_headache: met.append(["Headache"]) met_weight = ask_y_n("Weight loss") if met_weight: met.append(["WeightLoss"]) met_flat = [item for sublist in met for item in sublist] data_met = "; ".join(met_flat) columns_list = pccm_names.names_info(module_name) check = review_input(file_number, columns_list, [data_met]) return (str(data_met))
def node_excision (file_number): check = False while not check: surgery_guide, frozen, gross_tumour, skin, nodes, number_lymph, level_lymph, sentinel_method, sentinel_blue, \ sentinel_hot, sentinel_blue_hot, sentinel_non_blue_hot, sentinel_palpable = (" ",)*13 guide_add = True guide = [] while guide_add: surgery_guide = ask_option("Excision guided by", ["Palpation", "USG guided", "Wire placement guided", 'Gamma camera guided', 'Clipped node']) guide.append(surgery_guide) guide_add = ask_y_n("Add another method to guide?") surgery_guide = "; ".join(guide) frozen_samples = ask_option_y_n("Any samples sent for histopathology (frozen)?") if frozen_samples == 'Yes': frozen_samples = [] sn_frozen = ask_y_n("Sentinel Node sent for histopathology (frozen)?", yes_ans="Sentinel Node") if sn_frozen == 'Sentinel Node': frozen_samples.append(sn_frozen) specimen_frozen = ask_y_n_na("Specimen sent for histopathology (frozen)?") if specimen_frozen == 'Yes': nipple_frozen = ask_y_n_na("Under Nipple Surface sent for histopathology (frozen)?", yes_ans='Under Nipple Surface') if nipple_frozen == 'Under Nipple Surface': frozen_samples.append(nipple_frozen) other_frozen = ask_y_n_na("Any other specimen sent for histopathology (frozen)?") if other_frozen == 'Yes': other_frozen = input("Type of tissue sent for histopathology (frozen): ") frozen_samples.append(other_frozen) frozen = "; ".join(frozen_samples) else: frozen = "NA" gross_tumour = input ("Size of tumour on cross section (cm): ") skin = ask_option_y_n("Skin involved", yes_ans="Skin involved", no_ans="Skin not involved") nodes = ask_option("Nodes excised", ["Sentinel Node", "Sentinel and Axillary Nodes", "Axillary Nodes only", "Other"]) number_lymph = input("Number of lymph nodes excised (if available): ") level_lymph = ask_option("Level of lymph node excised", ["I", "II", "III", "Data not available", "Other"]) if nodes == 'Axillary Nodes only': sentinel_method, sentinel_blue, sentinel_hot, sentinel_blue_hot, sentinel_non_blue_hot, sentinel_palpable = \ ('No Sentinel Node excised', )*6 else: sentinel_method = ask_option("Method of labelling Sentinel Node", ["Isotope", "Blue Dye", "Isotope + Blue Dye", "Not done", "Other"]) sentinel_blue = ask_option_y_n("Blue Node", yes_ans="Blue Node", no_ans="No Blue Node") sentinel_hot = ask_option_y_n("Hot Node", yes_ans="Hot Node", no_ans="No Hot Node") sentinel_blue_hot = ask_option_y_n("Blue Hot Node", yes_ans="Blue Hot Node", no_ans="No Blue Hot Node") sentinel_non_blue_hot = ask_option_y_n("Non Blue, Hot Node", yes_ans= "Non Blue, Hot Node", no_ans="No Non Blue, Hot Node") sentinel_palpable = ask_option_y_n("Palpable Node", yes_ans="Palpable Node", no_ans="No Palpable Node") data_list = [surgery_guide, frozen, gross_tumour, skin, nodes, number_lymph, level_lymph, sentinel_method, sentinel_blue, sentinel_hot, sentinel_blue_hot, sentinel_non_blue_hot, sentinel_palpable] col_list = names("node_excision") check = add_update_sql.review_input(file_number, col_list, data_list) return data_list
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
def pet_breast_cancer(self): module_name = self.module_list[2] breast_report = [ 'NA', ] * 7 check = False while not check: pet_breast = ask.ask_y_n( 'Does this report describe a breast cancer?') if pet_breast: print('\nPlease describe primary breast lesion\n') pet_breast_lesion_size = input( 'Dimensions of breast lesion/s: ') pet_breast_lesion_size_unit = ask.ask_list( 'Unit of breast lesion size', ['mm', 'cm']) pet_breast_lesion_suv = ask.check_number_input( 'Please enter SUV max of breast lesion: ', 'Please enter only SUV not description') pet_breast_lesion_location = input( 'Please enter description of lesion location: ') pet_breast_lesion_type = input( 'Please input description of lesion: ') pet_breast_lesion_comments = input( 'Please input any additional notes for breast lesion: ') pet_breast_nodes = ask.ask_y_n( 'Does the report describe breast related nodes?') if pet_breast_nodes: pet_breast_nodes_description = input( 'Please enter nodes description as given: ') else: pet_breast_nodes_description = 'nodes_not_described' pet_breast_skin = ask.ask_y_n( 'Does the PET report describe any skin changes?') if pet_breast_skin: pet_breast_lesion_skin = input( 'Please enter description of skin changes: ') else: pet_breast_lesion_skin = 'skin_changes_not_described' else: pet_breast_lesion_size, pet_breast_lesion_size_unit, pet_breast_lesion_suv, pet_breast_lesion_location,\ pet_breast_lesion_type, pet_breast_lesion_comments, pet_breast_nodes_description, \ pet_breast_lesion_skin = ['no_breast_cancer', ] * 8 breast_report = [ pet_breast_lesion_size, pet_breast_lesion_size_unit, pet_breast_lesion_suv, pet_breast_lesion_location, pet_breast_lesion_type, pet_breast_lesion_comments, pet_breast_nodes_description, pet_breast_lesion_skin ] columns_list = names(module_name) check = sql.review_input(self.file_number, columns_list[:-2], breast_report) data_list = breast_report + [self.user_name, sql.last_update()] return data_list
def habits(file_number): module_name = "habits" check = False while not check: category = "Diet" options = ["Vegetarian", "Non-Vegetarian", "Ovo-Vegetarian", "Other"] diet = ask_option(category, options) alcohol = ask_y_n("Alcohol consumption") if alcohol: alcohol_consump = "Alcohol Consumption" alcohol_age = input("Consumption of alcohol from which age (yrs): ") alcohol_quant = input("Quantity of alcohol consumed per week: ") alcohol_duration = input("Duration of alcohol consumption: ") alcohol_comments = input("Additional comments for alcohol consumption: ") else: alcohol_consump = "No Alcohol Consumption" alcohol_age, alcohol_quant, alcohol_duration, alcohol_comments = ("NA",) * 4 data_list_alc = [diet, alcohol_consump, alcohol_age, alcohol_quant, alcohol_duration, alcohol_comments] tobacco = ask_y_n("Tobacco exposure (Passive and/or Active)") if tobacco: tobacco = "Tobacco consumption" exposure_type = ask_option("Mode of exposure to Tobacco", ["Passive", "Active", "Other"]) if exposure_type =="Passive": tobacco_type_partic = ask_option("Mode of passive consumption", ["Home", "Work", "Commute", "Social Interactions"]) if tobacco_type_partic == "Home": tobacco_type_who = input ("What is the specific source?") tobacco_passive = tobacco_type_partic + (" : ") + tobacco_type_who else: tobacco_passive = tobacco_type_partic else: tobacco_passive = "NA" tobacco_type = ask_option("Type of tobacco use", ["Cigarette", "Beedi", "Gutkha", "Pan Masala", "Jarda/Maava", "Hookah", "Nicotine Patch", "Mishri", "Other"]) tobacco_age = input("Consumption of tobacco from which age (yrs): ") tobacco_freq = input ("Frequency of tobacco consumption: ") tobacco_quant = input("Quantity of tobacco consumed per week: ") tobacco_duration = input("Duration of tobacco consumption: ") tobacco_comments = input("Additional comments for tobacco consumption: ") else: tobacco = "No Tobacco Consumption" exposure_type, tobacco_type, tobacco_passive, tobacco_age, tobacco_freq, tobacco_quant, tobacco_duration, \ tobacco_comments = ("NA",) * 8 other_del_habits = input("Other Deleterious Habits (if present give details): ") data_list_tob = [tobacco, exposure_type, tobacco_passive,tobacco_type, tobacco_age, tobacco_freq, tobacco_quant, tobacco_duration, tobacco_comments, other_del_habits] columns_list = pccm_names.names_info(module_name) data_list = data_list_alc + data_list_tob check = review_input(file_number, columns_list, data_list) return (tuple(data_list))
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
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
def other_test(file_number): module_name = "other_test" other_tests = [["USG Abdomen", "Abnormal"], ["CECT Abdomen and Thorax", "Visceral Metastasis"], ["PET Scan", "Visceral Metastasis", "Skeletal Metastasis"], ["Bone Scan", "Skeletal Metastasis"]] check = False while not check: data_all = [] for index in other_tests: data = clinical_tests(index) data_all.append(data) data_all_flat = [item for sublist in data_all for item in sublist] col_list = pccm_names.name_clinical(module_name) check = add_update_sql.review_input(file_number, col_list, data_all_flat) return data_all_flat
def other_test(self): data_list = [ 'data_to_be_entered', ] * 14 + [self.user_name, last_update()] module_name = "other_test" check = False while not check: print( 'In this module please enter data for tests done at the time of diagnosis before the start of ' 'treatment') data = clinical_tests() data_list = data + [self.user_name, last_update()] col_list = pccm_names.names_info(module_name) check = review_input(self.file_number, col_list, data_list) return data_list
def family_cancer(conn, cursor, file_number): module_name = "family_cancer" check = False while not check: family_cancer_history_y_n = ask_y_n('Cancer history in Family') if family_cancer_history_y_n: family_cancer = family_cancer_table(conn, cursor, file_number) family_cancer_history_y_n = "Family History of Cancer" else: family_cancer_history_y_n = "No Family History of Cancer" family_cancer = "NA" data_list = [family_cancer_history_y_n, family_cancer] columns_list = pccm_names.names_info(module_name) check = review_input(file_number, columns_list, data_list) return (tuple(data_list))
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 = input("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(conn, cursor, file_number): module_name = "med_history" check = False while not check: medical_history_y_n = ask_y_n("Any Other Medical History ?") if medical_history_y_n: med_hist = med_history_table(conn, cursor, file_number) medical_history_y_n = "Previous medical history present" else: medical_history_y_n = "No previous medical history present" med_hist = ("NA",) * 3 condition_hist, diagnosis_date_hist, treatment_hist = med_hist data_list = [medical_history_y_n, condition_hist, diagnosis_date_hist, treatment_hist] columns_list = pccm_names.names_info(module_name) check = review_input(file_number, columns_list, data_list) return (tuple(data_list))
def phys_act(conn, cursor, file_number): module_name = "phys_act" check = False while not check: phys_act = ask_y_n("Any Physical Activities ?") if phys_act: phys = physical_activity_table(conn, cursor, file_number) phys_act = "Physical Activities Performed" phys_act_done, phys_act_freq = phys else: phys_act = "No Physical Activities" phys_act_done, phys_act_freq = ("NA", ) * 2 data_list = [phys_act, phys_act_done, phys_act_freq] columns_list = pccm_names.names_info(module_name) check = review_input(file_number, columns_list, data_list) return (tuple(data_list))
def cancer_history(conn, cursor, file_number): module_name = "cancer_history" check = False while not check: previous_cancer_history_y_n = ask_y_n("Previous history of cancer ?") if previous_cancer_history_y_n: previous_cancer = cancer_table(conn, cursor, file_number) previous_cancer_history_y_n = "Previous history of cancer" else: previous_cancer_history_y_n = "No previous history of cancer" previous_cancer = ("NA",) * 5 type_of_cancer_list, year_diagnosis_list, treat_all, type_all, duration_all = previous_cancer data_list = [previous_cancer_history_y_n, type_of_cancer_list, year_diagnosis_list, treat_all, type_all, duration_all] columns_list = pccm_names.names_info(module_name) check = review_input(file_number, columns_list, data_list) return (tuple(data_list))
def nut_supplements(conn, cursor, file_number): module_name = "nut_supplements" check = False while not check: nut_supplements = ask_y_n("Nutritional supplements taken") if nut_supplements: nuts = nut_supp_table(conn, cursor, file_number) nut_supplements = "Nutritional supplements taken" else: nut_supplements = "No nutritional supplements taken" nuts = ("NA", ) * 3 nuts_type, nuts_quant, nuts_dur = nuts data_list = [nut_supplements, nuts_type, nuts_quant, nuts_dur] columns_list = pccm_names.names_info(module_name) check = review_input(file_number, columns_list, data_list) return (tuple(data_list))
def metastasis(file_number, user_name): check = False while not check: met_has = ask_y_n_statement.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 = input("Date of last follow-up: ") recur = ask_y_n_statement.ask_y_n( "Has the patient experienced a recurrence?") if recur: time_recur = input("Time to disease recurrence: ") nature_recur = ask_y_n_statement.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 = ask_y_n_statement.ask_option( "Status at last follow up", ["Survivor", "Deceased", "Lost to follow-up", "Other"]) if status == "Survivor": type_survivor = ask_y_n_statement.ask_option( "the Survivor is ", [ "disease Free", "with recurrence", "disease free with no known recurrence", "with disease" ]) status = status + ": " + type_survivor if status == "Deceased": type_death = ask_y_n_statement.ask_option( "Cause of death", ["due to disease", "due to unrelated causes", "not known"]) status = status + ": " + type_death last_update = datetime.now().strftime("%Y-%b-%d %H:%M") 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
def tomosynthesis(file_number): module_name = "tomosynthesis" check = False while not check: tomo = ask_y_n_statement.ask_y_n("3D digital Tomosynthesis done") if tomo: tomo = "3D digital Tomosynthesis done" print ("Please add details of tomography in mammography section") tomo_date = input("Date of Tomosynthesis examination: ") tomo_acc = input("Accession number of Tomosynthesis: ") else: tomo = "3D digital Tomosynthesis not done" tomo_date, tomo_acc, = ("NA",) * 2 data_list = [tomo, tomo_date, tomo_acc, ] columns_list = names(module_name) check = add_update_sql.review_input(file_number, columns_list, data_list) return (tuple(data_list))
def nipple_cytology (file_number): module_name = "nipple_cytology" check = False while not check: cyto = ask_y_n_statement.ask_option("Nipple Cytology", ["Done", "Not Done"]) if cyto == "Not Done": cyto_date, cyto_number, cyto_report = ("NA",)*3 else: cyto_date = input("Date of nipple cytology: ") cyto_number = input("Nipple Cytology number: ") cyto_report = ask_y_n_statement.ask_option("Nipple Cytology report and interpretation", ["Normal", "Suspicious", "Diagnostic for " "Cancer", "Other"]) data_list = [cyto, cyto_date, cyto_number, cyto_report] columns_list = pccm_names.name_clinical(module_name) check = add_update_sql.review_input(file_number, columns_list, data_list) return (tuple(data_list))
def family_cancer(self): module_name = "family_cancer" check = False while not check: family_cancer_history_y_n = ask_y_n_na('Cancer history in Family') if family_cancer_history_y_n == 'Yes': family_cancer = family_cancer_table(self.conn, self.cursor, self.file_number) family_cancer_history_y_n = "Family History of Cancer" elif family_cancer_history_y_n == 'No': family_cancer_history_y_n = "No Family History of Cancer" family_cancer = "No Family History of Cancer" else: family_cancer = family_cancer_history_y_n data_list = [family_cancer_history_y_n, family_cancer] columns_list = pccm_names.names_info(module_name) check = review_input(self.file_number, columns_list, data_list) return data_list
def usg_mass(self, mass_id): print(self.table, mass_id) check = False data_list = ask.default_data_list(self.col_list) while not check: mass_location = self.mammo_breast if self.mammo_breast == "bilateral": mass_location = ask.ask_option("Location of mass " + str(mass_id), RadioTables.breast) location_clock = ask.check_number_input("What is the clock" "position of mass " + str(mass_id) + "?", 'Please enter only numbers' ' additional paramters ' 'can be entered ' 'next') location_add = input('Additional parameters for clock position') location_clock = location_clock + location_add + " o'clock" mass_quadrant = 'data_not_available' quad = ask.ask_y_n('Is the quadrant location given?') if quad: mass_quadrant = ask.ask_list('what is the quadrant location', Radio.lesion_quadrant) mass_shape = ask.ask_list("Shape of mass " + str(mass_id), RadioTables.mass_shape) mass_name = "lesion_" + str(mass_id) mass_dimension, mass_size_unit, mass_longest_dimension = self.lesion_size() mass_margin = ask.ask_option("Margin of mass " + str(mass_id), RadioTables.mass_margin_usg) mass_echo = ask.ask_option("Echo pattern of mass " + str(mass_id), RadioTables.mass_echo) mass_id = "Mass " + str(mass_id) modality = self.table data_list = [self.file_number, mass_name, mass_location, location_clock, mass_quadrant, mass_shape, mass_margin, mass_echo, mass_dimension, mass_longest_dimension, mass_size_unit, modality] check = sql.review_input(self.file_number, columns=self.col_list, data=data_list) data_list = data_list + [self.user_name, sql.last_update()] return data_list
def nut_supplements(self): module_name = "nut_supplements" data_list = ['NA'] * 4 check = False while not check: nutrition = ask_y_n_na("Nutritional supplements taken") if nutrition == 'Yes': nuts = nut_supp_table(self.conn, self.cursor, self.file_number) nutrition = "Nutritional supplements taken" elif nutrition == 'No': nutrition = "No nutritional supplements taken" nuts = ("No nutritional supplements taken", ) * 3 else: nuts = (nutrition, ) * 3 nuts_type, nuts_quant, nuts_dur = nuts data_list = [nutrition, nuts_type, nuts_quant, nuts_dur] columns_list = pccm_names.names_info(module_name) check = review_input(self.file_number, columns_list, data_list) return data_list
def get_consent(self, file_number): consent_discussed = sql.get_value_no_error('consent_discussed', self.table_name, file_number, 'file_number', self.cursor) consent = sql.get_value_no_error('consent', self.table_name, file_number, 'file_number', self.cursor) if not consent_discussed: consent_discussed = ask.ask_y_n( 'Has the consent form been discussed with the patient/family? ' ) if not consent and consent_discussed: consent = ask.ask_y_n('Did patient give consent?', yes_ans='consent_given', no_ans='consent_not_given') elif not consent and not consent_discussed: consent = 'consent_TBD' print('consent_discussed: ' + str(consent_discussed), 'consent: ' + consent) check = ask.ask_y_n('Is this correct?') if not check: check_review = False data = [str(consent_discussed), consent] col_list = ['consent_discussed', 'consent'] while not check_review: consent_discussed = ask.ask_y_n( 'Has the consent form been discussed with the patient/family? ' ) consent = ask.ask_y_n('Did patient give consent?', yes_ans='consent_given', no_ans='consent_not_given') data = [str(consent_discussed), consent] check_review = sql.review_input(file_number, col_list, data) sql.update_multiple_key(conn=self.conn, cursor=self.cursor, table=self.table_name, columns=col_list, key_name='file_number', key_value=file_number, data=data) return str(consent_discussed), consent