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