def test_doctor_first(self):

        d = Doctor("Jack", "Urologist")
        self.h.on_doctor_called(d)
        self.assertIsNotNone(self.h.doctors,
                             "The doctor should be waiting for a patient!")

        p = Patient("Alicia", "Kidney issues")
        self.h.on_patient_visit(p)
        self.assertTrue(d.is_with_patient(),
                        "The doctor should be seeing the patient!")
        self.assertEqual(self.h.patients, [],
                         "There should be no patients in the waiting room!")

        pp = Patient("Edward", "Kidney issues")
        self.h.on_patient_visit(pp)
        self.assertEqual(
            self.h.patients, [pp],
            "The new patient should be waiting for the urologist")
        self.h.on_doctor_called(d)
        self.assertEqual(
            self.h.patients, [pp],
            "The urologist is still with his other patient, "
            "even though he was called! "
            "The patient should still be waiting!")

        self.assertEqual(self.h.doctors, [],
                         "There should be no available doctors!")
Example #2
0
 def get_time(self, QDate):
     doctor_name = self.doctor.currentText()
     service_name = self.service.currentText()
     duration = self.service_time[service_name]
     a = Doctor(doctor_name)
     date = '{2}-{0}-{1}'.format(QDate.month(), QDate.day(), QDate.year())
     self.listWidget.clear()
     if pd.to_datetime(date).weekday() < 5:
         if pd.to_datetime(date) > datetime.today():
             for i in a.show_available_slots(date, service_name):
                 time = (datetime.strptime(i, '%H:%M') +
                         timedelta(minutes=duration))
                 end_time = datetime.strftime(time, '%H:%M')
                 item = i + ' - ' + end_time
                 self.listWidget.addItem(item)
         else:
             x = [
                 datetime.strptime(i, '%H:%M')
                 for i in a.show_available_slots(date, service_name)
             ]
             x = [j for j in x if datetime.now().time() < j.time()]
             x = [datetime.strftime(i, '%H:%M') for i in x]
             for i in x:
                 time = (datetime.strptime(i, '%H:%M') +
                         timedelta(minutes=duration))
                 end_time = datetime.strftime(time, '%H:%M')
                 item = i + ' - ' + end_time
                 self.listWidget.addItem(item)
Example #3
0
 def __init__(self, env, instance_id, service):
     self.env = env
     self.instance_id = instance_id
     self.service = service
     doc = Doctor(self, self.env, self.instance_id, self.service)
     client = doc.create_client()
     instance = doc.create_instance()
def create_doctors():
    calendar = Calendar_times()

    doctor1 = Doctor('Dr.',
                        'Renata Silverstone',
                        ['general', 'cardiosurgery'],
                        '+49 169 05251 0000',
                        calendar.morning)

    doctor2 = Doctor('Dr.',
                        'Maria Wegener',
                        ['general', 'dermatological_surgeon'],
                        '+49 169 05251 1111',
                        calendar.morning + calendar.afternoon)

    doctor3 = Doctor('Dr.',
                        'Greta Koopmann',
                        ['general', 'orthopedist'],
                        '+49 169 05251 2222',
                        calendar.afternoon)

    doctor4 = Doctor('Dr.',
                        'Christian Gösling',
                        ['general', 'neurologist'],
                        '+49 169 05251 3333',
                        calendar.morning)

    doctor5 = Doctor('Dr.',
                        'Viktor Kratchnisky',
                        ['general', 'emergency_doc'],
                        '+49 169 05251 4444',
                        calendar.morning + calendar.afternoon)

    return [doctor1, doctor2, doctor3, doctor4, doctor5]
Example #5
0
class DoctorClientHandler(Thread):
    """Handles a session between a doctor and a patient."""
    def __init__(self, client):
        Thread.__init__(self)
        #print(str(client))
        self.client = client
        self.dr = Doctor()

    def run(self):
        self.client.send(bytes(self.dr.greeting(self.client), CODE))
        while True:
            message = decode(self.client.recv(BUFSIZE), CODE)
            #print(str(message))
            #ibig sabihin None to?
            if not message:
                #somewhere d2 dapat issave nia ung data ni message
                #print(self.dr.history, self.dr.person)
                #so aun i save mo ung dat file ulit
                # self.client.send(bytes(self.dr.farewell(), CODE))
                self.dr.updateFile()
                print("Client disconnected")
                self.client.close()
                break
            else:
                #print('yes d2 ako pumasok ok ')
                self.client.send(bytes(self.dr.reply(message), CODE))
Example #6
0
    def test_get_description(self):
        """This one ensures that this method works correctly."""
        self.assertEqual(self.doctor.get_description(), None)

        self.doctor_1 = Doctor("Daniel", "Ta", "1980-09-12", "433 Bigbang, New Westminster, BC",
                             1, False, 123, 800000)
        self.assertEqual(self.doctor_1.get_description(), None)
def create_doctors():
    calendar = Calendar_times()

    doctor1 = Doctor('Dr.',
                     'Paul Stollmann',
                     ['general', 'cardiosurgery'],
                     '+49 159 05251 0000',
                     calendar.morning)

    doctor2 = Doctor('Dr.',
                     'Maria Anna Weber',
                     ['general', 'orthopedist'],
                     '+49 159 05251 1111',
                     calendar.morning + calendar.afternoon)

    doctor3 = Doctor('Dr.',
                     'Cristina Pardo Trigo',
                     ['general', 'emergency_doc'],
                     '+49 159 05251 2222',
                     calendar.afternoon)

    doctor4 = Doctor('Dr.',
                     'Sarah Altmann',
                     ['general', 'internist'],
                     '+49 159 05251 3333',
                     calendar.morning)

    doctor5 = Doctor('Dr.',
                     'Tobias Knippschild',
                     ['general', 'dermatological_surgeon'],
                     '+49 159 05251 4444',
                     calendar.morning + calendar.afternoon)

    return [doctor1, doctor2, doctor3, doctor4, doctor5]
Example #8
0
    def doctorSoup(self, url):

        print("Starting a Thread ", threading.current_thread().name)
        headers = {
            'User-Agent':
            generate_user_agent(device_type="desktop", os=('mac', 'linux'))
        }

        # FORM A URL

        doctor_pageresponse = requests.get(self.parent_domain + url,
                                           timeout=5,
                                           headers=headers)
        print(doctor_pageresponse.status_code)
        soup = BeautifulSoup(doctor_pageresponse.text, "lxml")

        temp_city = url.split("/")[-1]
        for a in soup.find_all("li", {"data-view": "dr-search-card"}):

            doc_dom = []
            for x in a.find_all("a"):
                if (x.get("href") not in doc_dom):
                    doc_dom.append(x.get("href"))

            doc_url = self.parent_domain + doc_dom[0]
            doctor = Doctor(doc_url)
            doctor.buildDoctor(temp_city)
Example #9
0
def run_game():
    pygame.init()
    ai_settings = Settings()
    screen = pygame.display.set_mode((
        (ai_settings.screen_width, ai_settings.screen_height)
    ))
    pygame.display.set_caption("Corona Python")
    play_button = Button(ai_settings, screen, "Play")
    doctor = Doctor(ai_settings, screen)
    bullets = Group()
    viruses = Group()

    stats = GameStats(ai_settings)
    sb = ScoreBoard(ai_settings, screen, stats)

    gf.create_fleet(ai_settings, screen, doctor, viruses)

    while True:
        gf.check_events(ai_settings, screen, stats,
                        sb, play_button, doctor, viruses, bullets)

        if stats.game_active:
            doctor.update()
            gf.update_bullets(ai_settings, screen, stats,
                              sb, doctor, viruses, bullets)
            gf.update_bullets(ai_settings, screen, stats,
                              sb, doctor, viruses, bullets)
            gf.update_viruses(ai_settings, stats, screen,
                              doctor, viruses, bullets)
            for bullet in bullets.copy():
                if bullet.rect.bottom <= 0:
                    bullets.remove(bullet)
            gf.update_screen(ai_settings, screen, stats, sb, doctor,
                             viruses, bullets, play_button)
Example #10
0
def main():
    d = Doctor()
    print(d.greeting())
    while True:
        sentence = input("\n>> ")
        if sentence.upper() == "QUIT":
            print(d.farewell())
            break
        print(d.reply(sentence))
    def test_patient_first(self):

        p = Patient("Alan", "Broken arm")
        self.h.on_patient_visit(p)
        self.assertEqual(self.h.patients, [p], "Alan should be waiting for an ER doctor!")

        d = Doctor("Larry", "Emergency medicine")
        self.h.on_doctor_called(d)
        self.assertTrue(d.is_with_patient(), "The doctor should be seeing the patient with the broken arm!")
    def test_doctor_busy(self):
        d = Doctor("Joe", "Gastroenterologist")
        d.assign_patient(Patient("Someone", "Stomach pain"))
        self.h.on_doctor_called(d)

        self.assertEqual(self.h.doctors, [], "That doctor was busy and should not be waiting for anyone!")

        dd = Doctor("Edward", "Emergency medicine")
        self.h.on_doctor_called(dd)
        self.assertEqual(self.h.doctors, [dd], "That doctor was busy and should not be waiting for anyone!")
    def test_patient_first(self):

        p = Patient("Alan", "Broken arm")
        self.h.on_patient_visit(p)
        self.assertEqual(self.h.patients, [p],
                         "Alan should be waiting for an ER doctor!")

        d = Doctor("Larry", "Emergency medicine")
        self.h.on_doctor_called(d)
        self.assertTrue(
            d.is_with_patient(),
            "The doctor should be seeing the patient with the broken arm!")
    def test_doctor_busy(self):
        d = Doctor("Joe", "Gastroenterologist")
        d.assign_patient(Patient("Someone", "Stomach pain"))
        self.h.on_doctor_called(d)

        self.assertEqual(
            self.h.doctors, [],
            "That doctor was busy and should not be waiting for anyone!")

        dd = Doctor("Edward", "Emergency medicine")
        self.h.on_doctor_called(dd)
        self.assertEqual(
            self.h.doctors, [dd],
            "That doctor was busy and should not be waiting for anyone!")
Example #15
0
def SwitchToRoleMenu():

    if (staff_role == "d"):
        doctor = Doctor(staff_name, staff_id)
        doctor.doctorMenu()
    elif (staff_role == "n"):
        nurse = Nurse(staff_name, staff_id)
        nurse.InitializeNurseMenu()
    elif (staff_role == "a"):
        admin = Admin(staff_name, staff_id)
        admin.AdminMenu()
    else:
        print("\nSomething went wrong please re-login")
    Login()
Example #16
0
def login(*args):
    valid_username = False
    valid_pass = False
    user = None
    username = input("Username: "******"No user with this username!")
        else:
            print("Wrong password!")

    return user
Example #17
0
 def insertar(self, nombre, apellido, fecha_nacimiento, sexo,
              nombre_usuario, pwd, especialidad, telefono):
     id = len(self.doctores)
     self.doctores.append(
         Doctor(id, nombre, apellido, fecha_nacimiento, sexo,
                nombre_usuario, pwd, especialidad, telefono))
     return id
Example #18
0
    def test_invalid_constructor(self):
        """This method tests invalid constructors of the Doctor class."""
        with self.assertRaises(TypeError):
            doctor_1 = Doctor("Maria", "Tran", "1980-09-12", "1444 Oakway, North Vancouver, Vancouver, BC",
                             1, False, "123", 145000)

        with self.assertRaises(ValueError):
            doctor_2 = Doctor("Maria", "Tran", "1980-09-12", "1444 Oakway, North Vancouver, Vancouver, BC",
                             1, False, 0, 145000)

        with self.assertRaises(TypeError):
            doctor_3 = Doctor("Maria", "Tran", "1980-09-12", "1444 Oakway, North Vancouver, Vancouver, BC",
                             1, False, 123, "145000")

        with self.assertRaises(ValueError):
            doctor_4 = Doctor("Maria", "Tran", "1980-09-12", "1444 Oakway, North Vancouver, Vancouver, BC",
                             1, False, 123, 90000)
Example #19
0
class DoctorClientHandler(Thread):
    """Handles a session between a doctor and a patient."""
    def __init__(self, client):
        Thread.__init__(self)
        self.client = client
        self.dr = Doctor()

    def run(self):
        self.client.send(bytes(self.dr.greeting(), CODE))
        while True:
            message = decode(self.client.recv(BUFSIZE), CODE)
            if not message:
                print("Client disconnected")
                self.client.close()
                break
            else:
                self.client.send(bytes(self.dr.reply(message), CODE))
Example #20
0
 def main(self  ):
     """Handles the interaction between user and the class doctor."""
     print("Good morning, I hope you are well today.")
     print("What can I do for you?")
     while True:
         sentence = input("\n>> ")
         if sentence.upper() == "QUIT":
             print("Have a nice day!")
             break
         print(Doctor().reply(sentence))
    def __init__(self):
        """Initialize the game and create game resources."""
        pygame.init()
        self.settings = Settings()

        self.screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
        self.settings.screen_width = self.screen.get_rect().width
        self.settings.screen_height = self.screen.get_rect().height

        pygame.display.set_caption('Corona Invasion')

        self.doctor = Doctor(self)
        self.vaccine = pygame.sprite.Group()
        self.virus = pygame.sprite.Group()

        self._create_fleet()

        # Set background colour.
        self.bg_color = (230, 230, 230)
Example #22
0
class DoctorClientHandler(Thread):
    """Handles a session between a doctor and a patient."""
    def __init__(self, client):
        Thread.__init__(self)
        self.client = client
        self.dr = Doctor()

    def readData(self, name):
        if os.path.isfile(name + ".dat"):
            print("Patient " + name + " already exist...")
            exFile = open(name + ".dat", 'rb')
            FList = pickle.load(exFile)
            history.extend(FList)
            print("History: " + str(history))
            exFile.close()
            self.client.send(bytes(self.dr.reply(str(history[-1])), CODE))
            File = open(name + '.dat', 'wb')
            return File
        else:
            File = open(name + ".dat", "wb")
            self.client.send(bytes(self.dr.greeting(), CODE))
            return File

    def run(self):
        self.client.send(bytes(self.dr.askname(), CODE))
        ptname = decode(self.client.recv(BUFSIZE), CODE)
        print("Patient " + ptname + " connected...")
        pFile = self.readData(ptname)

        while True:
            message = decode(self.client.recv(BUFSIZE), CODE)
            history.append(str(message))
            if not message:
                del history[-1]
                pickle.dump(history, pFile)
                pFile.close()
                history.clear()
                print("Patient " + ptname + " disconnected")
                self.client.close()
                break
            else:
                self.client.send(bytes(self.dr.reply(message), CODE))
Example #23
0
def init():
    for i in range(num_bac):
        bacteria.add(
            VirusNode(
                (random.randint(50, width - 50), random.randint(
                    50, height - 50)), split_time))
    for i in range(num_docs):
        doctors.add(
            Doctor(
                (random.randint(50,
                                width - 50), random.randint(50, height - 50))))
    def test_doctor_first(self):

        d = Doctor("Jack", "Urologist")
        self.h.on_doctor_called(d)
        self.assertIsNotNone(self.h.doctors, "The doctor should be waiting for a patient!")

        p = Patient("Alicia", "Kidney issues")
        self.h.on_patient_visit(p)
        self.assertTrue(d.is_with_patient(), "The doctor should be seeing the patient!")
        self.assertEqual(self.h.patients, [], "There should be no patients in the waiting room!")

        pp = Patient("Edward", "Kidney issues")
        self.h.on_patient_visit(pp)
        self.assertEqual(self.h.patients, [pp], "The new patient should be waiting for the urologist")
        self.h.on_doctor_called(d)
        self.assertEqual(self.h.patients, [pp], "The urologist is still with his other patient, "
                                                "even though he was called! "
                                                "The patient should still be waiting!")

        self.assertEqual(self.h.doctors, [], "There should be no available doctors!")
Example #25
0
def diagnose_condition(symptoms, age_group=None):
    """Prevents the segfault from bringing the entire process down.

  This function *MUST* be run in a background thread.

  For example:

    symptoms = ['fever', 'swollenglands']
    t = threading.Thread(target=diagnose_condition, args=(symptoms))
    t.start()
    t.join()
    print diagnosis
    >>> 'mumps'
  """

    global diagnosis
    from doctor import Doctor

    d = Doctor('medical.pl')
    diagnosis = d.diagnose(symptoms, age_group)
    return
Example #26
0
File: app.py Project: JSkally/ai
def diagnose_condition(symptoms, age_group=None):
  """Prevents the segfault from bringing the entire process down.

  This function *MUST* be run in a background thread.

  For example:

    symptoms = ['fever', 'swollenglands']
    t = threading.Thread(target=diagnose_condition, args=(symptoms))
    t.start()
    t.join()
    print diagnosis
    >>> 'mumps'
  """

  global diagnosis
  from doctor import Doctor

  d = Doctor('medical.pl')
  diagnosis = d.diagnose(symptoms,age_group)
  return
    def test_too_many_patients(self):
        n = 100
        many = [None] * n
        for i in range(n):
            many[i] = Patient("SameName", "Kidney issues")

        for p in many:
            self.h.on_patient_visit(p)

        self.assertEqual(self.h.patients, many, "There should be 100 patients waiting for the urologist!")

        er = Doctor("Mark", "Urologist")
        self.h.on_doctor_called(er)

        self.assertTrue(er.is_with_patient(), "The urologist should be seeing one of those 100 patients!")
        self.assertEqual(self.h.patients, many[1:n], "One of the patients should have been helped!")
        self.assertEqual(self.h.doctors, [], "There's so many patients to help! The urologist shouldn't be waiting around")

        er.current_patient = None
        self.assertFalse(er.is_with_patient(), "The urologist finished with a patient and should be free!")

        for j in range(1, n):
            self.h.on_doctor_called(er)
            self.assertTrue(er.is_with_patient(), "The urologist should be seeing one of those 100 patients!")
            self.assertEqual(self.h.patients, many[j+1:n], "One of the patients should have been helped!")
            self.assertEqual(self.h.doctors, [], "There's so many patients to help! The urologist shouldn't be waiting around")
            er.current_patient = None

        for i in range(n):
            many[i] = Patient("NotInsured", "Stomach pain", has_insurance=False)

        for p in many:
            self.h.on_patient_visit(p)

        self.assertEqual(self.h.patients, [], "None of those people had insurance!")
    def setUp(self) -> None:
        """Initialize setup object"""
        self.department = Department("Emergency")
        self.department1 = Department("Surgery")
        self.read_mock = Mock()
        self.department._write_to_file = self.read_mock

        self.doctor1 = Doctor("George", "Bush", "1982-2-28",
                              "97334 Oak Bridge , Vancouver, Vancouver, BC", 2,
                              False, 125, 190000)
        self.patient1 = Patient("Jose", "McDonald", "1970-12-12",
                                "3432 Newtons, Richmond, BC", 1, False, 590)
        self.doctor2 = Doctor("Johnny", "Kenedy", "1984-1-30",
                              "1444 Oakway, North Vancouver, Vancouver, BC", 1,
                              False, 123, 150000)
        self.patient2 = Patient("Bill", "Stark", "1970-12-12",
                                "1111 Columbia, New Westminster, BC", 2, False,
                                589, 10000)

        self.patient3 = Patient("Tony", "Stark", "1960-9-2",
                                "1111 Columbia, New Westminster, BC", 12,
                                False, 589)
    def __init__(self, wwwroot_path='wwwroot', udp_ip='127.0.0.1', udp_port=50000):
        """Creates and starts the simulation server"""
        self.wwwroot_path = wwwroot_path
        self.udp_ip = udp_ip
        self.udp_port = udp_port

        # This dict stores devices by their internal name
        self.devices_by_name = dict()

        # Start a thread to clean up zombie devices
        self.zombie_thread = threading.Thread(
            name='zombies', target=self.zombie_thread_function, daemon=True)
        self.zombie_thread.start()

        # Start the UDP server thread for simulating bluetooth
        self.bluetooth_thread = threading.Thread(
            name='bluetooth', target=self.bluetooth_thread_function, daemon=True)
        self.bluetooth_thread.start()

        # create a doctor
        self.doctor = Doctor(self)

        # Start the web server, hosting the Google Maps frontend
        WebSocketHandler.server = self
        MoveRequestHandler.server = self
        WarningRequestHandler.server = self
        self.web_socket_handlers = set()
        tornado_app = tornado.web.Application([
            (r'/ws', WebSocketHandler),
            (r'/move', MoveRequestHandler),
            (r'/warning', WarningRequestHandler),
            (r'/(.*)', tornado.web.StaticFileHandler,
             {'path': self.wwwroot_path, 'default_filename': 'index.html'})

        ])

        tornado_app.listen(WWW_PORT)
        self.ioloop = tornado.ioloop.IOLoop.instance()
        self.ioloop.start()
def create_doctors():
    calendar = Calendar_times()

    doctor1 = Doctor('Dr.', 'Wolfgang Elpart', ['general', 'emergency_doc'],
                     '+49 139 05251 0000', calendar.morning)

    doctor2 = Doctor('Dr.', 'Silvia Krogull', ['general', 'cardiosurgery'],
                     '+49 139 05251 1111',
                     calendar.morning + calendar.afternoon)

    doctor3 = Doctor('Dr.', 'Achim Röttinger', ['general', 'orthopedist'],
                     '+49 139 05251 2222', calendar.afternoon)

    doctor4 = Doctor('Dr.', 'Christian Koerdt',
                     ['general', 'dermatological_surgeon'],
                     '+49 139 05251 3333', calendar.morning)

    doctor5 = Doctor('Dr.', 'Katja Müllermeier',
                     ['general', 'ophthalmologist'], '+49 139 05251 4444',
                     calendar.morning + calendar.afternoon)

    return [doctor1, doctor2, doctor3, doctor4, doctor5]
    def test_too_many_patients(self):
        n = 100
        many = [None] * n
        for i in range(n):
            many[i] = Patient("SameName", "Kidney issues")

        for p in many:
            self.h.on_patient_visit(p)

        self.assertEqual(
            self.h.patients, many,
            "There should be 100 patients waiting for the urologist!")

        er = Doctor("Mark", "Urologist")
        self.h.on_doctor_called(er)

        self.assertTrue(
            er.is_with_patient(),
            "The urologist should be seeing one of those 100 patients!")
        self.assertEqual(self.h.patients, many[1:n],
                         "One of the patients should have been helped!")
        self.assertEqual(
            self.h.doctors, [],
            "There's so many patients to help! The urologist shouldn't be waiting around"
        )

        er.current_patient = None
        self.assertFalse(
            er.is_with_patient(),
            "The urologist finished with a patient and should be free!")

        for j in range(1, n):
            self.h.on_doctor_called(er)
            self.assertTrue(
                er.is_with_patient(),
                "The urologist should be seeing one of those 100 patients!")
            self.assertEqual(self.h.patients, many[j + 1:n],
                             "One of the patients should have been helped!")
            self.assertEqual(
                self.h.doctors, [],
                "There's so many patients to help! The urologist shouldn't be waiting around"
            )
            er.current_patient = None

        for i in range(n):
            many[i] = Patient("NotInsured",
                              "Stomach pain",
                              has_insurance=False)

        for p in many:
            self.h.on_patient_visit(p)

        self.assertEqual(self.h.patients, [],
                         "None of those people had insurance!")
    def test_patient_doc_match(self):
        p = Patient("Joe", "Broken arm")
        d = Doctor("Lil Dicky", "Urologist")
        c = Doctor("Alicia", "Oncologist")

        self.h.on_patient_visit(p)
        self.assertEqual(
            self.h.patients, [p],
            "Joe with the broken arm should be in the waiting room!")

        self.h.on_doctor_called(c)
        self.h.on_doctor_called(d)
        self.assertEqual(
            self.h.doctors, [c, d],
            "Lil Dicky the urologist should be waiting for a patient!")

        n = Patient("Suzzy", "Stomach pain")
        m = Doctor("Alan", "Gastroenterologist")

        self.h.on_patient_visit(n)
        self.assertEqual(self.h.patients, [p, n],
                         "There should be two patients in the waiting room!")

        self.h.on_doctor_called(m)
        self.assertEqual(
            self.h.patients, [p], "Suzzy with the stomach pain was help! "
            "Joe with the broken arm should be waiting!")
        self.assertEqual(
            self.h.doctors, [c, d],
            "Lil Dicky the urologist should be waiting for a patient!")
        self.assertTrue(
            m.is_with_patient(),
            "Alan the gastroenterologist should be helping Suzzy!")

        a = Doctor("Ian", "Emergency medicine")
        self.h.on_doctor_called(a)
        self.assertEqual(
            self.h.patients, [],
            "The ER doctor arrived! There should be no one left to help")
        self.assertEqual(
            self.h.doctors, [c, d],
            "Lil Dicky the urologist should be waiting for a patient!")

        s = Patient("Nate", "Cancer")
        self.h.on_patient_visit(s)
        self.assertEqual(
            self.h.patients, [],
            "The oncologist is available! There should be no one left to help")
        self.assertEqual(
            self.h.doctors, [d],
            "Lil Dicky the urologist should be waiting for a patient!")

        ki = Patient("Angela", "Kidney issues")
        self.h.on_patient_visit(ki)
        self.assertEqual(
            self.h.patients, [],
            "The urologist is available! There should be no one left to help")
        self.assertEqual(self.h.doctors, [],
                         "All the doctors should be helping people!")
    def test_patient_doc_match(self):
        p = Patient("Joe", "Broken arm")
        d = Doctor("Lil Dicky", "Urologist")
        c = Doctor("Alicia", "Oncologist")

        self.h.on_patient_visit(p)
        self.assertEqual(self.h.patients, [p], "Joe with the broken arm should be in the waiting room!")

        self.h.on_doctor_called(c)
        self.h.on_doctor_called(d)
        self.assertEqual(self.h.doctors, [c, d], "Lil Dicky the urologist should be waiting for a patient!")

        n = Patient("Suzzy", "Stomach pain")
        m = Doctor("Alan", "Gastroenterologist")

        self.h.on_patient_visit(n)
        self.assertEqual(self.h.patients, [p, n], "There should be two patients in the waiting room!")

        self.h.on_doctor_called(m)
        self.assertEqual(self.h.patients, [p], "Suzzy with the stomach pain was help! "
                                               "Joe with the broken arm should be waiting!")
        self.assertEqual(self.h.doctors, [c, d], "Lil Dicky the urologist should be waiting for a patient!")
        self.assertTrue(m.is_with_patient(), "Alan the gastroenterologist should be helping Suzzy!")

        a = Doctor("Ian", "Emergency medicine")
        self.h.on_doctor_called(a)
        self.assertEqual(self.h.patients, [], "The ER doctor arrived! There should be no one left to help")
        self.assertEqual(self.h.doctors, [c, d], "Lil Dicky the urologist should be waiting for a patient!")

        s = Patient("Nate", "Cancer")
        self.h.on_patient_visit(s)
        self.assertEqual(self.h.patients, [], "The oncologist is available! There should be no one left to help")
        self.assertEqual(self.h.doctors, [d], "Lil Dicky the urologist should be waiting for a patient!")

        ki = Patient("Angela", "Kidney issues")
        self.h.on_patient_visit(ki)
        self.assertEqual(self.h.patients, [], "The urologist is available! There should be no one left to help")
        self.assertEqual(self.h.doctors, [], "All the doctors should be helping people!")
Example #34
0
 def __createUser(self, name, job, birth):
     birth = map(int, birth.split("/"))
     registration = self.__generateRegistration(job)
     password = str(birth[2]) + registration[0:4]
     if (job.upper() == "MANAGER"):
         user = Manager(name, registration, password, job.upper(), birth)
     elif (job.upper() == "DOCTOR"):
         user = Doctor(name, registration, password, job.upper(), birth)
     elif (job.upper() == "TECHNICIAN"):
         user = Technician(name, registration, password.upper(), job, birth)
     else:
         raise EmployeeException("Invalid job!")
     self.__numberOfAccounts += 1
     return user
Example #35
0
 def create_entities(self, person_list, person_type):
     """Create entity from data loaded from file"""
     for data in person_list:
         datetime_object = data["date_of_birth"][0:-9]
         if person_type == 'Patient':
             person = Patient(data["first_name"], data["last_name"],
                              datetime_object, data["address"], data["id"],
                              data["is_released"], data["room_num"], data["bill"])
             self._department.append(person)
         elif person_type == 'Doctor':
             person = Doctor(data["first_name"], data["last_name"],
                             datetime_object, data["address"], data["id"],
                             data["is_released"], data["office_num"], data["income"])
             self._department.append(person)
Example #36
0
def init():
    global round_over
    bacteria.empty()
    doctors.empty()
    round_over = False
    for i in range(bac_num):
        bacteria.add(
            VirusNode(
                (random.randint(50, width - 50), random.randint(
                    50, height - 50)), split_time))
    for i in range(doc_num):
        doctors.add(
            Doctor(
                (random.randint(50,
                                width - 50), random.randint(50, height - 50))))
Example #37
0
from doctor import Doctor

HOST = 'localhost'
PORT = 21567
ADDRESS = (HOST, PORT)
BUFSIZE = 1024

server = socket(AF_INET, SOCK_STREAM)
server.bind(ADDRESS)
server.listen(5)

while True:
    print 'Waiting for connection . . .'
    client, address = server.accept()
    print '... connected from:', address
    dr = Doctor()
    client.send(dr.greeting())

    while True:
        message = client.recv(BUFSIZE)
        if not message:
            print 'Client disconnected'
            client.close()
            break
        else:
            client.send(dr.reply(message))

server.close()


Example #38
0
    #  'nick':     'Doctorious',
    #  'ident':    'bot',
    #  'channels': ['#ole', '#doctor',],
    #},
    {
      'host':     'irc.freenode.org',
      'nick':     'Doctorious',
      'channels': ['#doctor'],
    }
  ],

  # Scripts to load on startup
  'scripts': [
    'auth',
    'example',
    'notify',
    'wolfram',
    'title',
  ],

  # Triggers the bot should treat as "commands"
  'trigger': ('!', '.',),

  # Prefix for all messages sent from the bot
  'prefix': '\x0310>\x0F '
}

if __name__ == '__main__':
    bot = Doctor(options)
    bot.run()