-
Notifications
You must be signed in to change notification settings - Fork 0
/
filler.py
210 lines (186 loc) · 6.5 KB
/
filler.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
def generateSampleTestsAllType():
from Test import Test
tests = [
Test('Thyroid', mustinclucepresc=True),
Test('HIV', mustinclucepresc=True),
Test('Herpes', mustinclucepresc=True),
Test('Vitamin D', mustinclucepresc=False),
Test('Sodium', mustinclucepresc=False),
Test('Calcium', mustinclucepresc=False),
Test('Corona', mustinclucepresc=False),
Test('FBG', mustinclucepresc=False)
]
return tests
def generateSampleBloodExperts():
from BloodExpert import BloodExpert
from Location import Location
from DailySchedule import DailySchedule
from Date import Date
from ServiceTime import ServiceTime, DateType
blood_experts = [
BloodExpert(1, Location(10, 10), [
DailySchedule(Date(2020, 9, 5, 0), [
ServiceTime(Date(2020, 7, 2, 16)), # OLD DATE
ServiceTime(Date(2020, 9, 5, 8)),
ServiceTime(Date(2020, 9, 5, 10)),
ServiceTime(Date(2020, 9, 5, 12), True, DateType.special),
ServiceTime(Date(2020, 9, 5, 14)),
]),
DailySchedule(Date(2020, 9, 6, 0), [
ServiceTime(Date(2020, 9, 6, 8)),
ServiceTime(Date(2020, 9, 6, 10)),
ServiceTime(Date(2020, 9, 6, 16)),
ServiceTime(Date(2020, 9, 6, 14)),
])
]),
BloodExpert(2, Location(30, 25), [
DailySchedule(Date(2020, 9, 7, 0), [
ServiceTime(Date(2020, 9, 7, 8)),
ServiceTime(Date(2020, 9, 7, 10)),
ServiceTime(Date(2020, 9, 7, 12), True, DateType.special),
ServiceTime(Date(2020, 9, 7, 14)),
]),
DailySchedule(Date(2020, 9, 8, 0), [
ServiceTime(Date(2020, 9, 8, 8)),
ServiceTime(Date(2020, 9, 8, 10)),
ServiceTime(Date(2020, 9, 8, 16), False),
ServiceTime(Date(2020, 9, 8, 14)),
])
]),
]
return blood_experts
def generateSampleLab():
from Lab import Lab
lab = Lab('sampleLab1')
lab.setBloodExperts(generateSampleBloodExperts())
lab.setTests(generateSampleTestsAllType())
return lab
def kgenerateTestList():
from TestList import TestList
testlist = TestList()
testlist.setTests(generateSampleTestsAllType())
return testlist
def kgeneratePrescriptionDetail():
from PrescriptionDetail import PrescriptionDetail
pd = PrescriptionDetail()
pd.setIsAccepted(True)
pd.setIsCovered(True)
pd.setTests(kgenerateTestList())
return pd
def generateSampleOrder():
from Order import Order
order = Order()
order.setLab(generateSampleLab())
order.setTestList(kgenerateTestList())
order.setPrescDetail(kgeneratePrescriptionDetail())
return order
def generateSamplePrescDetail(presc_id, covered):
from PrescriptionDetail import PrescriptionDetail
_tests = generateSampleTestsAllType()
presc_detail = PrescriptionDetail(prescID=presc_id, isCovered=covered, isAccepted=True, tests= _tests)
return presc_detail
def generateSampleCheckedPresc(presc_id, covered):
from Prescription import Prescription
presc = Prescription()
presc_detail = generateSamplePrescDetail(presc_id, covered)
presc.setPrescriptionDetail(presc_detail)
return presc
def generateSampleUserWithPrescs():
from User import User
prescriptions = []
n_prescs = 10
for i in range(n_prescs):
presc = generateSampleCheckedPresc(i, True)
prescriptions.append(presc)
user = User(username='sampleUserName', is_logged_in=True)
user.setPrescriptions(prescriptions)
return user
def genereateSampleUserwithFaultOrders():
from User import User
from Order import Order
user = User("sampleUserName", is_logged_in=True)
wfault = []
for i in range(4):
order = Order()
order.setFaultCode(f"12{i}")
wfault.append(order)
orsers = [
Order(),
wfault[1],
Order(),
wfault[3],
wfault[2],
Order(),
Order(),
]
user.setOrders(orsers)
return user
def hGenerateSampleUserWithoutPrescs():
from User import User
user = User(username='sampleUserName', is_logged_in=True)
return user
def hGenerateSampleLabsWithTests():
from Lab import Lab
from Test import Test
labs = []
lab1 = Lab('sampleLab1') # Our lab !
lab1.setBloodExperts(generateSampleBloodExperts())
tests = [
Test('Thyroid', mustinclucepresc=True),
Test('HIV', mustinclucepresc=True),
Test('Herpes', mustinclucepresc=True),
Test('Vitamin D', mustinclucepresc=False),
Test('Sodium', mustinclucepresc=False),
Test('Calcium', mustinclucepresc=False)
]
lab1.setTests(tests)
labs.append(lab1)
lab2 = Lab('sampleLab2')
lab2.setBloodExperts(generateSampleBloodExperts())
tests = [
Test('HIV', mustinclucepresc=True),
Test('Herpes', mustinclucepresc=True),
Test('Vitamin D', mustinclucepresc=False),
Test('Sodium', mustinclucepresc=False),
Test('Calcium', mustinclucepresc=False),
Test('Corona', mustinclucepresc=False)
]
lab2.setTests(tests)
labs.append(lab2)
lab3 = Lab('sampleLab3')
lab3.setBloodExperts(generateSampleBloodExperts())
tests = [
Test('Herpes', mustinclucepresc=True),
Test('Vitamin D', mustinclucepresc=False),
Test('Sodium', mustinclucepresc=False),
Test('Calcium', mustinclucepresc=False),
Test('Corona', mustinclucepresc=False),
Test('FBG', mustinclucepresc=False)
]
lab3.setTests(tests)
labs.append(lab3)
lab4 = Lab('sampleLab4')
lab4.setBloodExperts(generateSampleBloodExperts())
tests = [
Test('Thyroid', mustinclucepresc=True),
Test('HIV', mustinclucepresc=True),
Test('Herpes', mustinclucepresc=True),
Test('Vitamin D', mustinclucepresc=False),
Test('Sodium', mustinclucepresc=False),
Test('Calcium', mustinclucepresc=False),
Test('Corona', mustinclucepresc=False),
Test('FBG', mustinclucepresc=False)
]
lab4.setTests(tests)
labs.append(lab4)
return labs
def hGenerateAllOTCTests():
from Test import Test
tests = [
Test('Vitamin D', mustinclucepresc=False),
Test('Sodium', mustinclucepresc=False),
Test('Calcium', mustinclucepresc=False),
Test('Corona', mustinclucepresc=False),
Test('FBG', mustinclucepresc=False)
]
return tests