コード例 #1
0
    def cond_changed(self):
        self.cBoxPatient1.clear()
        self.cBoxPatient2.clear()

        self.cBoxPatient1.setEnabled(True)
        self.cBoxPatient2.setEnabled(True)

        patient = Patient("id", "full_name", "group", 'research', "file_path")
        comoboBox_patients = list(
            dict.fromkeys(
                patient.get_specific_patients_JSON(
                    self.cBoxRes.currentText())))
        self.cBoxPatient1.addItem("")
        self.cBoxPatient1.addItems(comoboBox_patients)
        self.cBoxPatient2.addItem("")
        self.cBoxPatient2.addItems(comoboBox_patients)

        global cond
        cond = ''
        if (self.cBoxCond.currentText() == 'Alone'):
            cond = 'B'
        elif (self.cBoxCond.currentText() == 'Spontaneous'):
            cond = 'C'
        else:
            cond = 'D'
コード例 #2
0
ファイル: Main.py プロジェクト: nanaboat/data-structures
 def main(self):
     patient1 = Patient('Mark', 'Light Fever')
     #print(patient1)
     freq1 = [Frequency.Morning, Frequency.Afternoon, Frequency.Evening]
     freq2 = [Frequency.Morning, Frequency.Evening]
     #print(''.join([freq.name for freq in freq1]))
     med1 = Medicine('Ibuprofen', 2, freq1)
     med2 = Medicine('Theraflu', 1, freq2)
     #import pdb; pdb.set_trace()
     patient1.add_prescription(med1)
     patient1.add_prescription(med2)
     #patient1.patient_profile()
     alice = Nurse('Alice')
     bob = Nurse('Bob')
     alice.add_time(Frequency.Morning)
     alice.add_time(Frequency.Afternoon)
     bob.add_time(Frequency.Afternoon)
     bob.add_time(Frequency.Evening)
     schedule = Scheduler()
     schedule.update_schedule(alice)
     schedule.update_schedule(bob)
     schedule1 = Scheduler()
     schedule1.update_schedule(alice)
     schedule1.update_schedule(bob)
     event = event_scheduler(time.time, time.sleep)
     print('START:', time.time())
     event.enter(5, 1, schedule1.notify_nurse, (Frequency.Morning, ))
     event.enter(25, 1, schedule1.notify_nurse, (Frequency.Afternoon, ))
     event.run()
コード例 #3
0
ファイル: Gui_main.py プロジェクト: MarkoOtlokan/Medicina2
 def deletePatient(self, LBO):
     self.win.destroy()
     patiente = Patient.xmlToList()
     del patiente[int(LBO)]
     Patient.saveXML(patiente)
     self.initialize_user_interface()
     messagebox.showinfo("Uspeh", "Uspesno ste obrisali pacijenta")
コード例 #4
0
ファイル: AddNew.py プロジェクト: MarkoOtlokan/Medicina2
    def check(self):
        self.fillDate()
        tmpLBO = self.LBO_entry.get()
        if (len(tmpLBO) != 11 or tmpLBO.isdigit() == False):
            messagebox.showinfo("Greska", "Neispravan LBO")
            return
        for key in self.patienteKeys:
            if key == self.LBO_entry.get():
                messagebox.showinfo("Greska", "Uneseni LBO vec postoji")
                return
        if len(self.name_entry.get()) < 3:
            messagebox.showinfo("Greska", "Neispravno ime")
            return
        if len(self.surname_entry.get()) < 3:
            messagebox.showinfo("Greska", "Neispravno prezime")
            return

        try:
            self.date
        except:
            messagebox.showinfo("Greska", "Unesi datum")
            return
        tmpPatient = Patient(
            int(tmpLBO), self.name_entry.get(), self.surname_entry.get(),
            str(self.data['year_selected']) + "-" +
            str(self.data['month_selected']) + "-" +
            str(self.data['day_selected']))
        Patient.addNewPatient(tmpPatient)
        messagebox.showinfo("Uspeh", "Uspesno ste dodali pacijenta")
        self.goBack()
コード例 #5
0
 def setUp(self):
     self._patient = Patient(3, 0, 1, 4, 0.405688678794769, 0,
                             -0.060390322941387, -0.058097454503978, 10, 6,
                             -0.063210369053854, -1.36630588799408, 2, 2075,
                             2)
     self._features_values = (3, 0, 1, 4, 0.405688678794769, 0,
                              -0.060390322941387, -0.058097454503978, 10, 6,
                              -0.063210369053854, -1.36630588799408, 2,
                              2075, 2)
     self._features_names = [
         'patient_id', 'outcome', 'icustay_sequence', 'icustay_id', 'age',
         'sex', 'length_of_hospital', 'bmi', 'number_of_additives',
         'number_of_procedures', 'duration_of_medications',
         'percentage_of_abnormal_lab_events', 'comorbidity_score',
         'hospital_admission_id', 'medication_count'
     ]
     self._10_features_values = (0.405688678794769, 0, -0.060390322941387,
                                 -0.058097454503978, 10, 6,
                                 -0.063210369053854, -1.36630588799408, 2,
                                 2)
     self._10_features_names = [
         'age', 'sex', 'length_of_hospital', 'bmi', 'number_of_additives',
         'number_of_procedures', 'duration_of_medications',
         'percentage_of_abnormal_lab_events', 'comorbidity_score',
         'medication_count'
     ]
     self._patient2 = Patient(12, 1, 1, 13, 0.142910335491309, 0,
                              0.112248064759934, 0, 3, 10,
                              -0.092820258686727, 0.823508270528826, 2,
                              12532, 2)
コード例 #6
0
    def __init__(self, filename=''):
        self.filename = filename   
        
        screenShape = QtGui.QDesktopWidget().screenGeometry()
        self.width = screenShape.width()/3 + 100
        self.height = screenShape.height() - 100
        
        #Create the activities before creating the caregivers
        self.activities_list = ActivitiesList(account=self)
        
        #Store memory objects
        self.memories = [] 
        self.memories2 = []
        #create a bunch of fake data
        people = ['Bill', 'Frank', 'Jess', 'Penelope', 'Faith', 'Kale', 'JJ']
        for i in range(10):
            a = 'Event Title ' + str(i)
            b = QtCore.QDate.currentDate()
            c = 'Description ' + str(i) + 'Generic description of the event, add more details, more details, descriptions, more descriptions, it was fun'
            d = [people[random.randint(0, 6)], people[random.randint(0, 6)], people[random.randint(0, 6)]]
            e = 'stockphoto' + str(i) + '.png'
            l = 'Location ' + str(i)
            self.memories.append(Memory(title=a, date=b, loc=l, descr=c, tags=d, pic_filename=e))
            self.memories2.append(Memory(title=a, date=b, loc=l, descr=c, tags=d, pic_filename=e))
            self.memories[-1].resize_frame(width=self.width, height=3*self.height/6)
            self.memories2[-1].resize_frame(width=self.width, height=3*self.height/6)
        self.memory_browse = mywidgets.MemoryBrowse(elements=self.memories, tags=self.get_tags(), locs=self.get_locations(), account=self)
        self.memory_browse_patient = mywidgets.MemoryBrowse(elements=self.memories2, tags=self.get_tags(), locs=self.get_locations(), account=self, small=True)
        
        #populate with fake data -- eventually either read in data or start from scratch
        self.caregivers = []
        self.caregivers.append(Caregiver(name='Diana', availability=[0, 1, 0, 0, 0, 1, 0], account=self))
        self.caregivers.append(Caregiver(name='Caregiver 1', availability=[0, 0, 1, 0, 0, 0, 0], account=self))
        self.caregivers.append(Caregiver(name='Caregiver 2', availability=[0, 0, 0, 1, 0, 0, 0], account=self))
        self.caregivers.append(Caregiver(name='Caregiver 3', availability=[0, 0, 0, 0, 1, 0, 0], account=self))

        #create a list of colors corresponding to each caregiver
        self.colors = []
        for caregiver in self.caregivers:
            self.colors.append(QtGui.QColor(random.randint(0,255), random.randint(0,255), random.randint(0,255), 150))
            caregiver.browseClicked.connect(self.open_browse_memories)
            caregiver.availabilityChanged.connect(self.update_calendar)
        
        #create the screens
        self.create_caregiver_screen()
        
        #stack for regular caregiver screen, browse memories
        self.cw = QtGui.QStackedLayout() 
        self.cw.addWidget(self.cs)
        self.cw.addWidget(self.memory_browse)
        
        self.caregiver_screen = mywidgets.BaseFrame(width=self.width, height=self.height+100)    
        self.caregiver_screen.grid.addLayout(self.cw, 0, 0)
        
        #suggest an activity
        self.caregivers[self.current_caregiver()].suggest_activity(self.activities_list.get_activity())
        
        #create the patient
        self.patient = Patient(width=self.width, height=self.height, account=self, memory_browse=self.memory_browse_patient)
コード例 #7
0
    def generate(self):
        i = 0
        while self.env.now < Constants.max_time:
            t = expon.rvs(0, 1.0 / Constants.ARRint, size=1)
            yield self.env.timeout(t)

            patient = Patient(self.env)
            self.env.process(patient.attend(self.receptionist))
            i += 1
コード例 #8
0
def modifyuser(id=None):
    if (request.method == "POST"):
        if (id):
            Patient.update(id, create_patient(request.form))
        else:
            id = Patient.create(create_patient(request.form))
        newUrl = "/user/" + id
        return redirect(newUrl)
    if (request.method == "GET"):
        patient = Patient.find_by_HC(id)
        return render_template("edituser.html", patient=patient)
コード例 #9
0
def Test():
    med2 = MedicalExamination(12346, 17162739481, "2015-04-29", "CT",
                              "ne uspesan", "pocek", "neka putanja")

    meds = {}
    meds[med2.id] = med2
    MedicalExamination.saveXML(meds)
    natasa = Patient(17162739481, 's', 'ss', 'sd')

    medL = MedicalExamination.readXML()
    Patient.pronadjiPreglede(natasa)
コード例 #10
0
ファイル: simpleGUI.py プロジェクト: samjaros-luc/OpenMed
def edit_patient_info(patient: Patient) -> None:
    labels = [[gui.T("First Name:")], [gui.T("Last Name:")],
              [gui.T("ID Type:")], [gui.T("ID Value:")], [gui.T("Height:")],
              [gui.T("Weight:")], [gui.T("Sex:")], [gui.T("Date of Birth:")]]
    inputs = [[
        gui.In(patient.first_name,
               key="first_name",
               size=(17, 1),
               disabled=True)
    ], [
        gui.In(patient.last_name, key="last_name", size=(15, 1), disabled=True)
    ],
              [
                  gui.InputCombo(idTypes,
                                 default_value=patient.id_type,
                                 key="id_type",
                                 size=(15, 1),
                                 disabled=True)
              ],
              [
                  gui.In(patient.id_data,
                         key="id_data",
                         size=(15, 1),
                         disabled=True)
              ], [gui.In(str(patient.height), key="height", size=(15, 1))],
              [gui.In(str(patient.weight), key="weight", size=(15, 1))],
              [
                  gui.InputCombo(sexOptions,
                                 default_value=patient.sex,
                                 key="sex",
                                 size=(15, 1))
              ],
              [
                  gui.In(str(patient.dob), key="dob", size=(9, 1), pad=(2, 0)),
                  gui.CalendarButton("",
                                     target="dob",
                                     image_filename="images/calendar.png",
                                     image_subsample=18)
              ]]

    layout = [[gui.Column(labels), gui.Column(inputs)], [gui.Submit()]]

    window = gui.Window("Edit Patient Info").Layout(layout)

    button, values = window.Read()
    patient.first_name = values["first_name"]
    patient.last_name = values["last_name"]
    patient.id_type = values["id_type"]
    patient.id_data = values["id_data"]
    patient.height = values["height"]
    patient.weight = values["weight"]
    patient.sex = values["sex"]
    if len(values["dob"]) >= 10:
        patient.dob = date.fromisoformat(values["dob"][:10])
    else:
        patient.dob = None
    db.push_patient(patient)
コード例 #11
0
ファイル: dataxml.py プロジェクト: glebnaz/practice
 def parsePatient(self):
       doc = xml.dom.minidom.parse(self.filename)
       patients = doc.getElementsByTagName("patient")
       for patient in patients:
           id = patient.getAttribute("id")
           name = patient.getAttribute("first_name")
           surname = patient.getAttribute("last_name")
           father_name = patient.getAttribute("father_name")
           date_of_birth = patient.getAttribute("date_of_birth")
           newpatient = Patient(name,surname,father_name,date_of_birth)
           newpatient.setId(id)
           self.patientsList[id] = newpatient
       print(self.patientsList)
コード例 #12
0
def create_emergency(e_id):
    global patients_dict, patient_id

    if e_id != 1:
        time.sleep(cycle_time)

    e_type = random.choice(emergency_types)
    location = (random.randint(0, width), random.randint(0, height))
    gravity = random.randint(1, 10)

    patients = 100     # just a big number
    while patients > 20:
        patients = round(random.lognormvariate(0, 4)) + 1
    for i in range(patients):
        patient_id += 1
        patients_dict[patient_id] = Patient(patient_id, e_id, gravity)

    vehicles = ["VMER"]
    if e_type == "Non life-threatening":
        vehicles = ["SBV"]
    else:
        if patients == 1:
            n = 1
        elif patients == 2:
            n = numpy.random.choice([1, 2], 1, p=[0.9, 0.1])
        else:
            n = numpy.random.choice([1, 2, 3], 1, p=[0.85, 0.10, 0.05])
        while "VMER" in vehicles and ("SBV" not in vehicles and "SIV" not in vehicles): # because VMER can't be allocated alone
            vehicles = numpy.random.choice(vehicle_types, n, replace=False, p=[0.7, 0.20, 0.10])

    emergency = Emergency(e_id, location, e_type, patients, gravity, vehicles)
    return emergency
コード例 #13
0
 def __generate_walkin(self, lamda):
     now = 0
     walkin_patients = []
     while now < H.SIM_END:
         now += H.Generator.Exponential(lamda)
         walkin_patients.append(Patient(self.PlaceType, arrive_time=now))
     return walkin_patients
コード例 #14
0
 def __generate_external(self, lamda):
     now = 0
     patients = []
     while now < H.SIM_END:
         now += H.Generator.Exponential(lamda)
         patients.append(Patient(self.PlaceType, arrive_time=now))
     return patients
コード例 #15
0
 def generate_patient_prob(self):
     """generate a patient based on a bernoulli process, place it if there's room...
     current behavior - patients LWBS when there is no room in the WR"""
     probability = np.random.uniform(0, 1)
     if probability <= (self.patient_rate / 60):
         # a patient was generated
         if self.get_volume() < self.department_size:
             self.erack.put(Patient(self, 3))
         elif self.WR.qsize() < self.waiting_size:
             self.WR.put(Patient(self, 3))
         else:
             newpt = Patient(self, 3)
             if self.get_verbose():
                 print("Patient", newpt.get_ID(),
                       "left without being seen!")
             self.stats.update_LWBS()
コード例 #16
0
ファイル: AddNew.py プロジェクト: MarkoOtlokan/Medicina2
    def __init__(self, parent, otac, selfP, dic=0):
        self.parent = parent

        #kod za centriranje
        self.parent.withdraw()
        self.parent.update_idletasks(
        )  # Update "requested size" from geometry manager
        x = (self.parent.winfo_screenwidth() -
             self.parent.winfo_reqwidth()) / 2
        y = (self.parent.winfo_screenheight() -
             self.parent.winfo_reqheight()) / 2
        self.parent.geometry("+%d+%d" % (x, y))
        self.parent.deiconify()

        self.patiente = Patient.readXML()  # zbog update
        self.parent.title("Canvas Test")
        self.parent.grid_rowconfigure(0, weight=1)
        self.parent.grid_columnconfigure(0, weight=1)
        self.parent.config(background="lavender")

        self.dic = dic
        self.values = {}
        self.selfP = selfP
        self.cal = calendar.TextCalendar(calendar.SUNDAY)
        self.year = datetime.date.today().year
        self.month = datetime.date.today().month
        self.otac = otac
        self.wid = []
        self.day_selected = 1
        self.month_selected = self.month
        self.year_selected = self.year
        self.day_name = ''

        self.setup(self.year, self.month)
コード例 #17
0
ファイル: AddNew.py プロジェクト: MarkoOtlokan/Medicina2
    def __init__(
            self, parent, otac, patient, first,
            second):  #first i second sluze samo da bi se vratio na prosli nivo
        self.parent = parent

        #kod za centriranje
        self.parent.withdraw()
        self.parent.update_idletasks(
        )  # Update "requested size" from geometry manager
        x = (self.parent.winfo_screenwidth() -
             self.parent.winfo_reqwidth()) / 2
        y = (self.parent.winfo_screenheight() -
             self.parent.winfo_reqheight()) / 2
        self.parent.geometry("+%d+%d" % (x, y))
        self.parent.deiconify()

        self.patiente = Patient.readXML()  # zbog update
        self.parent.title("Canvas Test")
        self.parent.grid_rowconfigure(0, weight=1)
        self.parent.grid_columnconfigure(0, weight=1)
        self.parent.config(background="lavender")

        self.route = ""
        self.first = first
        self.second = second
        self.patient = patient
        self.patientKey = self.patient.LBO
        self.otac = otac
        self.data = {}
        self.id = str(uuid.uuid4().int & (1 << 32) - 1)
        self.frame = tkinter.Frame(self.parent)
        self.initialize_insert_interface()
コード例 #18
0
ファイル: simpleGUI.py プロジェクト: samjaros-luc/OpenMed
def create_new_patient(first_name: str = "",
                       last_name: str = "",
                       id_type: str = "",
                       id_data: str = "") -> None:
    labels = [[gui.T("First Name:")], [gui.T("Last Name:")],
              [gui.T("ID Type:")], [gui.T("ID Value:")], [gui.T("Height:")],
              [gui.T("Weight:")], [gui.T("Sex:")], [gui.T("Date of Birth:")]]
    inputs = [[gui.In(first_name, key="first_name", size=(17, 1))],
              [gui.In(last_name, key="last_name", size=(15, 1))],
              [
                  gui.InputCombo(idTypes,
                                 default_value=id_type,
                                 key="id_type",
                                 size=(15, 1))
              ], [gui.In(id_data, key="id_data", size=(15, 1))],
              [gui.In(key="height", size=(15, 1))],
              [gui.In(key="weight", size=(15, 1))],
              [gui.InputCombo(sexOptions, key="sex", size=(15, 1))],
              [
                  gui.In(str(date.today()), key="dob", size=(9, 1),
                         pad=(2, 0)),
                  gui.CalendarButton("",
                                     target="dob",
                                     image_filename="images/calendar.png",
                                     image_subsample=18)
              ]]

    layout = [[gui.T("Input new patient information:", key="top_text")],
              [gui.Column(labels), gui.Column(inputs)],
              [gui.Submit(), gui.Button("Provider Menu")]]

    window = gui.Window("Edit Patient Info").Layout(layout)

    while True:
        button, values = window.Read()

        if button in (None, "Quit"):
            window.close()
            break
        elif button == "Provider Menu":
            window.close()
            provider_menu()
            break
        elif button == "Submit":
            if len(values["dob"]) >= 10:
                dob = date.fromisoformat(values["dob"][:10])
            else:
                dob = None
            patient = Patient(values["first_name"], values["last_name"], dob,
                              values["id_data"], values["id_type"],
                              values["sex"], values["height"],
                              values["weight"])
            try:
                db.add_patient(patient)
                window.close()
                display_patient(patient)
                break
            except Conflict:
                window["top_text"].update("Patient already exists!")
コード例 #19
0
 def resName_changed(self, value):
     """This function is called when the research name event is triggered, it fills the comobo-box of groups by the right groups.
                 :param value: research name combo-box value.
                 :type value: String.
                 :return value: NONE.
                 """
     if not (value == ''):
         patient = Patient("id", "full_name", "group", 'research',
                           "file_path")
         comoboBox_data = list(
             dict.fromkeys(
                 patient.get_treshold_Dsection_from_JSON(
                     self.CBoxPatGroup_2.currentText(), 'groups'))
         )  # Remove duplicates from list - dictionary cannot have duplicates.
         self.CBoxPatGroup.addItems(comoboBox_data)
     else:
         self.CBoxPatGroup.clear()
コード例 #20
0
ファイル: simpleGUI.py プロジェクト: samjaros-luc/OpenMed
def provider_menu() -> None:
    col1 = [[gui.T("First Name")],
            [
                gui.In(key="first_name",
                       do_not_clear=True,
                       justification="left")
            ], [gui.T("Last Name")],
            [gui.In(key="last_name", do_not_clear=True, justification="left")]]
    col2 = [
        [gui.T("ID Type")],
        [gui.Combo(idTypes, key="id_type")],
        [gui.T("ID Value")],
        [gui.In(key="id_data", do_not_clear=True, justification="left")],
    ]

    layout = [[
        gui.T("Provider Menu",
              size=(30, 1),
              font=("Helvetica", 30),
              justification="center")
    ], [gui.T("Patient Lookup", font=("Helvetica", 20))],
              [gui.T("_" * 80, key="line")],
              [gui.Column(col1), gui.Column(col2)],
              [
                  gui.Submit(),
                  gui.Button("Create New Patient", enable_events=True)
              ]]

    window = gui.Window("OpenMed - Provider Menu",
                        resizable=True).Layout(layout)

    while True:
        button, values = window.Read()

        if button in (None, "Quit"):
            window.close()
            break
        elif button == "Create New Patient":
            window.close()
            create_new_patient(first_name=values["first_name"],
                               last_name=values["last_name"],
                               id_type=values["id_type"],
                               id_data=values["id_data"])
            break
        elif button == "Submit":
            currentPatient = db.get_patient(
                Patient(first_name=values["first_name"],
                        last_name=values["last_name"],
                        id_type=values["id_type"],
                        id_data=values["id_data"]).hashcode)
            if currentPatient is None:
                window["line"].update(
                    "Patient not found. Correct information or use Create New Patient button."
                )
            else:
                window.close()
                display_patient(currentPatient)
                break
コード例 #21
0
    def setUp(self):
        self._patient = Patient(100, 1, 100, 100, 48, 0, 1.51, 28.1, 2, 2, 3,
                                1010, 37.99, 2, 4)

        self._patient1 = Patient(100, 0, 100, 100, 50.33, 0, 1.75, 27.3, 3, 3,
                                 2, 6152, 38.81, 3, 4)
        self._patient2 = Patient(100, 1, 100, 100, 48.63, 1, 1.33, 23.3, 2, 1,
                                 2, 2125, 35.75, 3, 4)
        self._patient3 = Patient(100, 1, 100, 100, 38.23, 1, 2.31, 30.1, 1, 3,
                                 1, 1231, 33.75, 2, 4)
        self._patient4 = Patient(100, 1, 100, 100, 48.63, 1, 1.89, 29.8, 1, 1,
                                 2, 4533, 39.11, 1, 4)

        patients = [
            self._patient1, self._patient2, self._patient3, self._patient4
        ]

        self._kd_tree = KDTree.build(patients)
コード例 #22
0
def patientsdb():
    patientdata = root.child('Patient_Information').get()
    list = []

    for pubid in patientdata:

        patient = patientdata[pubid]

        if patient['firstname']:
            patientsdata = Patient(patient['firstname'], patient['lastname'], patient['gender'], 
                                   patient['contact'], patient['address'], patient['zip'], 
                                   patient['dateofbirth'], patient['admission date'], patient['nric'])

            patientsdata.set_pubid(pubid)
            print(patientsdata.get_pubid())
            list.append(patientsdata)

    return render_template('patientsdb.html', patient=list)
コード例 #23
0
 def __generate_schedule(self, p):
     patients = []
     i = 0
     while i < H.SIM_END:
         # Here, each slot is generated with equal probability.
         if H.Generator.Bernoulli(p):
             patients.append(Patient(arrive_time=i))
         i += H.SLOT
     return patients
コード例 #24
0
 def load_json(cls):
     rec = loads("app_rec.json")
     for i in rec:
         cls.__rec.append(Appointment(patient=Patient(name=i["Patient"]["Name"], illness=i["Patient"]["Illness"],
                                                      age=i["Patient"]["Age"], gender=i["Patient"]["Gender"]),
                                      doctor=Doctor(name=i["Doctor"]["Name"], gender=i["Doctor"]["Gender"],
                                                    qualification=i["Doctor"]["Qualification"],
                                                    age=i["Doctor"]["Age"]),
                                      date=i["Date"]))
コード例 #25
0
 def get_patients(data):
     result = []
     patient_data = []
     patient_count = len(data[0])
     for j in range(patient_count):
         patient_data.clear()
         for i in range(len(data)):
             patient_data.append(data[i][j])
         result.append(Patient(*patient_data))
     return result
コード例 #26
0
ファイル: data_setup.py プロジェクト: ml-lab/BRATS
def setup_files():
    
    print ("======> warning : you called setup_files from data_setup, all previous batches are gone <======")
          
    window_size = model_setup.window_size
    
    Patient.find_patients()
    training_batch = Batch(Patient.patients_list[:201], window_size)
#     testing_batch = Batch(Patient.patients_list[201:], window_size)
 
    
    training_batch.start_iteration()
    training_batch.stop_iteration()
    Batch.save_to_file(training_batch, file_training_batch)
#     Batch.save_to_file(testing_batch, file_testing_batch)
    
   
        
    print ("============> state setup done <============")
コード例 #27
0
ファイル: AddNew.py プロジェクト: MarkoOtlokan/Medicina2
    def __init__(self, parent, otac, path, patient, med=False):
        self.parent = parent

        #kod za centriranje
        self.parent.withdraw()
        self.parent.update_idletasks(
        )  # Update "requested size" from geometry manager
        x = (self.parent.winfo_screenwidth() -
             self.parent.winfo_reqwidth()) / 2
        y = (self.parent.winfo_screenheight() -
             self.parent.winfo_reqheight()) / 2
        self.parent.geometry("+%d+%d" % (x, y))
        self.parent.deiconify()

        self.patiente = Patient.readXML()  # zbog update
        self.parent.title("Canvas Test")
        self.parent.grid_rowconfigure(0, weight=1)
        self.parent.grid_columnconfigure(0, weight=1)
        self.parent.config(background="lavender")

        self.med = med
        self.patient = patient
        self.otac = otac
        self.path = path

        self.nameVar = tkinter.StringVar()
        self.nameVar.set("")
        self.__pacijentPrisutan = tkinter.BooleanVar(False)

        self.sd = tkinter.StringVar()
        self.sd.set("")
        self.__sd = tkinter.BooleanVar(False)

        self.__pbd = tkinter.BooleanVar(False)
        self.pbd = tkinter.StringVar()
        self.pbd.set("")

        self.__rp = tkinter.BooleanVar(False)
        self.rp = tkinter.StringVar()
        self.rp.set("")

        self.__si = tkinter.BooleanVar(False)
        self.si = tkinter.StringVar()
        self.si.set("")

        self.__sdate = tkinter.BooleanVar(False)
        self.sdate = tkinter.StringVar()
        self.sdate.set("")

        self.__pi = tkinter.BooleanVar(False)
        self.pi = tkinter.StringVar()
        self.pi.set("")

        self.initialize_insert_interface()
コード例 #28
0
 def __generate_walkin(self, rate):
     now = H.Generator.Exponential(max(rate))
     walkin_patients = []
     while now < H.EARLY_T:
         if H.Generator.Bernoulli(rate[int(now // 60)] /
                                  max(rate)):  # Thinning
             walkin_patients.append(
                 Patient(self.env, self.PlaceType, arrive_time=now))
             self.Arrive_times.append(now)
         now += H.Generator.Exponential(max(rate))
     return walkin_patients
コード例 #29
0
def build_array(file_to_open):
    patient_array = []

    try:
        training_reader = csv.reader(open(file_to_open))
        for row in training_reader:
            training = Patient((int(row[0])), row[1], row[2], row[3], row[4])
            patient_array.append(training)
    except Exception as e:
        print(e)
    return patient_array
コード例 #30
0
def create_patient(form):
    name = form['name']
    healthCardId = form['healthCardId']
    dateOfBirth = form['dateOfBirth']
    sex = form['sex']
    expiryDate = form['expiryDate']
    primaryAddress = form['primaryAddress']
    phoneNumber = form['phoneNumber']
    healthCondition = form['healthCondition']
    patientcreated = Patient(healthCardId, expiryDate, name, dateOfBirth, sex,
                             phoneNumber, primaryAddress, healthCondition)
    return patientcreated
コード例 #31
0
def main():
    patients,doctors,appointments=[],[],[]
    while True:
        print("Welcome to the Clinic. Please select an option:\n")
        option=int(input("1.Add a doctor, patient or create an appointment.\n2.Search and dispay all patients, doctors or appointments.\n3.Search all appointments for a patient or a doctor.\n0.Quit.\n"))
        if option==0:break
        
        elif option==1:                                                                 
            option1=int(input("1.Add a doctor.\n2.Add Patient.\n3.Create appointment.\n"))
            if option1==1:                                                              #Adding a doctor
                d=Doctor()
                d.name=input("Please enter doctor's name.\n")
                d.age=input("Please enter doctor's age.\n")
                d.doctor_id_no=input("Please enter doctor's I.D number.\n")
                d.doctor_address=input("Please enter doctor's address.\n")
                doctors.append(d)
            elif option1==2:                                                            #Adding patient
                p=Patient()
                p.name=input("Please enter patient's name.\n")
                p.age=input("Please enter patient's age.\n")
                p.patient_id_no=input("Please enter patient's I.D number.\n")
                p.patient_address=input("Please enter patient's address.\n")
                patients.append(p)
            elif option1==3:                                                            #creating an appointment
                a=Appointment()
                a.doc_id=input("Please enter doctor's I.D number.\n")
                a.pat_id=input("Please enter patient's I.D number.\n")
                a.time=input("Please enter date and time for the appointment(yyyy/mm/dd hh:mm)\n")
                a.memo()
                appointments.append(a)
        elif option==2:
            option2=int(input("1.Display doctors.\n2.Display patients.\n3.Display appointments.\n"))
            if option2==1:
                for i in doctors:
                    print(i.display())
            elif option2==2:
                for i in patients:
                    print(i.display())
            elif option2==3:
                for i in appointments:
                    print(i.display())
        elif option==3:
            option3=int(input("1.Search for doctor's appointments.\n2.Search for patient's appointments"))
            if option3==1:
                doctor_id=input("Enter doctor's I.D number")
                for i in doctors:
                    if i.doctor_id_no==doctor_id:
                        print(i.name)
                        break
                for j in doctors:
                    for k in appointments:
                        if j.doctor_id_no==k.doc_id:
                            print(k.display())
                
            elif option3==2:
                patient_id=input("Enter patient's I.D number")
                for i in doctors:
                    if i.patient_id_no==patient_id:
                        print(i.name)
                        break
                    for j in patients:
                        for k in appointments:
                            if j.patient_id_no==k.pat_id:
                                print(k.display())  
コード例 #32
0
 def __init__(self, pidn="unknown", didn="unknown", ts="unknown", m="unknown"):
     Patient.__init__(self, pidn)
     Doctor.__init__(self, didn)
     self.timestamp = ts
     self.memo = m
コード例 #33
0
def main():
    """ three lists to store patients, doctors and appointments """
    patients = []    
    doctors = []
    appointments = []
    
    while True:
        print()
        """ options choose from """
        print("*****Clinic******")
        print("1. To add a patient")
        print("2. To add a doctor")
        print("3. To make an appointment")
        print("4. To display all patients")
        print("5. To display all doctors")
        print("6. To display all appointments")
        print("7. To display appointments for a specific individual (doctor or patient)")
        print("0. To quit")
        
        print()
        
        response = input()                                                              # getting an input from the user
        
        if response == "0": break
        elif response == "1":
            patient = Patient()
            patient.name = input("Enter the name of the patient? \n")
            patient.age = input("Enter age of the patient? \n")
            patient.identity = input("The patients ID number? \n")
            patient.address = input("The patients address? \n")
            patient.number_of_visits = input("The patients number of visits? \n")
            
            patients.append(patient)
            
        elif response == "2":                                           
            doctor = Doctor()                                                           # creating an object variable doctor
            """ getting object variables """
            doctor.name = input("Enter the name of the doctor? \n")
            doctor.age = input("Enter age of the doctor? \n")
            doctor.identity = input("The doctors ID number? \n")
            doctor.address = input("The doctors address? \n")  
            
            doctors.append(doctor)                                                      # appending the object doctor to a list doctors  
            
        elif response == "3":
            appointment = Appointment()
            
            appointment.patients_identity = input("Enter patient's ID number? \n")
            appointment.doctors_identity = input("Enter doctor's ID number? \n")
            appointment.timestamp = input("Enter date and time? \n")
            appointment.memo = input("Enter memorundum of the appointment? \n")
            
            appointments.append(appointment)                                            # adding the oject appointment to list appointments
            
        elif response == "4":
            control = 1
            for item in patients:
                print("Patient No.", control)
                item.display()
                control +=1
                print()
                
        elif response == "5":
            control = 1
            for item in doctors:
                print("Doctor No.", control)
                item.display()
                control +=1
                print()       
                
        elif response == "6":
            for item in appointments:
                print(item)
                print()
            
        
        elif response == "7":
            user_id = input("Enter ID number for which you want to check appointments scheduled? \n ")
            print("Scheduled appointment(s) for", user_id, "are as follows: ")
            """ looping through the list appointment and comparing id's"""
            for item in appointments:
                if user_id == item.patients_identity:
                    print(item.timestamp)
                
                elif user_id == item.doctors_identity:
                    print(item)
                    
        else:
            print("The value entered is not in the option manu.")
            print("Please enter value available in the menu")
コード例 #34
0
 elif user_input == 7:           #option to find if the doctor exists at the clinic
     dr_ID_number = input("Enter doctor/'s identity number: ")
     if dr_ID_number in Doctors_1 and dr_ID_number not in x:
         try:
             print(Doctors_1[dr_ID_number]+", "+ dr_ID_number +".")
         except:
             print("Could not find a doctor with that identity number.")
             
 elif user_input == 8:          # option to find appointments
     app = input("Enter the date of the appointment (yy-mm-dd hours:minutes:00): ")
     for s in Appointments_1:
         if s ==appointment:
             app.append(s)
     pickle.dump(app,AppointmentFile)     
 elif user_input == 9:
     a = Patient()    # create object
     a.name = patient_name
     a.age = age
     a.patient_address = address
     a.patient_identity_no = ID_number            
     a.display()
     for i in Patients_1:  # take dictionary keys to make them one list
         pp.append(i)
     pickle.dump(pp,PatientFile) 
 elif user_input == 10:
     b = Doctor()         # create object
     b.name = doctor_name
     b.age = age
     b.doctor_address = address
     b.doctor_identity_no = dr_ID_number           
     b.display()
コード例 #35
0
c=open("c.txt","wb") # c=Clinic file. Opening the list to save clinic information from question 4
patient=[]
doctor=[]
appointment=[]
while True:
    l=["1: Add patient","2: Add doctor","3: Add appointment","4: Display Patients","5: Display Doctors","6: Display appointments","7: Search","8: QUIT"]
    for i in l:
        print(i)
    option=eval(input("Enter the option: "))
    if option==0:
        pickle.dump(patient,c) # Dumping the patient's list in to the clinic file
        pickle.dump(doctor,c) # Dumping the Doctor's list into the clinic file
        pickle.dump(appointment,c) # writing the appointment's list into the clinic file
        break
    elif option==1:
        patnt=Patient()
        patnt.name=input("Enter the patient name:")
        patnt.age=eval(input("Enter the age of a pateint:"))
        patnt.idnumber=input("Enter the id number of the patient:")
        patnt.adress=input("Enter the address of a patient:")
        patnt.visit=input("Enter the number of visit:")
        patient.append(str(patnt))
    elif option==2:
        doc=Doctor()
        doc.name=input("Enter the doctor's name:")
        doc.address=input("Enter the address of the doctor:")
        doc.Id=input("Enter the Doctor's ID:")
        doctor.append(str(doc))
    elif option==3:
        appoint=Appointment()
        appoint.pid=input("Enter the patient's ID:")
コード例 #36
0
patient = []
doctor = []
appointment = []
while True:
    print("1: Add patient")
    print("2: Add doctor")
    print("3: Add appointment")
    print("4: Display Patients")
    print("5: Display Doctors")
    print("6: Display appointments")
    print("7: Search")
    print("8: QUIT")
    option = eval(input("Enter the option:"))
    if option == 1:
        patnt = Patient()
        patnt.name = input("Enter the patient name:")  # name iherited from person
        patnt.age = eval(input("Enter the age of a pateint:"))  # age inherited from person
        patnt.idnumber = input("Enter the id number of the patient:")  # the patient is given the id number
        patnt.adress = input("Enter the address of a patient:")
        patnt.visit = input("Enter the number of visit:")
        patient.append(str(patnt))  # The whole patient class is appended into the list
    elif option == 2:
        doc = Doctor()
        doc.name = input("Enter the doctor's name:")  # The doctor is given the name,address and Id number
        doc.address = input("Enter the address of the doctor:")
        doc.Id = input("Enter the Doctor's ID:")
        doctor.append(str(doc))  # The whole doctor class is aasigned into the list
    elif option == 3:
        appoint = Appointment()
        appoint.pid = input(
コード例 #37
0
    selection = eval(input("Choose an option i.e choose a number: "))
    
    if selection == 1:
        #Create Person Object:
        
        Patient_Name = input("Enter Patient Name : ")
        Patient_Age = eval(input("Enter Patient Age : "))
        
        Person_ = Person(Patient_Name,Patient_Age)
        
        #Create Patient:
        Patient_ID = input("Enter Patient ID Number : ")
        Patient_Address = input("Enter the Patient's Address : ")
        Patient_NrofVisits = eval(input("Enter the Patient's Number of Visits : "))
        
        Patient_ = Patient(Patient_ID,Patient_Address,Patient_NrofVisits)
        
        #pickle to file:
        getfilename_ = "patient.txt"
        getfilename_2 = "patient_unpickled.txt"
        getstring_ = Person_.__str__()+','+Patient_.__str__()      

        pickle_to_file(getfilename_,getstring_,getfilename_2)
        

    elif selection == 2:
        #Create Person Object:
        Doctor_Name = input("Enter Doctor Name : ")
        Doctor_Age = eval(input("Enter Doctor Age : "))
        
        Person_ = Person(Doctor_Name,Doctor_Age)
コード例 #38
0
        reader = csv.DictReader(csvFile, delimiter='\t')
        # parse the rows
        result = parse_input_data(reader)

    # Parse the input data
    for id in result:
        id = str(id)
        # no id given, we can't use
        if len(id) == 0:
            continue

        parsed = {}

        # get the patient number and create the patient object
        patient_id = int(id)
        patient = Patient(patient_id)

        # add the possible lymph nodes to the patient
        patient.set_lymph_nodes(lymph_nodes)
        patient.set_adjacency_matrix(adjacency_matrix)

        # parse the nodes from the row
        nodes = result[int(id)][node_column_name].split(',')

        # No infected nodes available
        if 'N/A' in nodes or len(nodes[0]) == 0:
            continue

        # parse the nodes
        parsed_nodes = parse_patient_nodes(nodes)
        # get the longest item (test purposes)
コード例 #39
0
def main():    
    input_file=open('Outputs.txt','wb') #opens file to save input
    while True:
        intro() #calls options
        
        option=int(input('>'))
    
        if option== 0: #ceases operation
            data_files=[doctors,patients,appointments,doctor_appointments,patient_appointments]
            dump(data_files, input_file)
            input_file.close()
            break
        
        elif option== 1: #inputs patient's info
            patient=Patient()
            patient.id_input()
            patients[patient.pat_id_number]=patient
            
        elif option== 2: #inputs for doctor's info
            doctor=Doctor()
            doctor.input()
            doctors[doctor.doc_id_number]=doctor
            
        elif option== 3: #inputs appointment info
            Appointment_number+=1
            appointment=Appointment()
            appointment.input()
            appointments[Appointment_number]=appointment
            
        elif option== 4: #searchs for patient
            pat_id_number=input('Enter Patient\'s Id number: ')
            appointment=Appointment()
            appointment.input()
            
            if len(patient.pat_id_number)>0:
                for i in patients:
                    if pat_id_number == i:
                        patient_appointments[pat_id_number]=appointment
                print('Could not find a patient with that Id number.')
        
            else:
                print('Could not find a patient with that student number.')
     
        elif option== 5: #searchs for doctor
            doc_id_number=input('Enter Doctor\'s Id number: ')
            appointment=Appointment()
            appointment.input()
            
            if len(doctor.doc_id_number)>0:
                for i in doctors:
                    if doc_id_number == i:
                        doctor_appointments[doc_id_number]=appointment
                print('Could not find a doctor with that Id number.')
        
            else:
                print('Could not find a doctor with that id number.')
                
        elif option== 6: #searchs for appointment
            Appointment_number=int(input('Enter Appointment number: '))
            appointment=Appointment()
            appointment.input()
            
            if len(appintment_number)>0:
                for i in appointments:
                    if Appointment_number == i:
                        appointments[Appointment_number]=appointment
                print('Could not find an appointment with that appointment number.')
        
            else:
                print('Could not find an appointment with that appointment number.')                       
        
        elif option== 7: #finds doctor
            doc_id_number=input('Enter Doctor\'s Id number: ')
            
            if doc_id_number in doctors:
                print(doctors[doc_id_number])
                
            else:
                print('Could not find a doctor with that id number.')
            
        elif option== 8: #finds patient
            patient_id_number=input('Enter Patient\'s Id number: ')
            
            if len(patient_id_number)>0:
                for ptt in patients:
                    if patient_id_number==ptt:
                        print(patients[patient_id_number])
                print('Could not find a patient with that id number.')
            else:
                print('Could not find a patient with that id number.')
        
        elif option== 9: #displays all appointments
            display_dictionary_values(appointments)
        
        elif option== 10: #displays all doctors
            display_dictionary_values(doctors)
        
        elif option== 11: #displays all patients
            display_dictionary_values(patients)
        
        else: #printed when option is not found
            print('That selection was not recognised.')