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