1 | ## $Id: interfaces.py 17822 2024-06-27 07:47:23Z henrik $ |
---|
2 | ## |
---|
3 | ## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann |
---|
4 | ## This program is free software; you can redistribute it and/or modify |
---|
5 | ## it under the terms of the GNU General Public License as published by |
---|
6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
7 | ## (at your option) any later version. |
---|
8 | ## |
---|
9 | ## This program is distributed in the hope that it will be useful, |
---|
10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | ## GNU General Public License for more details. |
---|
13 | ## |
---|
14 | ## You should have received a copy of the GNU General Public License |
---|
15 | ## along with this program; if not, write to the Free Software |
---|
16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
17 | ## |
---|
18 | |
---|
19 | from zope import schema |
---|
20 | from waeup.kofa.interfaces import ( |
---|
21 | validate_email, IKofaObject, |
---|
22 | academic_sessions_vocab) |
---|
23 | from waeup.kofa.students.vocabularies import StudyLevelSource |
---|
24 | from kofacustom.nigeria.interfaces import GradingSystemSource |
---|
25 | from waeup.kofa.schema import FormattedDate |
---|
26 | from kofacustom.nigeria.students.interfaces import ( |
---|
27 | INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance, |
---|
28 | INigeriaStudentPersonal, INigeriaStudentPersonalEdit, |
---|
29 | INigeriaStudentStudyLevel, |
---|
30 | INigeriaStudentStudyCourse, INigeriaCourseTicket, |
---|
31 | INigeriaStudentUpdateByRegNo, INigeriaStudentUpdateByMatricNo, |
---|
32 | ) |
---|
33 | from waeup.uniben.payments.interfaces import ICustomOnlinePayment |
---|
34 | from waeup.uniben.interfaces import MessageFactory as _ |
---|
35 | |
---|
36 | |
---|
37 | class ICustomStudentBase(INigeriaStudentBase): |
---|
38 | """Representation of student base data. |
---|
39 | """ |
---|
40 | |
---|
41 | library = schema.Bool( |
---|
42 | title = _(u'Library Id Card'), |
---|
43 | default = False, |
---|
44 | required = False, |
---|
45 | ) |
---|
46 | |
---|
47 | email2 = schema.ASCIILine( |
---|
48 | title = _(u'Institution Email'), |
---|
49 | required = False, |
---|
50 | constraint=validate_email, |
---|
51 | ) |
---|
52 | |
---|
53 | ICustomStudentBase['email2'].order = ICustomStudentBase[ |
---|
54 | 'phone'].order |
---|
55 | ICustomStudentBase['phone'].order = ICustomStudentBase[ |
---|
56 | 'email'].order |
---|
57 | |
---|
58 | class IMedicalHistory(IKofaObject): |
---|
59 | """Students Medical History Questionnaire. |
---|
60 | """ |
---|
61 | |
---|
62 | medical_updated = schema.Datetime( |
---|
63 | title = _(u'Last updated'), |
---|
64 | required = False, |
---|
65 | readonly = False, |
---|
66 | ) |
---|
67 | |
---|
68 | # History of Symptoms |
---|
69 | |
---|
70 | fever = schema.Bool( |
---|
71 | title = _(u'Fever'), |
---|
72 | default = False, |
---|
73 | required = True, |
---|
74 | ) |
---|
75 | |
---|
76 | headaches = schema.Bool( |
---|
77 | title = _(u'Headaches'), |
---|
78 | default = False, |
---|
79 | required = True, |
---|
80 | ) |
---|
81 | |
---|
82 | catarrh = schema.Bool( |
---|
83 | title = _(u'Catarrh'), |
---|
84 | default = False, |
---|
85 | required = True, |
---|
86 | ) |
---|
87 | |
---|
88 | cough = schema.Bool( |
---|
89 | title = _(u'Cough'), |
---|
90 | default = False, |
---|
91 | required = True, |
---|
92 | ) |
---|
93 | |
---|
94 | sore_throat = schema.Bool( |
---|
95 | title = _(u'Sore throat'), |
---|
96 | default = False, |
---|
97 | required = True, |
---|
98 | ) |
---|
99 | |
---|
100 | breathing = schema.Bool( |
---|
101 | title = _(u'Difficulty with breathing'), |
---|
102 | default = False, |
---|
103 | required = True, |
---|
104 | ) |
---|
105 | |
---|
106 | sneezing = schema.Bool( |
---|
107 | title = _(u'Sneezing'), |
---|
108 | default = False, |
---|
109 | required = True, |
---|
110 | ) |
---|
111 | |
---|
112 | weakness = schema.Bool( |
---|
113 | title = _(u'Weakness/tiredness'), |
---|
114 | default = False, |
---|
115 | required = True, |
---|
116 | ) |
---|
117 | |
---|
118 | body_pains = schema.Bool( |
---|
119 | title = _(u'Body pains'), |
---|
120 | default = False, |
---|
121 | required = True, |
---|
122 | ) |
---|
123 | |
---|
124 | smell = schema.Bool( |
---|
125 | title = _(u'Loss of smell (inability to smell)'), |
---|
126 | default = False, |
---|
127 | required = True, |
---|
128 | ) |
---|
129 | |
---|
130 | taste = schema.Bool( |
---|
131 | title = _(u'Loss of taste'), |
---|
132 | default = False, |
---|
133 | required = True, |
---|
134 | ) |
---|
135 | |
---|
136 | # Medical History |
---|
137 | |
---|
138 | asthma = schema.Bool( |
---|
139 | title = _(u'Asthma'), |
---|
140 | default = False, |
---|
141 | required = True, |
---|
142 | ) |
---|
143 | |
---|
144 | hypertension = schema.Bool( |
---|
145 | title = _(u'Hypertension'), |
---|
146 | default = False, |
---|
147 | required = True, |
---|
148 | ) |
---|
149 | |
---|
150 | diabetes = schema.Bool( |
---|
151 | title = _(u'Diabetes'), |
---|
152 | default = False, |
---|
153 | required = True, |
---|
154 | ) |
---|
155 | |
---|
156 | obesity = schema.Bool( |
---|
157 | title = _(u'Obesity'), |
---|
158 | default = False, |
---|
159 | required = True, |
---|
160 | ) |
---|
161 | |
---|
162 | others = schema.TextLine( |
---|
163 | title = _(u'Others'), |
---|
164 | required = False, |
---|
165 | ) |
---|
166 | |
---|
167 | medicines = schema.TextLine( |
---|
168 | title = _(u'Are you on a regular medication? If yes, list the medicines'), |
---|
169 | required = False, |
---|
170 | ) |
---|
171 | |
---|
172 | # Travel History |
---|
173 | |
---|
174 | lagos_abuja = schema.Bool( |
---|
175 | title = _(u'Have you travelled to Lagos or Abuja in the last two weeks?'), |
---|
176 | default = False, |
---|
177 | required = True, |
---|
178 | ) |
---|
179 | |
---|
180 | outside = schema.Bool( |
---|
181 | title = _(u'Have you travelled outside the country in the last 4 weeks?'), |
---|
182 | default = False, |
---|
183 | required = True, |
---|
184 | ) |
---|
185 | |
---|
186 | # History of contact/infection |
---|
187 | |
---|
188 | company_suspected = schema.Bool( |
---|
189 | title = _(u'Were you in the company of a suspected case of COVID 19 in the last two weeks?'), |
---|
190 | default = False, |
---|
191 | required = True, |
---|
192 | ) |
---|
193 | |
---|
194 | company_confirmed = schema.Bool( |
---|
195 | title = _(u'Were you in the company of a confirmed case of COVID 19 in the last two weeks?'), |
---|
196 | default = False, |
---|
197 | required = True, |
---|
198 | ) |
---|
199 | |
---|
200 | positive = schema.Bool( |
---|
201 | title = _(u'Have you had a positive COVID 19 test done?'), |
---|
202 | default = False, |
---|
203 | required = True, |
---|
204 | ) |
---|
205 | |
---|
206 | negative = schema.Bool( |
---|
207 | title = _(u'Have you had a negative COVID 19 test done?'), |
---|
208 | default = False, |
---|
209 | required = True, |
---|
210 | ) |
---|
211 | |
---|
212 | vaccination = schema.Bool( |
---|
213 | title = _(u'Have you had COVID 19 vaccination?'), |
---|
214 | default = False, |
---|
215 | required = True, |
---|
216 | ) |
---|
217 | |
---|
218 | class INYSC(IKofaObject): |
---|
219 | """Student NYSC data. |
---|
220 | """ |
---|
221 | |
---|
222 | nysc = schema.Bool( |
---|
223 | title = u'NYSC', |
---|
224 | default = False, |
---|
225 | required = True, |
---|
226 | ) |
---|
227 | |
---|
228 | nysc_updated = schema.Datetime( |
---|
229 | title = _(u'NYSC request data last updated by student'), |
---|
230 | ) |
---|
231 | |
---|
232 | nysc_date_of_graduation = FormattedDate( |
---|
233 | title = _(u'Date of Graduation'), |
---|
234 | required = False, |
---|
235 | show_year = True, |
---|
236 | ) |
---|
237 | |
---|
238 | nysc_senate_info = schema.TextLine( |
---|
239 | title = _(u'Senate Info'), |
---|
240 | required = False, |
---|
241 | ) |
---|
242 | |
---|
243 | class ITiship(IKofaObject): |
---|
244 | """Student tiship data. |
---|
245 | """ |
---|
246 | |
---|
247 | genotype = schema.TextLine( |
---|
248 | title = _(u'Genotype'), |
---|
249 | required = False, |
---|
250 | ) |
---|
251 | |
---|
252 | bloodgroup = schema.TextLine( |
---|
253 | title = _(u'Blood Group'), |
---|
254 | required = False, |
---|
255 | ) |
---|
256 | |
---|
257 | class ICustomStudentPersonal(INigeriaStudentPersonal): |
---|
258 | """Student personal data. |
---|
259 | """ |
---|
260 | |
---|
261 | parent_email = schema.ASCIILine( |
---|
262 | title = _(u'Parent Email'), |
---|
263 | required = False, |
---|
264 | constraint=validate_email, |
---|
265 | ) |
---|
266 | |
---|
267 | class ICustomStudentPersonalEdit(INigeriaStudentPersonalEdit): |
---|
268 | """Interface for editing personal data by students. |
---|
269 | """ |
---|
270 | |
---|
271 | parent_email = schema.ASCIILine( |
---|
272 | title = _(u'Parent Email'), |
---|
273 | required = False, |
---|
274 | constraint=validate_email, |
---|
275 | ) |
---|
276 | |
---|
277 | class ICustomUGStudentClearance(INigeriaUGStudentClearance): |
---|
278 | """Representation of ug student clearance data. |
---|
279 | """ |
---|
280 | |
---|
281 | class ICustomPGStudentClearance(INigeriaPGStudentClearance): |
---|
282 | """Representation of pg student clearance data. |
---|
283 | """ |
---|
284 | |
---|
285 | class ICustomStudent(ICustomStudentBase, ICustomUGStudentClearance, |
---|
286 | ICustomPGStudentClearance, ICustomStudentPersonal, IMedicalHistory, |
---|
287 | ITiship, INYSC): |
---|
288 | """Representation of a student. |
---|
289 | """ |
---|
290 | |
---|
291 | class ICustomStudentStudyCourse(INigeriaStudentStudyCourse): |
---|
292 | """A container for student study levels. |
---|
293 | """ |
---|
294 | |
---|
295 | class ICustomStudentStudyLevel(INigeriaStudentStudyLevel): |
---|
296 | """A container for course tickets. |
---|
297 | """ |
---|
298 | |
---|
299 | class ICustomStudentOnlinePayment(ICustomOnlinePayment): |
---|
300 | """A student payment via payment gateways. |
---|
301 | |
---|
302 | This Interface does not inherit from IStudentOnlinePayment. |
---|
303 | Thus all fields from IStudentOnlinePayment have to be repeated here. |
---|
304 | """ |
---|
305 | |
---|
306 | p_current = schema.Bool( |
---|
307 | title = _(u'Current Session Payment'), |
---|
308 | default = True, |
---|
309 | required = False, |
---|
310 | ) |
---|
311 | |
---|
312 | p_level = schema.Choice( |
---|
313 | title = _(u'Payment Level'), |
---|
314 | source = StudyLevelSource(), |
---|
315 | required = False, |
---|
316 | ) |
---|
317 | |
---|
318 | staff_rebate = schema.Bool( |
---|
319 | title = _(u'Staff Rebate Payment'), |
---|
320 | default = False, |
---|
321 | required = False, |
---|
322 | ) |
---|
323 | |
---|
324 | rebate_amount = schema.Float( |
---|
325 | title = _(u'Rebate'), |
---|
326 | default = 0.0, |
---|
327 | required = False, |
---|
328 | readonly = False, |
---|
329 | ) |
---|
330 | |
---|
331 | ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[ |
---|
332 | 'p_session'].order |
---|
333 | |
---|
334 | class ICustomCourseTicket(INigeriaCourseTicket): |
---|
335 | """A course ticket. |
---|
336 | """ |
---|
337 | |
---|
338 | grading_sys = schema.Choice( |
---|
339 | title = _(u'Grading System'), |
---|
340 | source = GradingSystemSource(), |
---|
341 | required = True, |
---|
342 | default = 'A', |
---|
343 | ) |
---|
344 | |
---|
345 | class ICustomCourseTicketImport(ICustomCourseTicket): |
---|
346 | """An interface for importing course results and nothing more. |
---|
347 | """ |
---|
348 | |
---|
349 | score = schema.Int( |
---|
350 | title = _(u'Score'), |
---|
351 | required = False, |
---|
352 | readonly = False, |
---|
353 | ) |
---|
354 | |
---|
355 | level_session = schema.Choice( |
---|
356 | title = _(u'Level Session'), |
---|
357 | source = academic_sessions_vocab, |
---|
358 | required = False, |
---|
359 | readonly = False, |
---|
360 | ) |
---|
361 | |
---|
362 | grading_sys = schema.Choice( |
---|
363 | title = _(u'Grading System'), |
---|
364 | source = GradingSystemSource(), |
---|
365 | required = False, |
---|
366 | default = 'A', |
---|
367 | ) |
---|
368 | |
---|
369 | class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo): |
---|
370 | """Representation of a student. Skip regular reg_number validation. |
---|
371 | """ |
---|
372 | |
---|
373 | class ICustomStudentUpdateByMatricNo(INigeriaStudentUpdateByMatricNo): |
---|
374 | """Representation of a student. Skip regular matric_number validation. |
---|
375 | """ |
---|