-
Notifications
You must be signed in to change notification settings - Fork 0
/
classes.py
160 lines (134 loc) · 4.82 KB
/
classes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#######################
# LOGICAL HIERARCHY #
#######################
from enum import Enum
class Service:
def __init__(self, id, description, abrev):
self.id = id
self.description = description
self.abrev = abrev
self.hospUnits = [] # IDs are saved
self.rooms = []
class HospUnit:
def __init__(self, id, description, abrev):
self.id = id
self.description = description
self.abrev = abrev
self.rooms = [] # IDs are saved
self.beds = [] # IDs are saved
self.service = None # The object is saved
#######################
# SPATIAL HIERARCHY #
#######################
class TypeBed(Enum):
Service = 0
Radiology = 1
Surgery = 2
ICU = 3
ER = 4
class Bed:
def __init__(self, id, description):
self.id = id
self.description = description
self.parent = None # IDs are saved
self.nextTo = [] # IDs are saved
self.opposite = [] # IDs are saved
self.hospUnit = None # IDs are saved
self.type = TypeBed.Service
class Room:
def __init__(self, id, description):
self.id = id
self.description = description
self.parent = None # IDs are saved
self.nextTo = [] # IDs are saved
self.opposite = [] # IDs are saved
self.hospUnit = None # All Rooms have this attribute # IDs are saved
self.service = None # Only Rooms from Services S0-S7 have this attribute
self.beds = [] # IDs are saved
class Corridor:
def __init__(self, id, description):
self.id = id
self.description = description
self.nextTo = {0:None, 1:None, 2:None, 3:None, 4:None, 5:None} # IDs are saved
self.rooms = [] # The object is saved
self.roomsBorder = {'leftTop':None, 'leftBottom':None, 'rightTop':None, 'rightBottom':None,
'topLeft':None, 'topRight':None, 'bottomLeft':None, 'bottomRight':None} # Se guardan los objetos
class Area:
def __init__(self, id, description, tipo):
self.id = id
self.description = description
self.type = tipo
self.corridorsHoriz = [] # The object is saved
self.corridorsVert = [] # The object is saved
self.unit = None
self.block = None
class Unit:
def __init__(self, id, description):
self.id = id
self.description = description
self.nextTo_prev = None # IDs are saved
self.nextTo_after = None # IDs are saved
class Block:
def __init__(self, id, description):
self.id = id
self.description = description
self.nextTo_prev = None # IDs are saved
self.nextTo_after = None # IDs are saved
class Floor:
def __init__(self, id, description):
self.id = id
self.description = description
self.hospUnits = [] # The objects are saved
self.nRooms = 0
self.areas = []
self.units = [] # The objects are saved
self.blocks = [] # The objects are saved
class Building:
def __init__(self, id, description):
self.id = id
self.description = description
self.floors = [] # The objects are saved
############
# PATIENTS #
############
class Patient:
def __init__(self, id, age, sex, death):
self.id = id
self.age = age
self.sex = sex
self.death = death
self.stepLocations = {} # IDs are saved
self.episodes = [] # The objects are saved
self.seird = [None, None, None, None, None] # To save in which step each state starts
##########
# EVENTS #
##########
class Episode:
def __init__(self, id, description, start, end):
self.id = id
self.description = description
self.start = start
self.end = end
self.events = [] # The objects are saved
class TypeEvent(Enum):
Hospitalization = 0 # (It includes UCI y ER)
Radiology = 1
Surgery = 2
Death = 3
TestMicro = 4
class Event:
def __init__(self, id, description, start, end, location, hu, type):
self.id = id
self.description = description
self.start = start
self.end = end
self.location = location
self.hospUnit = hu
self.type = type
# To save extra info
self.extra1 = None # For example, the Microorganism of a TestMicro (object)
self.extra2 = None # For example, if the Microorganism is MDR
class Microorganism:
def __init__(self, id, description):
self.id = id
self.description = description