Esempio n. 1
0
    def setUpClass(self):
        """Prepare test env."""

        # Init browser and open test site.
        self.browser = Browser()
        test_urls = {
            'ehr_main':
            r'https://eec19a.clinicomp.com/webframe_zouya16308/index.php/cps',
            'ehr_amc':
            r'https://eec19a.clinicomp.com/webframe_zouya16308/index.php/cps',
            'ea_create':
            r'https://eec19a.clinicomp.com/patEAccessWebApp/createPatAccountIndx.php',
            'ea_access':
            r'https://eec19a.clinicomp.com/patEAccessWebApp/index.php'
        }
        self.browser.open_sites(test_urls)

        # Init components.
        self.login = Login(self.browser.driver)
        self.patctrl = Patctrl(self.browser.driver)
        self.sidebar = Sidebar(self.browser.driver)
        self.amc = Amc(self.browser.driver)
        self.pat_eaccess = PatEAccess(self.browser.driver)

        # Make the pages ready.
        self.browser.switch_to_window('ehr_main')
        self.login.login('dst01', '123')
        self.browser.switch_to_window('ehr_amc')
        self.login.login('dst01', '123')
        self.sidebar.select_app('AMC')
        self.browser.switch_to_window('ea_create')
        self.pat_eaccess.login()
Esempio n. 2
0
 def setUpClass(self):
     self.browser = Browser()
     self.browser.open_site('ehr_main', 
                            r'https://foo92.clinicomp.com/webframe/index.php/Cps')
     self.login = Login(self.browser.driver)
     self.patctrl = Patctrl(self.browser.driver)
     self.login.login()
Esempio n. 3
0
class CaseAdmit(unittest.TestCase):

    @classmethod
    def setUpClass(self):
        self.browser = Browser()
        self.browser.open_site('ehr_main', 
                               r'https://foo92.clinicomp.com/webframe/index.php/Cps')
        self.login = Login(self.browser.driver)
        self.patctrl = Patctrl(self.browser.driver)
        self.login.login()

    @classmethod
    def tearDownClass(self):
        pass

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def admitPatients(self):
        for i in range(1, 9):
            key = '184460' + str(i)
            pat = Patient({
                "ssn": key,
                "last_name": key,
                "first_name": key,
                "billing": key,
            })
            unit = "MSI" if i < 5 else "SDS"
            self.patctrl.admit(pat, unit)
            self.browser.driver.refresh()
Esempio n. 4
0
    def setUpClass(self):
        self.browser = Browser()
        self.browser.open_site(
            'ehr_main', r'https://foo6.clinicomp.com/webframe/index.php/Cps')
        self.login = Login(self.browser.driver)
        self.patctrl = Patctrl(self.browser.driver)
        self.sidebar = Sidebar(self.browser.driver)
        self.notes = Notes(self.browser.driver)

        self.login.login()

        self.note_type = 'CCI Surveillance Note III'
Esempio n. 5
0
class BaseCase(TestCase):
    """16308 base case ."""
    def __init__(self):
        super(BaseCase, self).__init__()
        self.browser = Browser()
        self.add_components()
        self.prepare_pages()

    def add_components(self):
        self.amc = Amc(self.browser.driver)

    def prepare_pages(self):
        pass

    def get_test_pat(self, case_num, second_encounter=False):
        case_id = '16308'
        ssn = case_id + case_num
        first_name = case_num
        last_name = case_id
        billing = case_id + case_num
        middle_name = 'senond' if second_encounter else 'first'
        return Patient(ssn, last_name, first_name, billing, middle_name)

    def check_result(self, previous_result, expected_diff, actual_result):
        expected_result = {}
        for key in previous_result:
            values = []
            for i in range(3):
                values.append(previous_result[key][i] + expected_diff[key][i])

            values.append(round((values[2] / values[1]) * 100))
            expected_result[key] = values

        return self.assertEqual(expected_result, actual_result)

    def get_result(self,
                   measure,
                   pat_type,
                   amc_window,
                   from_time=None,
                   to_time=None,
                   physician=None,
                   group=None):
        # query
        self.browser.switch_to_window(amc_window)
        sleep(8)
        self.amc.query(from_time, to_time, physician, group)
        return self.amc.get_result(measure, pat_type)
Esempio n. 6
0
class Case(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.browser = Browser()
        self.browser.open_site(
            'ehr_main', r'https://foo6.clinicomp.com/webframe/index.php/Cps')
        self.login = Login(self.browser.driver)
        self.patctrl = Patctrl(self.browser.driver)
        self.sidebar = Sidebar(self.browser.driver)
        self.notes = Notes(self.browser.driver)

        self.login.login()

        self.note_type = 'CCI Surveillance Note III'

    @classmethod
    def tearDownClass(self):
        pass

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_case_11(self):
        test_pat = test_patients['pat1']
        test_data = [{
            'label': 'Gender',
            'value': 'M',
            'type': 'dropdown',
            'is_more_fields': False
        }, {
            'label': 'Birth Of Date(mm/dd/yyyy)',
            'value': '10/10/2017',
            'type': 'text',
            'is_more_fields': False
        }, {
            'label': 'Height (inches)',
            'value': '27',
            'type': 'text',
            'is_more_fields': False
        }, {
            'label': 'Weight (pounds)',
            'value': '17',
            'type': 'text',
            'is_more_fields': False
        }, {
            'label': 'Zip Code',
            'value': '02130',
            'type': 'text',
            'is_more_fields': False
        }, {
            'label': 'County/Parish Code',
            'value': '25025',
            'type': 'text',
            'is_more_fields': False
        }, {
            'label': 'City',
            'value': 'Jamaica Plain',
            'type': 'text',
            'is_more_fields': False
        }, {
            'label': 'State',
            'value': '25',
            'type': 'text',
            'is_more_fields': False
        }, {
            'label': 'Country',
            'value': 'USA',
            'type': 'text',
            'is_more_fields': False
        }, {
            'label': 'Admit Date(mm/dd/yyyy)',
            'value': '02/20/2010',
            'type': 'text',
            'is_more_fields': False
        }, {
            'label': 'Admit Time(HHMM)',
            'value': '0830',
            'type': 'text',
            'is_more_fields': False
        }, {
            'label': 'Patient Class',
            'value': 'O',
            'type': 'text',
            'is_more_fields': False
        }, {
            'label': 'Chief Complaint',
            'value': 'Find Patient',
            'type': 'dropdown',
            'is_more_fields': False
        }, {
            'label':
            'Race',
            'value':
            ['White', 'Asian', 'Native Hawaiian or Other Pacific Islander'],
            'type':
            'dropdown',
            'is_more_fields':
            True
        }, {
            'label': 'Ethnic',
            'value': 'Not Hispanic or Latino',
            'type': 'dropdown',
            'is_more_fields': True
        }, {
            'label': 'Status',
            'value': 'Never smoker',
            'type': 'dropdown',
            'is_more_fields': True
        }, {
            'label': 'Reason',
            'value': 'Fever,cough,earache',
            'type': 'dropdown',
            'is_more_fields': True
        }, {
            'label':
            'Diagnosis',
            'value': [
                'Influenza with other respiratory manifestations',
                'Stenosis of external ear canal due to inflammation'
            ],
            'type':
            'dropdown',
            'is_more_fields':
            True
        }]
        self.patctrl.admit(test_pat, unit='MSI')
        #self.patctrl.select_patient('dstest, 0412')
        self.patctrl.goto_overview()
        self.sidebar.select_app('NOTES')
        self.notes.add('CCI Surveillance Note III', test_data)

    def test_case_21(self):
        test_pat = test_patients['pat2']
        test_data = [
            {
                'label': 'Patient Name',
                'value': 'Unspecified',
                'type': 'text',
                'is_more_fields': False
            },
            {
                'label': 'Gender',
                'value': 'F',
                'type': 'dropdown',
                'is_more_fields': False
            },
            {
                'label': 'Height (inches)',
                'value': '65',
                'type': 'text',
                'is_more_fields': False
            },
            {
                'label': 'Weight (pounds)',
                'value': '128',
                'type': 'text',
                'is_more_fields': False
            },
            {
                'label': 'Admit Date(mm/dd/yyyy)',
                'value': '01/01/2017',
                'type': 'text',
                'is_more_fields': False
            },
            {
                'label': 'Admit Time(HHMM)',
                'value': '1700',
                'type': 'text',
                'is_more_fields': False
            },
            {
                'label': 'Patient Class',
                'value': 'E',
                'type': 'text',
                'is_more_fields': False
            },
            {
                'label': 'Race',
                'value': 'White',
                'type': 'dropdown',
                'is_more_fields': True
            },
            {
                'label': 'Status',
                'value': 'Unknown if ever smoked',
                'type': 'dropdown',
                'is_more_fields': True
            },
            {
                'label': 'Reason',
                'value':
                'Pedal cycle driver injured in collision with car, pick-up truck or van in traffic accident, initial encounter',
                'type': 'dropdown',
                'is_more_fields': True
            },
        ]
        if self.patctrl.search_patient(test_pat.full_name) == 0:
            self.patctrl.admit(test_pat, unit='ED')
        else:
            self.patctrl.select_patient(test_pat.full_name)

        self.patctrl.goto_overview()
        self.sidebar.select_app('NOTES')
        self.notes.add('CCI Surveillance Note III', test_data)

    def test_case_22(self):
        test_pat = test_patients['pat2']
        test_data = {
            'Patient Name':
            test_pat.full_name,
            'Birth Of Date(mm/dd/yyyy)':
            '04/03/1983',
            'Zip Code':
            '60601',
            'City':
            'Chicago',
            'State':
            '17',
            'Country':
            'USA',
            'Diagnosis': [
                'Type III occipital condyle fracture, initial encounter for closed fracture',
                'Unspecified intracranial injury with loss of consciousness of 1 hour to 5 hours 59 minutes, initial encounter'
            ]
        }
        self.patctrl.select_patient(test_pat.ssn)
        self.patctrl.goto_overview()
        self.sidebar.select_app('NOTES')
        formated_data = format_data(test_data, templates[self.note_type])
        self.notes.edit(self.note_type, formated_data)

    def test_case_23(self):
        test_pat = test_patients['pat2']
        test_data = {
            'Zip Code':
            '60601',
            'City':
            'Chicago',
            'State':
            '17',
            'Country':
            'USA',
            'Diagnosis': [
                'Type III occipital condyle fracture, initial encounter for closed fracture',
                'Unspecified intracranial injury with loss of consciousness of 1 hour to 5 hours 59 minutes, initial encounter'
            ]
        }
        self.patctrl.select_patient(test_pat.full_name)
        self.patctrl.goto_overview()
        self.sidebar.select_app('NOTES')
        formated_data = format_data(test_data, templates[self.note_type])
        self.notes.edit(self.note_type, formated_data)

    def test_case_31(self):
        test_pat = test_patients['pat3']
        test_data = {
            'Gender': 'M',
            'Birth Of Date(mm/dd/yyyy)': '04/25/1948',
            'Height (inches)': '65',
            'Weight (pounds)': '170',
            'Zip Code': '74852',
            'County/Parish Code': '40125',
            'City': 'Oklahoma City',
            'State': 'Oklahoma',
            'Country': 'USA',
            'Admit Date(mm/dd/yyyy)': '02/01/2010',
            'Admit Time(HHMM)': '0730',
            'Patient Class': 'E',
            'Chief Complaint': 'A headache, nausea, and dizziness',
            'Race':
            ['White', 'American Indian or Alaska Native', 'Other race'],
            'Ethnic': 'Not Hispanic or Latino',
            'Status': 'Current Light tobacco smoker'
        }
        if self.patctrl.search_patient(test_pat.full_name) == 0:
            self.patctrl.admit(test_pat, unit='ED')
        else:
            self.patctrl.select_patient(test_pat.full_name)

        self.patctrl.goto_overview()
        self.sidebar.select_app('NOTES')
        formated_data = format_data(test_data, templates[self.note_type])
        self.notes.add(self.note_type, formated_data)

    def test_case_32(self):
        test_pat = test_patients['pat3']
        test_data = {'Diagnosis': 'Accidental exposure to carbon monoxide'}
        self.patctrl.select_patient(test_pat.full_name)
        self.patctrl.goto_overview()
        self.sidebar.select_app('NOTES')
        formated_data = format_data(test_data, templates[self.note_type])
        self.notes.edit(self.note_type, formated_data)

    def test_case_33(self):
        test_pat = test_patients['pat3']
        test_data = {
            'Discharge Disposition':
            'Admitted as an inpatient to this hospital'
        }
        self.patctrl.select_patient(test_pat.full_name)
        self.patctrl.goto_overview()
        self.sidebar.select_app('NOTES')
        formated_data = format_data(test_data, templates[self.note_type])
        self.notes.edit(self.note_type, formated_data)

    def test_case_41(self):
        test_pat = test_patients['pat4']
        test_data = {
            'Gender': 'M',
            'Birth Of Date(mm/dd/yyyy)': '04/25/1967',
            'Height (inches)': '72',
            'Weight (pounds)': '235',
            'Zip Code': '43058',
            'County/Parish Code': '39049',
            'City': 'Columbus',
            'State': 'Ohio',
            'Country': 'USA',
            'Admit Date(mm/dd/yyyy)': '08/17/2015',
            'Admit Time(HHMM)': '0700',
            'Patient Class': 'I',
            'Race': 'White',
            'Ethnic': 'Hispanic or Latino',
            'Status': 'Current Light tobacco smoker',
            'Reason':
            'Atherosclerotic heart disease of native coronary artery with unstable angina pectoris',
            'Diagnosis': 'Angina pectoris, unspecified'
        }
        if self.patctrl.search_patient(test_pat.full_name) == 0:
            self.patctrl.admit(test_pat, unit='MMI')
        else:
            self.patctrl.select_patient(test_pat.full_name)

        self.patctrl.goto_overview()
        self.sidebar.select_app('NOTES')
        formated_data = format_data(test_data, templates[self.note_type])
        self.notes.add(self.note_type, formated_data)

    def test_case_42(self):
        test_pat = test_patients['pat4']
        test_data = {
            'Discharge Disposition':
            'Discharged to home or self care (routine discharge)',
            'Diagnosis': 'Cardiac arrhythmia, unspecified'
        }
        self.patctrl.select_patient(test_pat.full_name)
        self.patctrl.goto_overview()
        self.sidebar.select_app('NOTES')
        formated_data = format_data(test_data, templates[self.note_type])
        self.notes.edit(self.note_type, formated_data)
Esempio n. 7
0
def login(persist_cookie):
    cookie_file = './tmp/cookies.pkl'
    config = configparser.ConfigParser()
    config.read('./crawler/app.cnf')
    account = config['shopee']['account']
    password = config['shopee']['password']
    browser = Browser()
    try:
        browser.go(Shopee.login_page_url)
        browser.load_cookie_from(cookie_file)  #
        browser.send_by_css(Shopee.account_input_css_selector, account)
        browser.send_by_css(Shopee.password_input_css_selector, password)
        browser.click_by_xpath(Shopee.login_button_xpath)
        try:
            browser.wait_for(
                lambda driver: driver.find_element_by_css_selector(
                    Shopee.verify_code_input_css_selector))
            browser.send_by_css(Shopee.verify_code_input_css_selector,
                                input('input verify code: '))
            browser.click_by_xpath(Shopee.verify_button_xpath)
        except TE:
            pass
        browser.wait_for(lambda driver: driver.current_url == Shopee.home)
        if persist_cookie:
            browser.dump_cookie(cookie_file)
        return browser.get_cookies()
    finally:
        browser.quit()
Esempio n. 8
0
 def __init__(self):
     super(BaseCase, self).__init__()
     self.browser = Browser()
     self.add_components()
     self.prepare_pages()
Esempio n. 9
0
class Case04(unittest.TestCase):
    """Test 16308 rt4 VDT."""
    @classmethod
    def setUpClass(self):
        """Prepare test env."""

        # Init browser and open test site.
        self.browser = Browser()
        test_urls = {
            'ehr_main':
            r'https://eec19a.clinicomp.com/webframe_zouya16308/index.php/cps',
            'ehr_amc':
            r'https://eec19a.clinicomp.com/webframe_zouya16308/index.php/cps',
            'ea_create':
            r'https://eec19a.clinicomp.com/patEAccessWebApp/createPatAccountIndx.php',
            'ea_access':
            r'https://eec19a.clinicomp.com/patEAccessWebApp/index.php'
        }
        self.browser.open_sites(test_urls)

        # Init components.
        self.login = Login(self.browser.driver)
        self.patctrl = Patctrl(self.browser.driver)
        self.sidebar = Sidebar(self.browser.driver)
        self.amc = Amc(self.browser.driver)
        self.pat_eaccess = PatEAccess(self.browser.driver)

        # Make the pages ready.
        self.browser.switch_to_window('ehr_main')
        self.login.login('dst01', '123')
        self.browser.switch_to_window('ehr_amc')
        self.login.login('dst01', '123')
        self.sidebar.select_app('AMC')
        self.browser.switch_to_window('ea_create')
        self.pat_eaccess.login()

    @classmethod
    def tearDownClass(self):
        # Close browser
        #self.browser.quit()
        pass

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_case_in_0111(self):
        test_pat = get_test_pat('040111')
        self.prepare_data(test_pat, 'first', 'No', 'No')

        actual_result = self.get_result()
        expected_result = {
            'VDT Measure A Stage 2 (Inpatient)': [1, 1, 0, 0],
            'VDT Measure A Stage 3 (Inpatient)': [1, 1, 0, 0],
            'VDT Measure B Stage 2 (Inpatient)': [1, 1, 0, 0],
            'VDT Measure B Stage 3 (Inpatient)': [1, 1, 0, 0],
            'VDT Measure C Stage 3 (Inpatient)': [1, 1, 0, 0]
        }

        self.assertEqual(expected_result, actual_result)

    def test_case_in_0112(self):
        test_pat = get_test_pat('040112')
        self.prepare_data(test_pat, 'first', 'No', 'No')

        actual_result = self.get_result()
        expected_result = {
            'VDT Measure A Stage 2 (Inpatient)': [2, 2, 0, 0],
            'VDT Measure A Stage 3 (Inpatient)': [2, 2, 0, 0],
            'VDT Measure B Stage 2 (Inpatient)': [2, 2, 0, 0],
            'VDT Measure B Stage 3 (Inpatient)': [2, 2, 0, 0],
            'VDT Measure C Stage 3 (Inpatient)': [2, 2, 0, 0]
        }

        self.assertEqual(expected_result, actual_result)

    def test_case_in_0113(self):
        test_pat = get_test_pat('040113')
        self.prepare_data(test_pat, 'first', 'No', 'No')

        actual_result = self.get_result()
        expected_result = {
            'VDT Measure A Stage 2 (Inpatient)': [3, 3, 0, 0],
            'VDT Measure A Stage 3 (Inpatient)': [3, 3, 0, 0],
            'VDT Measure B Stage 2 (Inpatient)': [3, 3, 0, 0],
            'VDT Measure B Stage 3 (Inpatient)': [3, 3, 0, 0],
            'VDT Measure C Stage 3 (Inpatient)': [3, 3, 0, 0]
        }

        self.assertEqual(expected_result, actual_result)

    def test_case_in_0114(self):
        test_pat = get_test_pat('040114')
        self.prepare_data(test_pat, 'first', 'Yes', 'No')

        actual_result = self.get_result()
        expected_result = {
            'VDT Measure A Stage 2 (Inpatient)': [4, 4, 1, 25],
            'VDT Measure A Stage 3 (Inpatient)': [4, 4, 1, 25],
            'VDT Measure B Stage 2 (Inpatient)': [4, 4, 1, 25],
            'VDT Measure B Stage 3 (Inpatient)': [4, 4, 1, 25],
            'VDT Measure C Stage 3 (Inpatient)': [4, 4, 0, 0]
        }

        self.assertEqual(expected_result, actual_result)

    def test_case_in_0115(self):
        test_pat = get_test_pat('040115')
        self.prepare_data(test_pat, 'first', 'Yes', 'Yes')

        actual_result = self.get_result()
        expected_result = {
            'VDT Measure A Stage 2 (Inpatient)': [5, 5, 2, 40],
            'VDT Measure A Stage 3 (Inpatient)': [5, 5, 2, 40],
            'VDT Measure B Stage 2 (Inpatient)': [5, 5, 2, 40],
            'VDT Measure B Stage 3 (Inpatient)': [5, 5, 2, 40],
            'VDT Measure C Stage 3 (Inpatient)': [5, 5, 1, 20]
        }

        self.assertEqual(expected_result, actual_result)

    def test_case_in_0121(self):
        test_pat = get_test_pat('040111', second='second')
        self.prepare_data(test_pat, 'second', 'Yes', 'No')

        actual_result = self.get_result()
        expected_result = {
            'VDT Measure A Stage 2 (Inpatient)': [5, 5, 3, 60],
            'VDT Measure A Stage 3 (Inpatient)': [5, 5, 3, 60],
            'VDT Measure B Stage 2 (Inpatient)': [5, 5, 3, 60],
            'VDT Measure B Stage 3 (Inpatient)': [5, 5, 3, 60],
            'VDT Measure C Stage 3 (Inpatient)': [5, 5, 1, 20]
        }

        self.assertEqual(expected_result, actual_result)

    def test_case_in_0122(self):
        test_pat = get_test_pat('040112', second='second')
        self.prepare_data(test_pat, 'second', 'Yes', 'Yes')

        actual_result = self.get_result()
        expected_result = {
            'VDT Measure A Stage 2 (Inpatient)': [5, 5, 4, 80],
            'VDT Measure A Stage 3 (Inpatient)': [5, 5, 4, 80],
            'VDT Measure B Stage 2 (Inpatient)': [5, 5, 4, 80],
            'VDT Measure B Stage 3 (Inpatient)': [5, 5, 4, 80],
            'VDT Measure C Stage 3 (Inpatient)': [5, 5, 2, 40]
        }

        self.assertEqual(expected_result, actual_result)

    def test_case_in_0123(self):
        test_pat = get_test_pat('040113', second='second')
        self.prepare_data(test_pat, 'second', 'No', 'Yes')

        actual_result = self.get_result()
        expected_result = {
            'VDT Measure A Stage 2 (Inpatient)': [5, 5, 4, 80],
            'VDT Measure A Stage 3 (Inpatient)': [5, 5, 5, 100],
            'VDT Measure B Stage 2 (Inpatient)': [5, 5, 4, 80],
            'VDT Measure B Stage 3 (Inpatient)': [5, 5, 4, 80],
            'VDT Measure C Stage 3 (Inpatient)': [5, 5, 3, 60]
        }

        self.assertEqual(expected_result, actual_result)

    def test_case_in_0131(self):
        test_pat = get_test_pat('040131')
        self.prepare_data(test_pat, 'first', 'Yes', 'No')

        actual_result = self.get_result()
        expected_result = {
            'VDT Measure A Stage 2 (Inpatient)': [6, 6, 5, 83],
            'VDT Measure A Stage 3 (Inpatient)': [6, 6, 6, 100],
            'VDT Measure B Stage 2 (Inpatient)': [6, 6, 5, 83],
            'VDT Measure B Stage 3 (Inpatient)': [6, 6, 5, 83],
            'VDT Measure C Stage 3 (Inpatient)': [6, 6, 3, 50]
        }

        self.assertEqual(expected_result, actual_result)

    def test_case_in_0132(self):
        test_pat = get_test_pat('040132')
        self.prepare_data(test_pat, 'first', 'Yes', 'Yes')

        actual_result = self.get_result()
        expected_result = {
            'VDT Measure A Stage 2 (Inpatient)': [7, 7, 6, 86],
            'VDT Measure A Stage 3 (Inpatient)': [7, 7, 7, 100],
            'VDT Measure B Stage 2 (Inpatient)': [7, 7, 6, 86],
            'VDT Measure B Stage 3 (Inpatient)': [7, 7, 6, 86],
            'VDT Measure C Stage 3 (Inpatient)': [7, 7, 4, 57]
        }

        self.assertEqual(expected_result, actual_result)

    def test_case_in_0133(self):
        test_pat = get_test_pat('040133')
        self.prepare_data(test_pat, 'first', 'No', 'Yes')

        actual_result = self.get_result()
        expected_result = {
            'VDT Measure A Stage 2 (Inpatient)': [8, 8, 6, 75],
            'VDT Measure A Stage 3 (Inpatient)': [8, 8, 8, 100],
            'VDT Measure B Stage 2 (Inpatient)': [8, 8, 6, 75],
            'VDT Measure B Stage 3 (Inpatient)': [8, 8, 6, 75],
            'VDT Measure C Stage 3 (Inpatient)': [8, 8, 5, 63]
        }

        self.assertEqual(expected_result, actual_result)

    def test_case_in_0141(self):
        test_pat = get_test_pat('040141')
        self.prepare_data(test_pat, 'first', 'No', 'No')

        actual_result = self.get_result()
        expected_result = {
            'VDT Measure A Stage 2 (Inpatient)': [9, 9, 6, 67],
            'VDT Measure A Stage 3 (Inpatient)': [9, 9, 8, 89],
            'VDT Measure B Stage 2 (Inpatient)': [9, 9, 6, 67],
            'VDT Measure B Stage 3 (Inpatient)': [9, 9, 6, 67],
            'VDT Measure C Stage 3 (Inpatient)': [9, 9, 5, 56]
        }

        self.assertEqual(expected_result, actual_result)

    def test_case_in_0142(self):
        test_pat = get_test_pat('040142')
        self.prepare_data(test_pat, 'first', 'No', 'No')

        actual_result = self.get_result()
        expected_result = {
            'VDT Measure A Stage 2 (Inpatient)': [10, 10, 6, 60],
            'VDT Measure A Stage 3 (Inpatient)': [10, 10, 8, 80],
            'VDT Measure B Stage 2 (Inpatient)': [10, 10, 6, 60],
            'VDT Measure B Stage 3 (Inpatient)': [10, 10, 6, 60],
            'VDT Measure C Stage 3 (Inpatient)': [10, 10, 5, 50]
        }

        self.assertEqual(expected_result, actual_result)

    def test_case_in_0143(self):
        test_pat = get_test_pat('040143')
        self.prepare_data(test_pat, 'first', 'No', 'No')

        actual_result = self.get_result()
        expected_result = {
            'VDT Measure A Stage 2 (Inpatient)': [11, 11, 6, 55],
            'VDT Measure A Stage 3 (Inpatient)': [11, 11, 8, 73],
            'VDT Measure B Stage 2 (Inpatient)': [11, 11, 6, 55],
            'VDT Measure B Stage 3 (Inpatient)': [11, 11, 6, 55],
            'VDT Measure C Stage 3 (Inpatient)': [11, 11, 5, 45]
        }

        self.assertEqual(expected_result, actual_result)

    def test_case_in_0144(self):
        test_pat = get_test_pat('040144')
        self.prepare_data(test_pat, 'first', 'No', 'No')

        actual_result = self.get_result()
        expected_result = {
            'VDT Measure A Stage 2 (Inpatient)': [12, 12, 6, 50],
            'VDT Measure A Stage 3 (Inpatient)': [12, 12, 8, 67],
            'VDT Measure B Stage 2 (Inpatient)': [12, 12, 6, 50],
            'VDT Measure B Stage 3 (Inpatient)': [12, 12, 6, 50],
            'VDT Measure C Stage 3 (Inpatient)': [12, 12, 5, 42]
        }

        self.assertEqual(expected_result, actual_result)

    def test_case_in_0151(self):
        test_pat = get_test_pat('040115', second='second')
        self.prepare_data(test_pat, 'second', 'Yes', 'No')

        actual_result = self.get_result()
        expected_result = {
            'VDT Measure A Stage 2 (Inpatient)': [12, 12, 6, 50],
            'VDT Measure A Stage 3 (Inpatient)': [12, 12, 8, 67],
            'VDT Measure B Stage 2 (Inpatient)': [12, 12, 6, 50],
            'VDT Measure B Stage 3 (Inpatient)': [12, 12, 6, 50],
            'VDT Measure C Stage 3 (Inpatient)': [12, 12, 5, 42]
        }

        self.assertEqual(expected_result, actual_result)

    def admit_discharge(self, test_pat, unit='MCC'):
        # Admit and check-in patient
        self.browser.switch_to_window('ehr_main')
        self.patctrl.admit(test_pat, unit)
        sleep(60)
        self.patctrl.discharge()

    def transfer(self, test_pat, unit='M6S'):
        self.browser.switch_to_window('ehr_main')
        self.patctrl.select_patient(get_full_name(test_pat))
        self.patctrl.transfer(unit=unit)

    def admit_checkin(self, test_pat):
        # Admit and check-in patient
        self.browser.switch_to_window('ehr_main')
        self.patctrl.admit(test_pat, 'MCC')
        self.patctrl.check_in()

    def create_account(self, test_pat):
        # Create account.
        self.browser.switch_to_window('ea_create')
        self.pat_eaccess.create_account(test_pat['ssn'], test_pat['ssn'],
                                        get_full_name(test_pat), '123')

    def e_access(self, test_pat):
        # Create account and do PatElectronicAccess
        self.browser.switch_to_window('ea_access')
        self.pat_eaccess.e_access(test_pat['ssn'], '123')
        self.browser.driver.back()

    def get_result(self):
        # Check result
        self.browser.switch_to_window('ehr_amc')
        sleep(8)
        self.amc.query()
        return self.amc.get_result('VDT Measure', 'Inpatient')

    def prepare_data(self, test_pat, encounter, create, access):
        if encounter == 'first':
            self.admit_discharge(test_pat)
        else:
            self.transfer(test_pat)

        if create == 'Yes':
            self.create_account(test_pat)
            self.e_access(test_pat)

        if access == 'Yes':
            ssh_execute('10.2.2.19',
                        '.dosu VDTByPatient ' + test_pat['ssn'] + ' 123')