def bio_info(file_number):
    module_name = "bio_info"
    mr_number = gf.get_number_lt(500, 2000)
    name = names.get_full_name(gender='female')
    aadhaar_card = 'data_not_available'
    date_first = gf.gen_date(base_date='2010-12-12')
    permanent_address = 'data_not_available'
    current_address = permanent_address
    phone = gf.get_number_lt(900000000, 999999999)
    email_id = 'data_not_available'
    gender = gf.get_choice(["Female", "Male"])
    date_of_birth = gf.get_dob()
    age_yrs = gf.get_age(date_of_birth)
    age_diag = gf.get_years(date_of_birth, date_first)
    place_birth = 'data_not_available'
    height_cm = gf.get_number_lt(140, 180)
    weight_kg = gf.get_number_lt(50, 90)
    weight = float(weight_kg)
    height = float(height_cm) / 100
    bmi = str(round(weight / (height * height)))
    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
    ]
    return (age_diag, tuple(new_data))
def det_by(file_number):
    module_name = "det_by"
    options = ["Self", "Physician", "Screening Camp", "Other"]
    determined_by = gf.get_choice(options)
    if determined_by == "Screening Camp":
        sc_id = gf.get_number(5)
        determined_by = "Screening Camp ID " + str(sc_id)
    det_date = gf.gen_date(datetime.now().strftime("%Y-%m-%d"))
    data_list = [determined_by, det_date]
    return (tuple(data_list))
def med_history_table(file_number):
    add_history = True
    diagnosis_date_list, treatment_list, condition_list = [], [], []
    condition = 'data_not_available'
    condition_list.append(condition)
    diagnosis_date = gf.gen_date(datetime.today().strftime('%Y-%m-%d'))
    diagnosis_date_list.append(diagnosis_date)
    treatment = 'data_not_available'
    treatment_list.append(treatment)
    condition_hist = '; '.join(condition_list)
    treatment_hist = '; '.join(treatment_list)
    diagnosis_date_hist = "; ".join(diagnosis_date_list)
    return (condition_hist, diagnosis_date_hist, treatment_hist)
Exemple #4
0
 def report(self):
     data_list = ask.default_data_list(self.col_list_all[1:])
     check_mammo = gf.get_choice(MultiTest.test_reason)
     reason_report = check_mammo
     mammo = gf.get_bool()
     if mammo:
         tomo = gf.get_bool()
         if tomo:
             tomography_y_n = "Yes"
         else:
             tomography_y_n = "No"
         report_date = gf.gen_date('2019-03-13')
         mammo_place = gf.get_choice(["PCCM", "Outside"])
         if mammo_place == "Outside":
             mammography_place = names.get_full_name()
         else:
             mammography_place = mammo_place
         mammography_indication = gf.get_choice(Radiology.mammo_indication)
         mammography_breast = gf.get_choice(MultiTest.breast_cancer)
         mammo_mass = gf.get_bool()
         mass_all = []
         mass_data = ['no_mass_detected']
         mass_all.append(mass_data)
         mammography_massnumber = "No mass detected"
         mammography_masslocation = "No mass detected"
         mammography_massshape = "No mass detected"
         mammography_massmargin = "No mass detected"
         mammography_massnipple_cm = "No mass detected"
         mammography_masssize = "No mass detected"
         mammography_masssize_unit = "No mass detected"
         mass_longest_dimension = 'na'
         if mammo_mass:
             mass_breast = gf.get_choice(MultiTest.breast_cancer)
             mass = radio_tables.MassCalcification(self.table, mass_breast,
                                                   self.file_number,
                                                   self.user_name)
             mammography_massnumber, mass_dat = mass.multiple_mass()
             [
                 mammography_masslocation, mass_name, mass_quadrant,
                 mammography_massshape, mammography_massmargin,
                 mammography_massnipple_cm, mammography_masssize,
                 mass_longest_dimension, mammography_masssize_unit, modality
             ] = mass_dat[1:]
         mammography_calcificationnumber = "No Calcification detected"
         mammography_calcificationlocation = "No Calcification detected"
         mammography_calcificationtype = "No Calcification detected"
         mammography_calcification_comments = "No Calcification detected"
         calc = gf.get_bool()
         if calc:
             mammography_calcification = radio_tables.cal_table(
                 self.file_number, mammography_breast)
             (mammography_calcificationnumber,
              mammography_calcificationlocation,
              mammography_calcificationtype,
              mammography_calcification_comments
              ) = mammography_calcification
         mammography_skin_involvement = gf.get_choice(
             Radiology.skin_involvement)
         mammography_node_description = 'nodes_not_described'
         mammography_node_size = 'nodes_not_described'
         mammography_node_size_unit = 'nodes_not_described'
         node_description = gf.get_bool()
         if node_description:
             mammography_node_description = gf.get_choice(
                 Radiology.node_description)
             mammography_node_size = gf.get_number_lt(3, 10)
             mammography_node_size_unit = 'cm'
         mammo_birad = gf.get_bool()
         if mammo_birad:
             mammography_birad = radio_tables.birads()
         else:
             mammography_birad = "BI-RAD not assigned in report"
         mammography_impression = gf.get_choice(Radiology.impression)
         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[0],
             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
         ]
         data_list = [str(dat) for dat in data_list]
     data_list = [self.file_number] + data_list + [
         self.user_name, sql.last_update()
     ]
     return data_list
def family_details(file_number, age_mother):
    module_name = "family_details"
    col_list = pccm_names.names_info(module_name)
    marital_status = 'data_not_available'
    siblings = gf.get_yes_no_na()
    if siblings == 'yes':
        siblings_number = gf.get_number(5)
        sisters = gf.get_number(siblings_number)
        brothers = siblings_number - sisters
    elif siblings == 'no':
        siblings_number, sisters, brothers = "No Siblings", "0", "0"
    else:
        siblings_number, sisters, brothers = (siblings, ) * 3
    children_y_n = gf.get_yes_no_na()
    if children_y_n == 'yes':
        children_number = gf.get_number(5)
        daughters = gf.get_number(children_number)
        sons = children_number - daughters
    elif children_y_n == 'no':
        children_number, daughters, sons = 0, 0, 0
    else:
        children_number, daughters, sons = (children_y_n, ) * 3
    menarche = gf.get_number_lt(11, 20)
    menopause = gf.get_choice(PatientInfo.menopause_status)
    menopause_age = menopause
    if menopause == "Post-Menopausal":
        menopause_age = gf.get_number_lt(menarche, 60)
        lmp = "Last menstrual period " + str(menopause_age) + " yrs"
    else:
        lmp = gf.gen_date(base_date='2020-01-01')
    # category = "Type of Period"
    options = ["Regular", "Irregular", "Other"]
    period_type = gf.get_choice(options)
    number_pregnancy = gf.get_number(8)
    if number_pregnancy == "0":
        age_first_preg = 'No children'
        age_last_preg = 'No children'
        number_term = 'No children'
        number_abortion = 'No children'
        age_first = 'No children'
        age_last = 'No children'
        twice_birth = 'No children'
        breast_feeding_data = 'No children'
        kid_feeding = 'No children'
        duration_feeding = 'No children'
        breast_usage = 'No children'
    elif number_pregnancy == "Requires Follow-up":
        age_first_preg = number_pregnancy
        age_last_preg = number_pregnancy
        number_term = number_pregnancy
        number_abortion = number_pregnancy
        age_first = number_pregnancy
        age_last = number_pregnancy
        twice_birth = number_pregnancy
        breast_feeding_data = number_pregnancy
        kid_feeding = number_pregnancy
        duration_feeding = number_pregnancy
        breast_usage = number_pregnancy
    else:
        number_term = gf.get_number(5)
        number_abortion = gf.get_number(5)
        age_first_preg = gf.get_number_lt(menarche, 55)
        age_last_preg = "NA"
        age_first = gf.get_number_lt(0, age_mother)
        age_last = age_first
        if children_number == 0:
            age_first = children_number
            age_last = children_number
            twice_birth = children_number
            breast_feeding_data = children_number
            kid_feeding = children_number
            duration_feeding = children_number
            breast_usage = children_number
        elif children_y_n == 'yes':
            age_first = gf.get_number_lt(0, age_mother)
            if age_first_preg == "NA":
                age_first_preg = int(age_mother) - int(age_first)
            if int(children_number) > 1:
                age_last = gf.get_number_lt(0, age_first_preg)
                age_last_preg = age_mother - age_last
                if age_last_preg == "NA":
                    age_last_preg = str(int(age_mother) - int(age_last))
                twice_birth = gf.get_choice(
                    ["Two births in a year", "No two births in a year"])
            else:
                age_last = age_first
                age_last_preg = 'NA'
                twice_birth = "NA"
            breast_feeding = gf.get_bool()
            if breast_feeding:
                breast_feeding_data = "Breast feeding"
                feed_details = bct.feed_duration(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 = str(children_y_n)
            age_last = str(children_y_n)
            twice_birth = str(children_y_n)
            breast_feeding_data = str(children_y_n)
            kid_feeding = str(children_y_n)
            duration_feeding = str(children_y_n)
            breast_usage = str(children_y_n)
    fert_treat_y_n = gf.get_yes_no()
    if fert_treat_y_n == 'yes':
        fert_treat = "Fertility Treatment used"
        type_fert = gf.get_choice(PatientInfo.fert_treat)
        detail_fert = 'data_not_available'
        cycles_fert = gf.get_number_lt(1, 4)
        success_fert = gf.get_choice(
            ["Pregnancy from Treatment", "No pregnancy from treatment"])
    elif fert_treat_y_n == "no":
        fert_treat = "No Fertility Treatment used"
        type_fert = fert_treat
        detail_fert = fert_treat
        cycles_fert = fert_treat
        success_fert = fert_treat
    else:
        fert_treat = str(fert_treat_y_n)
        type_fert = str(fert_treat_y_n)
        detail_fert = str(fert_treat_y_n)
        cycles_fert = str(fert_treat_y_n)
        success_fert = str(fert_treat_y_n)
    birth_control = gf.get_yes_no_na()
    if birth_control == 'yes':
        type_birth_control = gf.get_choice(
            ["Birth control pills", "Copper-T", "Condom"])
        detail_birth_control = 'data_not_available'
        duration_birth_control = gf.get_number(max_no=age_mother)
    elif birth_control == 'no':
        type_birth_control = "No birth control used"
        detail_birth_control = "No birth control used"
        duration_birth_control = "No birth control used" * 3
    else:
        type_birth_control = birth_control
        detail_birth_control = birth_control
        duration_birth_control = birth_control
    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
    ]
    return tuple(data_list)