Esempio n. 1
0
def cal_table(file_number, mammo_breast):
    import helper_function.pccm_names as pccm_names
    table = "calcification_mammography"
    mass_number = gf.get_number_lt(1, 3)
    try:
        number_calc = int(mass_number)
    except ValueError:
        number_calc = 1
    location, calc_type, calicification_comments = [list([]) for _ in range(3)]
    for index in range(0, number_calc):
        mass_id = index + 1
        if mammo_breast == "Bilateral":
            mass_location = gf.get_choice(["Right Breast", "Left Breast"])
        else:
            mass_location = mammo_breast
        location.append(mass_location)
        mammo_calcification = gf.get_choice([
            "Skin", "Vascular", "Coarse or 'Popcorn-like'", "Large Rod-like",
            "Round and punctate", "Eggshell or Rim", "Dystrophic", "Suture",
            "Amorphous", "Coarse Heterogeneous", "Fine Pleomorphic",
            "Fine Linear or Fine Linear Branching", "Other"
        ])
        calc_type.append(mammo_calcification)
        mass_id = "Group " + str(index + 1)
        comment = 'na'
        calicification_comments.append(comment)
        data_list = [
            file_number, mass_id,
            str(mass_location), mammo_calcification, comment
        ]
        col_list = pccm_names.names_radio_mass(table)
    all_data = [[str(mass_number)], location, calc_type,
                calicification_comments]
    data_return = ask.join_lists(all_data, "; ")
    return tuple(data_return)
class TestRadiology(TestCase):
    def __init__(self, table, col_list):
        super().__init__()
        self.table = table
        self.col_list = col_list

    def test_function(self):
        with mock.patch.object(__builtins__, 'input', lambda: 'some_input'):
            assert module == 'expected_output'

    if __name__ == "__main__":
        import helper_function.pccm_names as pccm_names
        table = 'mammography'
        col_list = pccm_names.names_radio_mass(table)
        # execute only if run as a script
        masscalc = MassCalcification(table,
                                     mammo_breast='right_breast',
                                     file_number='test',
                                     user_name='dk')
        masscalc.mammo_mass('1')
        masscalc.multiple_mass()

    TestCase.assertIs(self)
    pass
Esempio n. 3
0
 def __init__(self, table, mammo_breast, file_number, user_name):
     self.table = table
     self.mammo_breast = mammo_breast
     self.col_list = pccm_names.names_radio_mass(self.table)
     self.file_number = file_number
     self.user_name = user_name
Esempio n. 4
0
def cal_table(file_number, mammo_breast):
    import helper_function.pccm_names as pccm_names
    table = "calcification_mammography"
    mass_number = ask.check_number_input("Number of groups of calcifications"
                                         " detected? ", error='Please enter'
                                         'number of calcification groups'
                                         'detected only')
    try:
        number_calc = int(mass_number)
    except ValueError:
        number_calc = 1
    location, calc_type, calicification_comments = [list([]) for _ in range(3)]
    for index in range(0, number_calc):
        check = False
        while not check:
            mass_id = index + 1
            if mammo_breast == "Bilateral":
                mass_location = ask.ask_option("Location of calcification"
                                               "group " + str(mass_id),
                                               ["Right Breast", "Left Breast"])
            else:
                mass_location = mammo_breast
            location.append(mass_location)
            mammo_calcification = ask.ask_option("Calcification Type ",
                                                 ["Skin", "Vascular",
                                                  "Coarse or 'Popcorn-like'",
                                                  "Large Rod-like",
                                                  "Round and punctate",
                                                  "Eggshell or Rim",
                                                  "Dystrophic", "Suture",
                                                  "Amorphous",
                                                  "Coarse Heterogeneous",
                                                  "Fine Pleomorphic",
                                                  "Fine Linear or"
                                                  "Fine Linear Branching",
                                                  "Other"])
            calc_type.append(mammo_calcification)
            mass_id = "Group " + str(index + 1)
            comment = input('Additional comments for calcification: ')
            calicification_comments.append(comment)
            data_list = [file_number, mass_id, str(mass_location),
                         mammo_calcification, comment]
            col_list = pccm_names.names_radio_mass(table)
            check = sql.review_input(file_number, col_list, data_list)
    all_data = [[str(mass_number)], location, calc_type,
                calicification_comments]
    data_return = ask.join_lists(all_data, "; ")
    return tuple(data_return)

    @staticmethod
    def lesion_size():
        mass_size = ask.check_size_input("Mass dimensions (without unit): ")
        mass_size_unit = 'NA'
        if mass_size != 'NA':
            mass_size_unit = ask.ask_list("Mass dimensions unit: ",
                                          RadioTables.mass_units)
        mass_name = "lesion_" + str(mass_id)
        mass_dimension, mass_longest_dimension = mass_size
        mass_longest_dimension = ask.convert_mm_to_cm(
                                 mass_longest_dimension, mass_size_unit)
        return mass_size, mass_size_unit, mass_longest_dimension