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