[5247] | 1 | ## |
---|
| 2 | ## interfaces.py |
---|
| 3 | ## Login : <uli@pu.smp.net> |
---|
| 4 | ## Started on Sun Jun 27 11:06:23 2010 Uli Fouquet |
---|
| 5 | ## $Id$ |
---|
| 6 | ## |
---|
| 7 | ## Copyright (C) 2010 Uli Fouquet |
---|
| 8 | ## This program is free software; you can redistribute it and/or modify |
---|
| 9 | ## it under the terms of the GNU General Public License as published by |
---|
| 10 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 11 | ## (at your option) any later version. |
---|
| 12 | ## |
---|
| 13 | ## This program is distributed in the hope that it will be useful, |
---|
| 14 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | ## GNU General Public License for more details. |
---|
| 17 | ## |
---|
| 18 | ## You should have received a copy of the GNU General Public License |
---|
| 19 | ## along with this program; if not, write to the Free Software |
---|
| 20 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 21 | ## |
---|
| 22 | """Interfaces for JAMB data tables and related components. |
---|
| 23 | """ |
---|
| 24 | from waeup.sirp.interfaces import IWAeUPObject |
---|
| 25 | from zope.interface import Interface |
---|
[5251] | 26 | from zope import schema |
---|
[5247] | 27 | |
---|
[5271] | 28 | |
---|
[5247] | 29 | class IJAMBDataTable(IWAeUPObject): |
---|
| 30 | """A table containing JAMB data. |
---|
| 31 | """ |
---|
[5251] | 32 | import_datetime = schema.Datetime( |
---|
| 33 | title = u'Datetime of import of contained data.', |
---|
| 34 | required = False, |
---|
| 35 | ) |
---|
| 36 | |
---|
| 37 | importer_username = schema.TextLine( |
---|
| 38 | title = u'Name of user who initiated import.', |
---|
| 39 | required = False, |
---|
| 40 | ) |
---|
| 41 | |
---|
| 42 | def __iter__(): |
---|
| 43 | """An iterator over all data elements. |
---|
| 44 | """ |
---|
| 45 | |
---|
| 46 | def keys(): |
---|
| 47 | """Get iterator over all registration numbers of data. |
---|
| 48 | """ |
---|
| 49 | |
---|
| 50 | def items(): |
---|
| 51 | """Get iterator over tuples of registration numbers and datasets. |
---|
| 52 | """ |
---|
| 53 | |
---|
| 54 | def clear(): |
---|
| 55 | """Clear all data contained. |
---|
| 56 | |
---|
| 57 | This will also erase any import data. |
---|
| 58 | """ |
---|
| 59 | |
---|
[5252] | 60 | def importFromCSV(filepath, username=None): |
---|
[5251] | 61 | """Import data from filepath. |
---|
[5252] | 62 | |
---|
| 63 | `filepath` - the path to the CSV file to import data from. |
---|
| 64 | |
---|
| 65 | `username` - the (optional) username of the importing person. |
---|
[5251] | 66 | """ |
---|
[5271] | 67 | |
---|
| 68 | class IResultEntry(IWAeUPObject): |
---|
| 69 | subject = schema.TextLine( |
---|
| 70 | title = u'Subject', |
---|
| 71 | description = u'The subject', |
---|
| 72 | required=False, |
---|
| 73 | ) |
---|
| 74 | score = schema.TextLine( |
---|
| 75 | title = u'Score', |
---|
| 76 | description = u'The score', |
---|
| 77 | required=False, |
---|
| 78 | ) |
---|
| 79 | |
---|
[5268] | 80 | class IApplicant(IWAeUPObject): |
---|
| 81 | """An applicant. |
---|
| 82 | |
---|
| 83 | |
---|
| 84 | """ |
---|
| 85 | reg_no = schema.TextLine( |
---|
| 86 | title = u'JAMB Registration Number', |
---|
| 87 | ) |
---|
| 88 | access_code = schema.TextLine( |
---|
| 89 | title = u'Access Code', |
---|
| 90 | ) |
---|
| 91 | serial = schema.TextLine( |
---|
| 92 | title = u'Serial Number', |
---|
| 93 | required = False, |
---|
| 94 | ) |
---|
| 95 | course1 = schema.TextLine( |
---|
| 96 | title = u'1st Choice Course of Study', |
---|
| 97 | ) |
---|
| 98 | course2 = schema.TextLine( |
---|
| 99 | title = u'2nd Choice Course of Study', |
---|
| 100 | required = False, |
---|
| 101 | ) |
---|
| 102 | course3 = schema.TextLine( |
---|
| 103 | title = u'3rd Choice Course of Study', |
---|
| 104 | required = False, |
---|
| 105 | ) |
---|
| 106 | firstname = schema.TextLine( |
---|
| 107 | title = u'First Name', |
---|
| 108 | ) |
---|
| 109 | middlenames = schema.TextLine( |
---|
| 110 | title = u'Middle Names', |
---|
| 111 | ) |
---|
| 112 | lastname = schema.TextLine( |
---|
| 113 | title = u'Surname/Full Name', |
---|
| 114 | ) |
---|
| 115 | jamb_age = schema.Int( |
---|
| 116 | title = u'Age (provided by JAMB)', |
---|
| 117 | required = False, |
---|
| 118 | ) |
---|
| 119 | date_of_birth = schema.Date( |
---|
| 120 | title = u'Date of Birth', |
---|
| 121 | ) |
---|
| 122 | jamb_state = schema.TextLine( |
---|
| 123 | title = u'State (provided by JAMB)', |
---|
| 124 | ) |
---|
| 125 | jamb_lga = schema.TextLine( |
---|
| 126 | title = u'LGA (provided by JAMB)', |
---|
| 127 | ) |
---|
| 128 | lga = schema.TextLine( |
---|
| 129 | # XXX: should be choice |
---|
| 130 | title = u'State/LGA (confirmed by applicant)', |
---|
| 131 | ) |
---|
| 132 | sex = schema.Choice( |
---|
| 133 | title = u'Sex', |
---|
| 134 | values = [u'female', u'male'] |
---|
| 135 | ) |
---|
| 136 | email = schema.TextLine( |
---|
| 137 | title = u'Email', |
---|
| 138 | required = False, |
---|
| 139 | ) |
---|
| 140 | phone = schema.TextLine( |
---|
| 141 | title = u'Phone', |
---|
| 142 | required = False, |
---|
| 143 | ) |
---|
| 144 | passport = schema.Bool( |
---|
| 145 | title = u'Passport Photograph', |
---|
| 146 | default = True, |
---|
| 147 | ) |
---|
| 148 | aos = schema.TextLine( |
---|
| 149 | # XXX: should be choice |
---|
| 150 | title = u'Area of Specialisation', |
---|
| 151 | required = False, |
---|
| 152 | ) |
---|
| 153 | subj1 = schema.TextLine( |
---|
| 154 | # XXX: should be choice |
---|
| 155 | title = u'1st Choice of Study', |
---|
| 156 | required = False, |
---|
| 157 | ) |
---|
| 158 | subj2 = schema.TextLine( |
---|
| 159 | # XXX: should be choice |
---|
| 160 | title = u'2nd Choice of Study', |
---|
| 161 | required = False, |
---|
| 162 | ) |
---|
| 163 | subj3 = schema.TextLine( |
---|
| 164 | # XXX: should be choice |
---|
| 165 | title = u'3rd Choice of Study', |
---|
| 166 | required = False, |
---|
| 167 | ) |
---|
| 168 | # |
---|
| 169 | # Higher Educational Data |
---|
| 170 | # |
---|
| 171 | hq_matric_no = schema.TextLine( |
---|
| 172 | title = u'Former Matric Number', |
---|
| 173 | required = False, |
---|
| 174 | ) |
---|
| 175 | hq_type = schema.TextLine( |
---|
| 176 | title = u'Higher Qualification', |
---|
| 177 | required = False, |
---|
| 178 | ) |
---|
| 179 | hq_grade = schema.TextLine( |
---|
| 180 | title = u'Higher Qualification Grade', |
---|
| 181 | required = False, |
---|
| 182 | ) |
---|
| 183 | hq_school = schema.TextLine( |
---|
| 184 | title = u'School Attended', |
---|
| 185 | required = False, |
---|
| 186 | ) |
---|
| 187 | hq_session = schema.TextLine( |
---|
| 188 | title = u'Session Obtained', |
---|
| 189 | required = False, |
---|
| 190 | ) |
---|
| 191 | hq_disc = schema.TextLine( |
---|
| 192 | title = u'Discipline', |
---|
| 193 | required = False, |
---|
| 194 | ) |
---|
| 195 | # |
---|
| 196 | # First sitting data |
---|
| 197 | # |
---|
| 198 | fst_sit_fname = schema.TextLine( |
---|
| 199 | title = u'Full Name', |
---|
| 200 | ) |
---|
| 201 | fst_sit_no = schema.TextLine( |
---|
| 202 | title = u'Exam Number', |
---|
| 203 | required = False, |
---|
| 204 | ) |
---|
| 205 | fst_sit_date = schema.Date( |
---|
| 206 | title = u'Exam Date (dd/mm/yyyy)', |
---|
| 207 | required = False, |
---|
| 208 | ) |
---|
| 209 | fst_sit_type = schema.TextLine( |
---|
| 210 | # XXX: Should be choice |
---|
| 211 | title = u'Exam Type', |
---|
| 212 | required = False, |
---|
| 213 | ) |
---|
[5271] | 214 | #fst_sit_results = schema.TextLine( |
---|
| 215 | # # XXX: Should be nested list of choices |
---|
| 216 | # title = u'Results', |
---|
| 217 | # required = False, |
---|
| 218 | # ) |
---|
| 219 | |
---|
| 220 | fst_sit_results = schema.List( |
---|
[5268] | 221 | title = u'Results', |
---|
| 222 | required = False, |
---|
[5271] | 223 | value_type = schema.Object( |
---|
| 224 | title = u'Entries', |
---|
| 225 | schema = IResultEntry, |
---|
| 226 | ) |
---|
[5268] | 227 | ) |
---|
[5271] | 228 | |
---|
| 229 | #fst_sit_results = schema.Object( |
---|
| 230 | # title = u'Results', |
---|
| 231 | # required = False, |
---|
| 232 | # schema = IResultEntry, |
---|
| 233 | # ) |
---|
| 234 | |
---|
| 235 | #fst_sit_results = schema.Dict( |
---|
| 236 | # title = u'Results', |
---|
| 237 | # required = False, |
---|
| 238 | # key_type = schema.TextLine( |
---|
| 239 | # title = u'Subject', |
---|
| 240 | # ), |
---|
| 241 | # value_type = schema.TextLine( |
---|
| 242 | # title = u'Score', |
---|
| 243 | # ), |
---|
| 244 | # ) |
---|
| 245 | |
---|
[5268] | 246 | # |
---|
| 247 | # Second sitting data |
---|
| 248 | # |
---|
| 249 | scd_sit_fname = schema.TextLine( |
---|
| 250 | title = u'Full Name', |
---|
| 251 | ) |
---|
| 252 | scd_sit_no = schema.TextLine( |
---|
| 253 | title = u'Exam Number', |
---|
| 254 | required = False, |
---|
| 255 | ) |
---|
| 256 | scd_sit_date = schema.Date( |
---|
| 257 | title = u'Exam Date (dd/mm/yyyy)', |
---|
| 258 | required = False, |
---|
| 259 | ) |
---|
| 260 | scd_sit_type = schema.TextLine( |
---|
| 261 | # XXX: Should be choice |
---|
| 262 | title = u'Exam Type', |
---|
| 263 | required = False, |
---|
| 264 | ) |
---|
| 265 | scd_sit_results = schema.TextLine( |
---|
| 266 | # XXX: Should be nested list of choices |
---|
| 267 | title = u'Results', |
---|
| 268 | required = False, |
---|
| 269 | ) |
---|
| 270 | # |
---|
| 271 | # JAMB scores |
---|
| 272 | # |
---|
| 273 | eng_score = schema.TextLine( |
---|
| 274 | title = u"'English' score", |
---|
| 275 | required = False, |
---|
| 276 | ) |
---|
| 277 | subj1score = schema.TextLine( |
---|
| 278 | title = u'1st Choice of Study Score', |
---|
| 279 | required = False, |
---|
| 280 | ) |
---|
| 281 | subj2score = schema.TextLine( |
---|
| 282 | title = u'2nd Choice of Study Score', |
---|
| 283 | required = False, |
---|
| 284 | ) |
---|
| 285 | subj3score = schema.TextLine( |
---|
| 286 | title = u'3rd Choice of Study Score', |
---|
| 287 | required = False, |
---|
| 288 | ) |
---|
| 289 | # XXX: Total score??? |
---|
| 290 | |
---|
| 291 | # |
---|
| 292 | # Application Data |
---|
| 293 | # |
---|
| 294 | application_date = schema.Date( |
---|
| 295 | title = u'Application Date', |
---|
| 296 | ) |
---|
| 297 | status = schema.TextLine( |
---|
| 298 | # XXX: should be 'status' type |
---|
| 299 | title = u'Application Status', |
---|
| 300 | ) |
---|
| 301 | screening_date = schema.Date( |
---|
| 302 | title = u'Screening Date', |
---|
| 303 | ) |
---|
| 304 | screening_type = schema.TextLine( |
---|
| 305 | # XXX: schould be choice |
---|
| 306 | title = u'Screening Type', |
---|
| 307 | ) |
---|
| 308 | screening_score = schema.TextLine( |
---|
| 309 | title = u'Screening Score', |
---|
| 310 | ) |
---|
| 311 | screening_venue = schema.TextLine( |
---|
| 312 | title = u'Screening Venue', |
---|
| 313 | required = False, |
---|
| 314 | ) |
---|
| 315 | total_score = schema.TextLine( |
---|
| 316 | title = u'Total Score', |
---|
| 317 | required = False, |
---|
| 318 | ) |
---|
| 319 | course_admitted = schema.TextLine( |
---|
| 320 | # XXX: should be choice |
---|
| 321 | title = u'Admitted Course of Study', |
---|
| 322 | required = False, |
---|
| 323 | ) |
---|
| 324 | department = schema.TextLine( |
---|
| 325 | # XXX: if we have a course, dept. is not necessary |
---|
| 326 | title = u'Department', |
---|
| 327 | required = False, |
---|
| 328 | ) |
---|
| 329 | faculty = schema.TextLine( |
---|
| 330 | # XXX: if we have a course, faculty is not necessary |
---|
| 331 | title = u'Faculty', |
---|
| 332 | required = False, |
---|
| 333 | ) |
---|
| 334 | entry_session = schema.TextLine( |
---|
| 335 | # XXX: should be choice |
---|
| 336 | # XXX: should have sensible default: upcoming session |
---|
[5269] | 337 | title = u'Entry Session', |
---|
[5268] | 338 | required = True, |
---|
| 339 | ) |
---|
| 340 | notice = schema.Text( |
---|
| 341 | title = u'Notice', |
---|
| 342 | required = False, |
---|
[5269] | 343 | ) |
---|
| 344 | student_id = schema.TextLine( |
---|
[5268] | 345 | title = u'Student ID', |
---|
| 346 | required = False, |
---|
| 347 | ) |
---|
| 348 | import_record_no = schema.TextLine( |
---|
| 349 | title = u'Import Record No.', |
---|
| 350 | ) |
---|
| 351 | imported_by = schema.TextLine( |
---|
| 352 | title = u'Imported By', |
---|
| 353 | ) |
---|
[5269] | 354 | import_date = schema.Datetime( |
---|
[5268] | 355 | title = u'Import Date', |
---|
| 356 | ) |
---|
| 357 | import_from = schema.TextLine( |
---|
| 358 | title = u'Import Source', |
---|
| 359 | ) |
---|
[5269] | 360 | |
---|
| 361 | class IApplicantContainer(IWAeUPObject): |
---|
| 362 | """A container for applicants. |
---|
| 363 | """ |
---|