[7505] | 1 | ## $Id: interfaces.py 17835 2024-07-08 16:05:10Z 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 |
---|
[16509] | 24 | from kofacustom.nigeria.interfaces import GradingSystemSource |
---|
[17822] | 25 | from waeup.kofa.schema import FormattedDate |
---|
[8865] | 26 | from kofacustom.nigeria.students.interfaces import ( |
---|
| 27 | INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance, |
---|
[13085] | 28 | INigeriaStudentPersonal, INigeriaStudentPersonalEdit, |
---|
| 29 | INigeriaStudentStudyLevel, |
---|
[8865] | 30 | INigeriaStudentStudyCourse, INigeriaCourseTicket, |
---|
| 31 | INigeriaStudentUpdateByRegNo, INigeriaStudentUpdateByMatricNo, |
---|
[7505] | 32 | ) |
---|
[8866] | 33 | from waeup.uniben.payments.interfaces import ICustomOnlinePayment |
---|
| 34 | from waeup.uniben.interfaces import MessageFactory as _ |
---|
[7505] | 35 | |
---|
[16509] | 36 | |
---|
[8865] | 37 | class ICustomStudentBase(INigeriaStudentBase): |
---|
[7618] | 38 | """Representation of student base data. |
---|
[7505] | 39 | """ |
---|
[7618] | 40 | |
---|
[15371] | 41 | library = schema.Bool( |
---|
| 42 | title = _(u'Library Id Card'), |
---|
| 43 | default = False, |
---|
| 44 | required = False, |
---|
| 45 | ) |
---|
| 46 | |
---|
[16088] | 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 | |
---|
[16382] | 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, |
---|
[16385] | 73 | required = True, |
---|
[16382] | 74 | ) |
---|
| 75 | |
---|
| 76 | headaches = schema.Bool( |
---|
| 77 | title = _(u'Headaches'), |
---|
| 78 | default = False, |
---|
[16385] | 79 | required = True, |
---|
[16382] | 80 | ) |
---|
| 81 | |
---|
| 82 | catarrh = schema.Bool( |
---|
| 83 | title = _(u'Catarrh'), |
---|
| 84 | default = False, |
---|
[16385] | 85 | required = True, |
---|
[16382] | 86 | ) |
---|
| 87 | |
---|
| 88 | cough = schema.Bool( |
---|
| 89 | title = _(u'Cough'), |
---|
| 90 | default = False, |
---|
[16385] | 91 | required = True, |
---|
[16382] | 92 | ) |
---|
| 93 | |
---|
| 94 | sore_throat = schema.Bool( |
---|
| 95 | title = _(u'Sore throat'), |
---|
| 96 | default = False, |
---|
[16385] | 97 | required = True, |
---|
[16382] | 98 | ) |
---|
| 99 | |
---|
| 100 | breathing = schema.Bool( |
---|
| 101 | title = _(u'Difficulty with breathing'), |
---|
| 102 | default = False, |
---|
[16385] | 103 | required = True, |
---|
[16382] | 104 | ) |
---|
| 105 | |
---|
| 106 | sneezing = schema.Bool( |
---|
| 107 | title = _(u'Sneezing'), |
---|
| 108 | default = False, |
---|
[16385] | 109 | required = True, |
---|
[16382] | 110 | ) |
---|
| 111 | |
---|
| 112 | weakness = schema.Bool( |
---|
| 113 | title = _(u'Weakness/tiredness'), |
---|
| 114 | default = False, |
---|
[16385] | 115 | required = True, |
---|
[16382] | 116 | ) |
---|
| 117 | |
---|
| 118 | body_pains = schema.Bool( |
---|
| 119 | title = _(u'Body pains'), |
---|
| 120 | default = False, |
---|
[16385] | 121 | required = True, |
---|
[16382] | 122 | ) |
---|
| 123 | |
---|
| 124 | smell = schema.Bool( |
---|
| 125 | title = _(u'Loss of smell (inability to smell)'), |
---|
| 126 | default = False, |
---|
[16385] | 127 | required = True, |
---|
[16382] | 128 | ) |
---|
| 129 | |
---|
| 130 | taste = schema.Bool( |
---|
| 131 | title = _(u'Loss of taste'), |
---|
| 132 | default = False, |
---|
[16385] | 133 | required = True, |
---|
[16382] | 134 | ) |
---|
| 135 | |
---|
| 136 | # Medical History |
---|
| 137 | |
---|
| 138 | asthma = schema.Bool( |
---|
| 139 | title = _(u'Asthma'), |
---|
| 140 | default = False, |
---|
[16385] | 141 | required = True, |
---|
[16382] | 142 | ) |
---|
| 143 | |
---|
| 144 | hypertension = schema.Bool( |
---|
| 145 | title = _(u'Hypertension'), |
---|
| 146 | default = False, |
---|
[16385] | 147 | required = True, |
---|
[16382] | 148 | ) |
---|
| 149 | |
---|
| 150 | diabetes = schema.Bool( |
---|
| 151 | title = _(u'Diabetes'), |
---|
| 152 | default = False, |
---|
[16385] | 153 | required = True, |
---|
[16382] | 154 | ) |
---|
| 155 | |
---|
| 156 | obesity = schema.Bool( |
---|
| 157 | title = _(u'Obesity'), |
---|
| 158 | default = False, |
---|
[16385] | 159 | required = True, |
---|
[16382] | 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, |
---|
[16385] | 177 | required = True, |
---|
[16382] | 178 | ) |
---|
| 179 | |
---|
| 180 | outside = schema.Bool( |
---|
| 181 | title = _(u'Have you travelled outside the country in the last 4 weeks?'), |
---|
| 182 | default = False, |
---|
[16385] | 183 | required = True, |
---|
[16382] | 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, |
---|
[16385] | 191 | required = True, |
---|
[16382] | 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, |
---|
[16385] | 197 | required = True, |
---|
[16382] | 198 | ) |
---|
| 199 | |
---|
| 200 | positive = schema.Bool( |
---|
| 201 | title = _(u'Have you had a positive COVID 19 test done?'), |
---|
| 202 | default = False, |
---|
[16385] | 203 | required = True, |
---|
[16382] | 204 | ) |
---|
| 205 | |
---|
| 206 | negative = schema.Bool( |
---|
| 207 | title = _(u'Have you had a negative COVID 19 test done?'), |
---|
| 208 | default = False, |
---|
[16385] | 209 | required = True, |
---|
[16382] | 210 | ) |
---|
| 211 | |
---|
| 212 | vaccination = schema.Bool( |
---|
| 213 | title = _(u'Have you had COVID 19 vaccination?'), |
---|
| 214 | default = False, |
---|
[16385] | 215 | required = True, |
---|
[16382] | 216 | ) |
---|
| 217 | |
---|
[17822] | 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 | |
---|
[17835] | 228 | nysc_processed = schema.Bool( |
---|
| 229 | title = u'NYSC processed', |
---|
| 230 | default = False, |
---|
| 231 | required = True, |
---|
| 232 | ) |
---|
| 233 | |
---|
[17822] | 234 | nysc_updated = schema.Datetime( |
---|
| 235 | title = _(u'NYSC request data last updated by student'), |
---|
| 236 | ) |
---|
| 237 | |
---|
| 238 | nysc_date_of_graduation = FormattedDate( |
---|
| 239 | title = _(u'Date of Graduation'), |
---|
| 240 | required = False, |
---|
| 241 | show_year = True, |
---|
| 242 | ) |
---|
| 243 | |
---|
| 244 | nysc_senate_info = schema.TextLine( |
---|
| 245 | title = _(u'Senate Info'), |
---|
| 246 | required = False, |
---|
[17835] | 247 | description = u'Sample: Meeting Date: 10TH MAY 2023. DEG CLASS: FIRST CLASS. S/NO: 01', |
---|
[17822] | 248 | ) |
---|
| 249 | |
---|
[17395] | 250 | class ITiship(IKofaObject): |
---|
| 251 | """Student tiship data. |
---|
| 252 | """ |
---|
[17255] | 253 | |
---|
| 254 | genotype = schema.TextLine( |
---|
| 255 | title = _(u'Genotype'), |
---|
| 256 | required = False, |
---|
| 257 | ) |
---|
| 258 | |
---|
| 259 | bloodgroup = schema.TextLine( |
---|
| 260 | title = _(u'Blood Group'), |
---|
| 261 | required = False, |
---|
| 262 | ) |
---|
| 263 | |
---|
[8865] | 264 | class ICustomStudentPersonal(INigeriaStudentPersonal): |
---|
[7618] | 265 | """Student personal data. |
---|
[13085] | 266 | """ |
---|
[7618] | 267 | |
---|
[13085] | 268 | parent_email = schema.ASCIILine( |
---|
| 269 | title = _(u'Parent Email'), |
---|
| 270 | required = False, |
---|
| 271 | constraint=validate_email, |
---|
| 272 | ) |
---|
| 273 | |
---|
| 274 | class ICustomStudentPersonalEdit(INigeriaStudentPersonalEdit): |
---|
| 275 | """Interface for editing personal data by students. |
---|
[7618] | 276 | """ |
---|
| 277 | |
---|
[12856] | 278 | parent_email = schema.ASCIILine( |
---|
| 279 | title = _(u'Parent Email'), |
---|
| 280 | required = False, |
---|
| 281 | constraint=validate_email, |
---|
| 282 | ) |
---|
| 283 | |
---|
[8865] | 284 | class ICustomUGStudentClearance(INigeriaUGStudentClearance): |
---|
[7995] | 285 | """Representation of ug student clearance data. |
---|
[7505] | 286 | """ |
---|
| 287 | |
---|
[8865] | 288 | class ICustomPGStudentClearance(INigeriaPGStudentClearance): |
---|
[7995] | 289 | """Representation of pg student clearance data. |
---|
[7505] | 290 | """ |
---|
| 291 | |
---|
[12856] | 292 | class ICustomStudent(ICustomStudentBase, ICustomUGStudentClearance, |
---|
[17395] | 293 | ICustomPGStudentClearance, ICustomStudentPersonal, IMedicalHistory, |
---|
[17822] | 294 | ITiship, INYSC): |
---|
[7995] | 295 | """Representation of a student. |
---|
[7505] | 296 | """ |
---|
[8247] | 297 | |
---|
[8865] | 298 | class ICustomStudentStudyCourse(INigeriaStudentStudyCourse): |
---|
[8326] | 299 | """A container for student study levels. |
---|
| 300 | """ |
---|
| 301 | |
---|
[8865] | 302 | class ICustomStudentStudyLevel(INigeriaStudentStudyLevel): |
---|
[8326] | 303 | """A container for course tickets. |
---|
| 304 | """ |
---|
| 305 | |
---|
[8866] | 306 | class ICustomStudentOnlinePayment(ICustomOnlinePayment): |
---|
[8247] | 307 | """A student payment via payment gateways. |
---|
| 308 | |
---|
[8866] | 309 | This Interface does not inherit from IStudentOnlinePayment. |
---|
| 310 | Thus all fields from IStudentOnlinePayment have to be repeated here. |
---|
[8270] | 311 | """ |
---|
| 312 | |
---|
[9152] | 313 | p_current = schema.Bool( |
---|
| 314 | title = _(u'Current Session Payment'), |
---|
| 315 | default = True, |
---|
| 316 | required = False, |
---|
| 317 | ) |
---|
| 318 | |
---|
[13741] | 319 | p_level = schema.Choice( |
---|
[8866] | 320 | title = _(u'Payment Level'), |
---|
[13741] | 321 | source = StudyLevelSource(), |
---|
[8866] | 322 | required = False, |
---|
| 323 | ) |
---|
| 324 | |
---|
[14853] | 325 | staff_rebate = schema.Bool( |
---|
| 326 | title = _(u'Staff Rebate Payment'), |
---|
| 327 | default = False, |
---|
| 328 | required = False, |
---|
| 329 | ) |
---|
| 330 | |
---|
| 331 | rebate_amount = schema.Float( |
---|
| 332 | title = _(u'Rebate'), |
---|
| 333 | default = 0.0, |
---|
| 334 | required = False, |
---|
| 335 | readonly = False, |
---|
| 336 | ) |
---|
| 337 | |
---|
[8866] | 338 | ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[ |
---|
| 339 | 'p_session'].order |
---|
| 340 | |
---|
[8865] | 341 | class ICustomCourseTicket(INigeriaCourseTicket): |
---|
[8326] | 342 | """A course ticket. |
---|
[8582] | 343 | """ |
---|
| 344 | |
---|
[16509] | 345 | grading_sys = schema.Choice( |
---|
| 346 | title = _(u'Grading System'), |
---|
| 347 | source = GradingSystemSource(), |
---|
| 348 | required = True, |
---|
| 349 | default = 'A', |
---|
| 350 | ) |
---|
| 351 | |
---|
| 352 | class ICustomCourseTicketImport(ICustomCourseTicket): |
---|
| 353 | """An interface for importing course results and nothing more. |
---|
| 354 | """ |
---|
| 355 | |
---|
| 356 | score = schema.Int( |
---|
| 357 | title = _(u'Score'), |
---|
| 358 | required = False, |
---|
| 359 | readonly = False, |
---|
| 360 | ) |
---|
| 361 | |
---|
| 362 | level_session = schema.Choice( |
---|
| 363 | title = _(u'Level Session'), |
---|
| 364 | source = academic_sessions_vocab, |
---|
| 365 | required = False, |
---|
| 366 | readonly = False, |
---|
| 367 | ) |
---|
| 368 | |
---|
| 369 | grading_sys = schema.Choice( |
---|
| 370 | title = _(u'Grading System'), |
---|
| 371 | source = GradingSystemSource(), |
---|
| 372 | required = False, |
---|
| 373 | default = 'A', |
---|
| 374 | ) |
---|
| 375 | |
---|
[8865] | 376 | class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo): |
---|
[8582] | 377 | """Representation of a student. Skip regular reg_number validation. |
---|
| 378 | """ |
---|
| 379 | |
---|
[8865] | 380 | class ICustomStudentUpdateByMatricNo(INigeriaStudentUpdateByMatricNo): |
---|
[8582] | 381 | """Representation of a student. Skip regular matric_number validation. |
---|
| 382 | """ |
---|