[7505] | 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 | ## |
---|
[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 | |
---|
| 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 | |
---|
[17395] | 243 | class ITiship(IKofaObject): |
---|
| 244 | """Student tiship data. |
---|
| 245 | """ |
---|
[17255] | 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 | |
---|
[8865] | 257 | class ICustomStudentPersonal(INigeriaStudentPersonal): |
---|
[7618] | 258 | """Student personal data. |
---|
[13085] | 259 | """ |
---|
[7618] | 260 | |
---|
[13085] | 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. |
---|
[7618] | 269 | """ |
---|
| 270 | |
---|
[12856] | 271 | parent_email = schema.ASCIILine( |
---|
| 272 | title = _(u'Parent Email'), |
---|
| 273 | required = False, |
---|
| 274 | constraint=validate_email, |
---|
| 275 | ) |
---|
| 276 | |
---|
[8865] | 277 | class ICustomUGStudentClearance(INigeriaUGStudentClearance): |
---|
[7995] | 278 | """Representation of ug student clearance data. |
---|
[7505] | 279 | """ |
---|
| 280 | |
---|
[8865] | 281 | class ICustomPGStudentClearance(INigeriaPGStudentClearance): |
---|
[7995] | 282 | """Representation of pg student clearance data. |
---|
[7505] | 283 | """ |
---|
| 284 | |
---|
[12856] | 285 | class ICustomStudent(ICustomStudentBase, ICustomUGStudentClearance, |
---|
[17395] | 286 | ICustomPGStudentClearance, ICustomStudentPersonal, IMedicalHistory, |
---|
[17822] | 287 | ITiship, INYSC): |
---|
[7995] | 288 | """Representation of a student. |
---|
[7505] | 289 | """ |
---|
[8247] | 290 | |
---|
[8865] | 291 | class ICustomStudentStudyCourse(INigeriaStudentStudyCourse): |
---|
[8326] | 292 | """A container for student study levels. |
---|
| 293 | """ |
---|
| 294 | |
---|
[8865] | 295 | class ICustomStudentStudyLevel(INigeriaStudentStudyLevel): |
---|
[8326] | 296 | """A container for course tickets. |
---|
| 297 | """ |
---|
| 298 | |
---|
[8866] | 299 | class ICustomStudentOnlinePayment(ICustomOnlinePayment): |
---|
[8247] | 300 | """A student payment via payment gateways. |
---|
| 301 | |
---|
[8866] | 302 | This Interface does not inherit from IStudentOnlinePayment. |
---|
| 303 | Thus all fields from IStudentOnlinePayment have to be repeated here. |
---|
[8270] | 304 | """ |
---|
| 305 | |
---|
[9152] | 306 | p_current = schema.Bool( |
---|
| 307 | title = _(u'Current Session Payment'), |
---|
| 308 | default = True, |
---|
| 309 | required = False, |
---|
| 310 | ) |
---|
| 311 | |
---|
[13741] | 312 | p_level = schema.Choice( |
---|
[8866] | 313 | title = _(u'Payment Level'), |
---|
[13741] | 314 | source = StudyLevelSource(), |
---|
[8866] | 315 | required = False, |
---|
| 316 | ) |
---|
| 317 | |
---|
[14853] | 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 | |
---|
[8866] | 331 | ICustomStudentOnlinePayment['p_level'].order = ICustomStudentOnlinePayment[ |
---|
| 332 | 'p_session'].order |
---|
| 333 | |
---|
[8865] | 334 | class ICustomCourseTicket(INigeriaCourseTicket): |
---|
[8326] | 335 | """A course ticket. |
---|
[8582] | 336 | """ |
---|
| 337 | |
---|
[16509] | 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 | |
---|
[8865] | 369 | class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo): |
---|
[8582] | 370 | """Representation of a student. Skip regular reg_number validation. |
---|
| 371 | """ |
---|
| 372 | |
---|
[8865] | 373 | class ICustomStudentUpdateByMatricNo(INigeriaStudentUpdateByMatricNo): |
---|
[8582] | 374 | """Representation of a student. Skip regular matric_number validation. |
---|
| 375 | """ |
---|