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 |
---|
26 | from zope import schema |
---|
27 | |
---|
28 | class IJAMBDataTable(IWAeUPObject): |
---|
29 | """A table containing JAMB data. |
---|
30 | """ |
---|
31 | import_datetime = schema.Datetime( |
---|
32 | title = u'Datetime of import of contained data.', |
---|
33 | required = False, |
---|
34 | ) |
---|
35 | |
---|
36 | importer_username = schema.TextLine( |
---|
37 | title = u'Name of user who initiated import.', |
---|
38 | required = False, |
---|
39 | ) |
---|
40 | |
---|
41 | def __iter__(): |
---|
42 | """An iterator over all data elements. |
---|
43 | """ |
---|
44 | |
---|
45 | def keys(): |
---|
46 | """Get iterator over all registration numbers of data. |
---|
47 | """ |
---|
48 | |
---|
49 | def items(): |
---|
50 | """Get iterator over tuples of registration numbers and datasets. |
---|
51 | """ |
---|
52 | |
---|
53 | def clear(): |
---|
54 | """Clear all data contained. |
---|
55 | |
---|
56 | This will also erase any import data. |
---|
57 | """ |
---|
58 | |
---|
59 | def importFromCSV(filepath, username=None): |
---|
60 | """Import data from filepath. |
---|
61 | |
---|
62 | `filepath` - the path to the CSV file to import data from. |
---|
63 | |
---|
64 | `username` - the (optional) username of the importing person. |
---|
65 | """ |
---|
66 | |
---|
67 | class IApplicant(IWAeUPObject): |
---|
68 | """An applicant. |
---|
69 | |
---|
70 | |
---|
71 | """ |
---|
72 | reg_no = schema.TextLine( |
---|
73 | title = u'JAMB Registration Number', |
---|
74 | ) |
---|
75 | access_code = schema.TextLine( |
---|
76 | title = u'Access Code', |
---|
77 | ) |
---|
78 | serial = schema.TextLine( |
---|
79 | title = u'Serial Number', |
---|
80 | required = False, |
---|
81 | ) |
---|
82 | course1 = schema.TextLine( |
---|
83 | title = u'1st Choice Course of Study', |
---|
84 | ) |
---|
85 | course2 = schema.TextLine( |
---|
86 | title = u'2nd Choice Course of Study', |
---|
87 | required = False, |
---|
88 | ) |
---|
89 | course3 = schema.TextLine( |
---|
90 | title = u'3rd Choice Course of Study', |
---|
91 | required = False, |
---|
92 | ) |
---|
93 | firstname = schema.TextLine( |
---|
94 | title = u'First Name', |
---|
95 | ) |
---|
96 | middlenames = schema.TextLine( |
---|
97 | title = u'Middle Names', |
---|
98 | ) |
---|
99 | lastname = schema.TextLine( |
---|
100 | title = u'Surname/Full Name', |
---|
101 | ) |
---|
102 | jamb_age = schema.Int( |
---|
103 | title = u'Age (provided by JAMB)', |
---|
104 | required = False, |
---|
105 | ) |
---|
106 | date_of_birth = schema.Date( |
---|
107 | title = u'Date of Birth', |
---|
108 | ) |
---|
109 | jamb_state = schema.TextLine( |
---|
110 | title = u'State (provided by JAMB)', |
---|
111 | ) |
---|
112 | jamb_lga = schema.TextLine( |
---|
113 | title = u'LGA (provided by JAMB)', |
---|
114 | ) |
---|
115 | lga = schema.TextLine( |
---|
116 | # XXX: should be choice |
---|
117 | title = u'State/LGA (confirmed by applicant)', |
---|
118 | ) |
---|
119 | sex = schema.Choice( |
---|
120 | title = u'Sex', |
---|
121 | values = [u'female', u'male'] |
---|
122 | ) |
---|
123 | email = schema.TextLine( |
---|
124 | title = u'Email', |
---|
125 | required = False, |
---|
126 | ) |
---|
127 | phone = schema.TextLine( |
---|
128 | title = u'Phone', |
---|
129 | required = False, |
---|
130 | ) |
---|
131 | passport = schema.Bool( |
---|
132 | title = u'Passport Photograph', |
---|
133 | default = True, |
---|
134 | ) |
---|
135 | aos = schema.TextLine( |
---|
136 | # XXX: should be choice |
---|
137 | title = u'Area of Specialisation', |
---|
138 | required = False, |
---|
139 | ) |
---|
140 | subj1 = schema.TextLine( |
---|
141 | # XXX: should be choice |
---|
142 | title = u'1st Choice of Study', |
---|
143 | required = False, |
---|
144 | ) |
---|
145 | subj2 = schema.TextLine( |
---|
146 | # XXX: should be choice |
---|
147 | title = u'2nd Choice of Study', |
---|
148 | required = False, |
---|
149 | ) |
---|
150 | subj3 = schema.TextLine( |
---|
151 | # XXX: should be choice |
---|
152 | title = u'3rd Choice of Study', |
---|
153 | required = False, |
---|
154 | ) |
---|
155 | # |
---|
156 | # Higher Educational Data |
---|
157 | # |
---|
158 | hq_matric_no = schema.TextLine( |
---|
159 | title = u'Former Matric Number', |
---|
160 | required = False, |
---|
161 | ) |
---|
162 | hq_type = schema.TextLine( |
---|
163 | title = u'Higher Qualification', |
---|
164 | required = False, |
---|
165 | ) |
---|
166 | hq_grade = schema.TextLine( |
---|
167 | title = u'Higher Qualification Grade', |
---|
168 | required = False, |
---|
169 | ) |
---|
170 | hq_school = schema.TextLine( |
---|
171 | title = u'School Attended', |
---|
172 | required = False, |
---|
173 | ) |
---|
174 | hq_session = schema.TextLine( |
---|
175 | title = u'Session Obtained', |
---|
176 | required = False, |
---|
177 | ) |
---|
178 | hq_disc = schema.TextLine( |
---|
179 | title = u'Discipline', |
---|
180 | required = False, |
---|
181 | ) |
---|
182 | # |
---|
183 | # First sitting data |
---|
184 | # |
---|
185 | fst_sit_fname = schema.TextLine( |
---|
186 | title = u'Full Name', |
---|
187 | ) |
---|
188 | fst_sit_no = schema.TextLine( |
---|
189 | title = u'Exam Number', |
---|
190 | required = False, |
---|
191 | ) |
---|
192 | fst_sit_date = schema.Date( |
---|
193 | title = u'Exam Date (dd/mm/yyyy)', |
---|
194 | required = False, |
---|
195 | ) |
---|
196 | fst_sit_type = schema.TextLine( |
---|
197 | # XXX: Should be choice |
---|
198 | title = u'Exam Type', |
---|
199 | required = False, |
---|
200 | ) |
---|
201 | fst_sit_results = schema.TextLine( |
---|
202 | # XXX: Should be nested list of choices |
---|
203 | title = u'Results', |
---|
204 | required = False, |
---|
205 | ) |
---|
206 | # |
---|
207 | # Second sitting data |
---|
208 | # |
---|
209 | scd_sit_fname = schema.TextLine( |
---|
210 | title = u'Full Name', |
---|
211 | ) |
---|
212 | scd_sit_no = schema.TextLine( |
---|
213 | title = u'Exam Number', |
---|
214 | required = False, |
---|
215 | ) |
---|
216 | scd_sit_date = schema.Date( |
---|
217 | title = u'Exam Date (dd/mm/yyyy)', |
---|
218 | required = False, |
---|
219 | ) |
---|
220 | scd_sit_type = schema.TextLine( |
---|
221 | # XXX: Should be choice |
---|
222 | title = u'Exam Type', |
---|
223 | required = False, |
---|
224 | ) |
---|
225 | scd_sit_results = schema.TextLine( |
---|
226 | # XXX: Should be nested list of choices |
---|
227 | title = u'Results', |
---|
228 | required = False, |
---|
229 | ) |
---|
230 | # |
---|
231 | # JAMB scores |
---|
232 | # |
---|
233 | eng_score = schema.TextLine( |
---|
234 | title = u"'English' score", |
---|
235 | required = False, |
---|
236 | ) |
---|
237 | subj1score = schema.TextLine( |
---|
238 | title = u'1st Choice of Study Score', |
---|
239 | required = False, |
---|
240 | ) |
---|
241 | subj2score = schema.TextLine( |
---|
242 | title = u'2nd Choice of Study Score', |
---|
243 | required = False, |
---|
244 | ) |
---|
245 | subj3score = schema.TextLine( |
---|
246 | title = u'3rd Choice of Study Score', |
---|
247 | required = False, |
---|
248 | ) |
---|
249 | # XXX: Total score??? |
---|
250 | |
---|
251 | # |
---|
252 | # Application Data |
---|
253 | # |
---|
254 | application_date = schema.Date( |
---|
255 | title = u'Application Date', |
---|
256 | ) |
---|
257 | status = schema.TextLine( |
---|
258 | # XXX: should be 'status' type |
---|
259 | title = u'Application Status', |
---|
260 | ) |
---|
261 | screening_date = schema.Date( |
---|
262 | title = u'Screening Date', |
---|
263 | ) |
---|
264 | screening_type = schema.TextLine( |
---|
265 | # XXX: schould be choice |
---|
266 | title = u'Screening Type', |
---|
267 | ) |
---|
268 | screening_score = schema.TextLine( |
---|
269 | title = u'Screening Score', |
---|
270 | ) |
---|
271 | screening_venue = schema.TextLine( |
---|
272 | title = u'Screening Venue', |
---|
273 | required = False, |
---|
274 | ) |
---|
275 | total_score = schema.TextLine( |
---|
276 | title = u'Total Score', |
---|
277 | required = False, |
---|
278 | ) |
---|
279 | course_admitted = schema.TextLine( |
---|
280 | # XXX: should be choice |
---|
281 | title = u'Admitted Course of Study', |
---|
282 | required = False, |
---|
283 | ) |
---|
284 | department = schema.TextLine( |
---|
285 | # XXX: if we have a course, dept. is not necessary |
---|
286 | title = u'Department', |
---|
287 | required = False, |
---|
288 | ) |
---|
289 | faculty = schema.TextLine( |
---|
290 | # XXX: if we have a course, faculty is not necessary |
---|
291 | title = u'Faculty', |
---|
292 | required = False, |
---|
293 | ) |
---|
294 | entry_session = schema.TextLine( |
---|
295 | # XXX: should be choice |
---|
296 | # XXX: should have sensible default: upcoming session |
---|
297 | title = u'Entry Session', |
---|
298 | required = True, |
---|
299 | ) |
---|
300 | notice = schema.Text( |
---|
301 | title = u'Notice', |
---|
302 | required = False, |
---|
303 | ) |
---|
304 | student_id = schema.TextLine( |
---|
305 | title = u'Student ID', |
---|
306 | required = False, |
---|
307 | ) |
---|
308 | import_record_no = schema.TextLine( |
---|
309 | title = u'Import Record No.', |
---|
310 | ) |
---|
311 | imported_by = schema.TextLine( |
---|
312 | title = u'Imported By', |
---|
313 | ) |
---|
314 | import_date = schema.Datetime( |
---|
315 | title = u'Import Date', |
---|
316 | ) |
---|
317 | import_from = schema.TextLine( |
---|
318 | title = u'Import Source', |
---|
319 | ) |
---|
320 | |
---|
321 | class IApplicantContainer(IWAeUPObject): |
---|
322 | """A container for applicants. |
---|
323 | """ |
---|