[13078] | 1 | .. _students_interfaces: |
---|
[13025] | 2 | |
---|
[13168] | 3 | Student Interfaces |
---|
| 4 | ================== |
---|
[13025] | 5 | |
---|
| 6 | The `Student` class is a container class which means, there are not |
---|
| 7 | only attributes describing the student entity but also content. Each |
---|
[13028] | 8 | student container contains three subcontainers: |
---|
[13025] | 9 | ``studycourse`` (instance of `StudentStudyCourse`), ``payments`` |
---|
| 10 | (instance of `StudentPaymentsContainer`) and ``accommodation`` |
---|
| 11 | (instance of `StudentAccommodation`). The purposes of them are |
---|
[13026] | 12 | described further below. The student container with all its |
---|
| 13 | subcontainers and subobjects is called **student record**. |
---|
[13025] | 14 | |
---|
| 15 | Let's talk about the attributes and methods belonging to the |
---|
| 16 | `Student` class, the so-called 'external behaviour' of student |
---|
| 17 | objects specified in Zope 'interfaces'. The data stored with each |
---|
| 18 | student object are subdivided into three parts: base data, personal |
---|
| 19 | data and clearance data. Each part has its own interface. |
---|
| 20 | |
---|
| 21 | .. _kofa_interfaces: |
---|
| 22 | |
---|
| 23 | .. note:: |
---|
| 24 | |
---|
| 25 | **Interfaces** are one of the pillars of Zope's Component |
---|
| 26 | Architecture (ZCA, see also :ref:`prerequisites`). They document the |
---|
| 27 | 'external behaviour' of objects. In Kofa interfaces are used to |
---|
| 28 | specify the attributes, methods and schema fields of objects. The |
---|
| 29 | first two are well-known Python concepts. A Zope schema field is a |
---|
| 30 | bit more complicated. It's a detailed description of a field to be |
---|
| 31 | submitted via forms to the server, or which is processed by a batch |
---|
| 32 | processor. In both cases the input data are being validated against |
---|
| 33 | the schema field requirements. In Kofa, schema fields (see also note |
---|
| 34 | below) in interfaces are also used to automtically add |
---|
| 35 | `FieldProperty` attributes of the same name to most content classes. |
---|
| 36 | This is done by a function |
---|
| 37 | :py:func:`attrs_to_fields<waeup.kofa.utils.helpers.attrs_to_fields>` |
---|
| 38 | which is called once during startup of Kofa. These class attributes |
---|
| 39 | ensure that corresponding attributes of instances of this class - |
---|
| 40 | when being added or changed - always meet the requirements of the |
---|
| 41 | schema field. Another big advantage of such class attributes is, |
---|
| 42 | that attributes with a `FieldProperty` do not need to be set in |
---|
| 43 | `__init__` methods. |
---|
| 44 | |
---|
| 45 | The `Student` class implements several interfaces which we will |
---|
| 46 | quote to unveil the student's 'external behaviour'. |
---|
| 47 | |
---|
| 48 | `IStudentBase` |
---|
| 49 | -------------- |
---|
| 50 | |
---|
| 51 | `waeup.kofa.students.interfaces.IStudentBase` defines a fundamental |
---|
| 52 | set of attributes, schema fields and methods which are being used |
---|
| 53 | throughout the portal. This set is immutable. No class statement |
---|
| 54 | must be removed or added in customized versions of Kofa. |
---|
| 55 | |
---|
| 56 | .. literalinclude:: ../../../../src/waeup/kofa/students/interfaces.py |
---|
| 57 | :pyobject: IStudentBase |
---|
| 58 | |
---|
| 59 | The **first part** of the interface lists attributes. Except for the |
---|
| 60 | last two attributes (`password` and `temp_password`) they are all |
---|
| 61 | read-only property attributes, i.e. attributes with a getter method |
---|
| 62 | only. These properties are computed dynamically and can't be set. |
---|
| 63 | Most of them return data derived from the ``studycourse`` subobject. |
---|
| 64 | |
---|
| 65 | The **second part** of the interface specifies the schema fields. |
---|
| 66 | |
---|
| 67 | .. _kofa_schemas: |
---|
| 68 | |
---|
| 69 | .. note:: |
---|
| 70 | |
---|
| 71 | **Schema fields** are instances of schema field classes with `title`, |
---|
| 72 | `description`, `default`, `required`, `readonly` attributes. Class |
---|
| 73 | names and class attributes are self-explanatory and described in the |
---|
| 74 | `Zope Schema`_ documentation. |
---|
| 75 | |
---|
[13072] | 76 | A very powerful Zope Schema field is `Choice`. Choice fields are |
---|
[13025] | 77 | constrained to values drawn from a specified set, which can be |
---|
[13072] | 78 | static or dynamic. This set can be a simple list of choices (= |
---|
| 79 | `values`), a `vocabulary` or a `source` which produce dynamic |
---|
[13025] | 80 | choices. |
---|
| 81 | |
---|
| 82 | **Vocabularies and sources** are very similar. The latter is a newer |
---|
| 83 | concept of producing choices and considered to replace vocabularies. |
---|
[13072] | 84 | In Kofa we use both. Common to both is, that a set of values is |
---|
[13025] | 85 | accompanied by a user-friendly title, which is displayed on pages |
---|
| 86 | (e.g. in select boxes) instead of a less informative value token or |
---|
| 87 | even a cryptic representation of a persistent value object. In most |
---|
| 88 | cases we have a token-title pair which perfectly describes the |
---|
| 89 | values of a source or a vocabulary. The tokens are being sent in |
---|
| 90 | forms or imported by batch processors. |
---|
| 91 | |
---|
| 92 | See `token-title pairs <http://kofa-demo.waeup.org/sources>`_ of |
---|
| 93 | most (non-database-dependent) sources and vocabularies in the Kofa |
---|
| 94 | base package. |
---|
| 95 | |
---|
| 96 | The **third part** of the interface lists the methods which can be |
---|
| 97 | applied to student objects. |
---|
| 98 | |
---|
| 99 | `IUGStudentClearance` |
---|
| 100 | --------------------- |
---|
| 101 | |
---|
| 102 | Much like all the following student interfaces, |
---|
| 103 | `waeup.kofa.students.interfaces.IUGStudentClearance` describes an |
---|
| 104 | additional set of schema fields which are exclusively used on form |
---|
| 105 | pages. They do not play any role beyond that purpose. Any kind of |
---|
| 106 | schema field can be safely added in customized versions of these |
---|
| 107 | interfaces to meet the conditions of the university's matriculation |
---|
| 108 | process. Also `date_of_birth` and `nationality` are not used in the |
---|
| 109 | base package for further data processing which means, there is no |
---|
| 110 | dependency on these two parameters. Attention: This might be |
---|
| 111 | different in customized versions of Kofa. Some views might use these |
---|
| 112 | parameters to restrict access or make actions (e.g. payment of items) |
---|
| 113 | conditional on the student's nationality or current age. |
---|
| 114 | |
---|
| 115 | .. literalinclude:: ../../../../src/waeup/kofa/students/interfaces.py |
---|
| 116 | :pyobject: IUGStudentClearance |
---|
| 117 | |
---|
| 118 | `clearance_locked` controls the access to the edit form page of |
---|
| 119 | clearance data. The corresponding attribute is automatically set by |
---|
| 120 | workflow transitions to lock or unlock the edit form page |
---|
| 121 | respectively. The attribute can also be set by officers via the |
---|
| 122 | manage form page to lock or unlock the page manually. |
---|
| 123 | |
---|
| 124 | `officer_comment` is usually edited by clearance officers when |
---|
| 125 | rejecting clearance previously requested by the student. The |
---|
| 126 | attribute contains the message which informs the student about the |
---|
| 127 | reasons of rejection. The attribute is cleared after final |
---|
| 128 | clearance. The message can be also found in ``students.log``. |
---|
| 129 | |
---|
| 130 | Both `clearance_locked` and `officer_comment` are controlled by |
---|
| 131 | workflow transitions not by states, see below. |
---|
| 132 | |
---|
| 133 | `IPGStudentClearance` |
---|
| 134 | --------------------- |
---|
| 135 | |
---|
| 136 | Most universities acquire different data from undergraduate (UG) and |
---|
| 137 | postgraduate (PG) students. The forms vary widely. Therefore Kofa |
---|
| 138 | offers a second interface for acquiring PG clearance data. In the |
---|
| 139 | base package `IPGStudentClearance` inherits from the |
---|
| 140 | `IUGStudentClearance` interface. The additional `employer` field in |
---|
| 141 | the base package only serves as an example. |
---|
| 142 | |
---|
| 143 | .. literalinclude:: ../../../../src/waeup/kofa/students/interfaces.py |
---|
| 144 | :pyobject: IPGStudentClearance |
---|
| 145 | |
---|
| 146 | `IStudentPersonal` |
---|
| 147 | ------------------ |
---|
| 148 | |
---|
| 149 | `waeup.kofa.students.interfaces.IUGStudentPersonal` defines an |
---|
| 150 | additional set of personal student data which are permantly editable |
---|
| 151 | by students. The set usually contains further contact data and |
---|
| 152 | information about the student's relatives. |
---|
| 153 | |
---|
| 154 | .. literalinclude:: ../../../../src/waeup/kofa/students/interfaces.py |
---|
| 155 | :pyobject: IStudentPersonal |
---|
| 156 | |
---|
| 157 | Kofa provides a mechanism which ensures that personal data are being |
---|
| 158 | kept up to date. Students are regularly requested to update the |
---|
| 159 | personal data directly after login. The personal data expire 180 |
---|
| 160 | days after saving the data for the last time which is stored in the |
---|
| 161 | `personal_updated` attribute. Then the `personal_data_expired` |
---|
| 162 | property returns ``True`` and the student is redirected to the |
---|
| 163 | personal data edit page when logging in. |
---|
| 164 | |
---|
| 165 | `IStudentNavigation` |
---|
| 166 | -------------------- |
---|
| 167 | |
---|
| 168 | See docstring. |
---|
| 169 | |
---|
| 170 | .. literalinclude:: ../../../../src/waeup/kofa/students/interfaces.py |
---|
| 171 | :pyobject: IStudentNavigation |
---|
| 172 | |
---|
[13168] | 173 | Student Study Course Interfaces |
---|
| 174 | =============================== |
---|
[13025] | 175 | |
---|
| 176 | All data related to an individual course of study are stored with |
---|
| 177 | the ``studycourse`` object. This container object is an instance of |
---|
| 178 | the `StudentStudyCourse` class which implements |
---|
| 179 | `waeup.kofa.students.interfaces.IStudentStudyCourse`, |
---|
| 180 | `waeup.kofa.students.interfaces.IStudentNavigation` and |
---|
| 181 | `waeup.kofa.students.interfaces.IStudentStudyCourseTranscript`. The |
---|
| 182 | latter does not add further behaviour to our classes but is needed |
---|
| 183 | for transcript pages only. It is not described in the user handbook. |
---|
| 184 | |
---|
| 185 | `IStudentStudyCourse` |
---|
| 186 | --------------------- |
---|
| 187 | |
---|
| 188 | .. literalinclude:: ../../../../src/waeup/kofa/students/interfaces.py |
---|
| 189 | :pyobject: IStudentStudyCourse |
---|
| 190 | |
---|
| 191 | All attributes are read-only property attributes which are computed |
---|
| 192 | dynamically. |
---|
| 193 | |
---|
| 194 | The first schema field is a `Choice` field which allows values from |
---|
| 195 | the `CertificateSource`. The source provides all certificates stored |
---|
| 196 | in the portal. This way, `StudentStudyCourse` objects point to |
---|
| 197 | exactly one `Certificate` object in the portal. If the certificate |
---|
| 198 | is removed, an event handler takes care of clearing also all |
---|
| 199 | referring `certificate` attribute. The tokens of the |
---|
| 200 | `CertificateSource` are the certicate codes which means, that in |
---|
| 201 | forms and import files the unique code must be given and the desired |
---|
| 202 | `Certificate` object will be stored. |
---|
| 203 | |
---|
| 204 | The interface has two entry parameter fields. `entry_mode` stores |
---|
| 205 | the study mode of the programme and `entry_session` the academic |
---|
| 206 | year when the study course was started. Usually these parameters are |
---|
| 207 | fixed and must not be changed during course of study. |
---|
| 208 | |
---|
[13072] | 209 | Very important - or even most important - are the parameters which |
---|
[13025] | 210 | describe the current state of the student's study course. |
---|
| 211 | `current_session`, `current_level`, `current_verdict`, |
---|
| 212 | `previous_verdict` and the student's workflow state (see below) |
---|
| 213 | declare precisely in which academic session and how successfully the |
---|
| 214 | student has reached the current study level and state in the portal. |
---|
| 215 | All these attributes are set automatically by the portal und must |
---|
[13072] | 216 | (normally) not be changed via manage form pages or import. |
---|
[13025] | 217 | |
---|
| 218 | What is a verdict? A verdict is the individual judgement of a jury |
---|
| 219 | (senate in Nigeria) at the end of each academic session. The jury's |
---|
| 220 | verdict tells the portal, if the student has successfully completed |
---|
| 221 | an academic session or not. Depending on the verdict, the student |
---|
| 222 | will be either allowed to proceed to the next study level or forced |
---|
| 223 | to repeat the current level. Without a verdict, the student gets |
---|
| 224 | stuck and cannot even pay school fees for the next academic year. |
---|
| 225 | This will be further exlplained in the workflow section below. |
---|
| 226 | |
---|
| 227 | `StudentStudyCourse` is a container class. Study courses contain |
---|
| 228 | `StudentStudyLevel` instances which implement |
---|
| 229 | `waeup.kofa.students.interfaces.IStudentStudyLevel` and also |
---|
| 230 | `waeup.kofa.students.interfaces.IStudentNavigation`, see above. |
---|
| 231 | |
---|
| 232 | `IStudentStudyLevel` |
---|
| 233 | -------------------- |
---|
| 234 | |
---|
| 235 | `StudentStudyLevel` instances contain information about the study |
---|
| 236 | progress achieved at that level. In Kofa study levels range from 100 |
---|
| 237 | to 900. There are two additional levels: a pre-studies level (10) |
---|
| 238 | and a special postgraduate level (999). There are also two probation |
---|
| 239 | levels per regular study level. Level 120, for instance, means level |
---|
| 240 | 100 on second probation. See `complete numbering of study levels |
---|
| 241 | <https://kofa-demo.waeup.org/sources#collapseStudyLevels>`_ in the |
---|
| 242 | base package. |
---|
| 243 | |
---|
| 244 | `StudentStudyLevel` instances are container objects which contain |
---|
| 245 | course tickets. We therefore sometimes speak of a level course list |
---|
| 246 | instead of a study level. The study level stores and provides the |
---|
| 247 | information when (`validation_date`) and by whom (`validated_by`) |
---|
| 248 | the course list was validated, in which session the level was taken |
---|
| 249 | (`level_session`) and which verdict the student finally obtained. |
---|
| 250 | |
---|
| 251 | .. literalinclude:: ../../../../src/waeup/kofa/students/interfaces.py |
---|
| 252 | :pyobject: IStudentStudyLevel |
---|
| 253 | |
---|
| 254 | `StudentStudyLevel` instances also compute some statistics on the |
---|
| 255 | fly to give an overview of the courses taken. These read-only |
---|
| 256 | property attributes are: `number_of_tickets`, `passed_params`, |
---|
| 257 | `gpa_params`, `gpa_params_rectified`, `cumulative_params`, |
---|
| 258 | `total_credits` and `gpa`. The attentive reader may wonder why the |
---|
| 259 | latter two are not listed in the attributes section of the interface, |
---|
| 260 | but as read-only schema fields further below. This is a trick which |
---|
| 261 | we used to properly display these fields on some display pages and |
---|
| 262 | pdf slips. However, the `attrs_to_fields` function explicitly |
---|
| 263 | excludes them when starting the portal, so that these fields are not |
---|
| 264 | used for persistent storage of same-named attributes in the database. |
---|
| 265 | |
---|
[13031] | 266 | The property attribute `course_registration_allowed` determines |
---|
| 267 | whether course registration has ended. In the base package students |
---|
| 268 | can proceed if they have paid late registration fee. The conditions |
---|
| 269 | for course registration can be configured in custom packages. |
---|
| 270 | |
---|
[13025] | 271 | `ICourseTicket` |
---|
| 272 | --------------- |
---|
| 273 | |
---|
| 274 | Course tickets allow students to attend a course. Lecturers can |
---|
| 275 | enter scores at the end of the term. A `CourseTicket` instance |
---|
| 276 | contains a copy of the original `Course` and `CertificateCourse` |
---|
| 277 | data. If the courses and/or the referring certificate courses are |
---|
| 278 | removed, the corresponding tickets remain unchanged. So we do not |
---|
| 279 | need any event triggered actions on course tickets. |
---|
| 280 | |
---|
| 281 | The `CourseTicket` implements |
---|
| 282 | `waeup.kofa.students.interfaces.ICourseTicket` and also |
---|
| 283 | `waeup.kofa.students.interfaces.IStudentNavigation`, see above. |
---|
| 284 | |
---|
| 285 | .. literalinclude:: ../../../../src/waeup/kofa/students/interfaces.py |
---|
| 286 | :pyobject: ICourseTicket |
---|
| 287 | |
---|
| 288 | The quite long list of schema fields pretends that form pages may |
---|
| 289 | provide these fields for editing. This is not the case. Except for |
---|
[14654] | 290 | `score`, `mandatory`, `outstanding` and `course_category` (not |
---|
| 291 | available in base package) all fields are 'for display' only. |
---|
| 292 | They cannot be changed through the UI. They are solely meant for |
---|
| 293 | backing up the orginal course data. However, some of them can be |
---|
| 294 | overwritten by batch processing (import), see |
---|
| 295 | :ref:`course_ticket_processor`. |
---|
[13025] | 296 | |
---|
[15208] | 297 | `ticket_session` can but must not be used for storing the session in |
---|
| 298 | which the course was taken. Usually, level and session are inherited |
---|
| 299 | from the parent study level container. Storing the same |
---|
| 300 | information in course tickets is not necessary, unless the session |
---|
| 301 | really differs or 'orphaned' course tickets (tickets without level |
---|
| 302 | assignment) have to be stored in the Level Zero container. |
---|
| 303 | `ticket_session` can't be edited through the UI, they only changed |
---|
| 304 | by import. |
---|
[15204] | 305 | |
---|
[13025] | 306 | .. note:: |
---|
| 307 | |
---|
| 308 | It may happen that a course has been accidentally misconfigured, for |
---|
| 309 | example the number of credits was set too high. The course object |
---|
| 310 | can be corrected, but, course tickets, which refer to this course, |
---|
[14654] | 311 | can not. They are not adjusted automatically. If you want to correct |
---|
| 312 | course tickets you have to replace them by new tickets or |
---|
| 313 | to repair the data by batch processing. |
---|
[13025] | 314 | |
---|
[13168] | 315 | Student Payment Interfaces |
---|
| 316 | ========================== |
---|
[13025] | 317 | |
---|
| 318 | `IStudentOnlinePayment` |
---|
| 319 | ----------------------- |
---|
| 320 | |
---|
[13076] | 321 | `IStudentOnlinePayment` instances are called student payment tickets |
---|
| 322 | or sometimes only payments. They contain the data which confirm that |
---|
| 323 | the student has paid a specific fee. |
---|
[13025] | 324 | `waeup.kofa.students.interfaces.IStudentOnlinePayment` inherits from |
---|
| 325 | `waeup.kofa.payments.interfaces.IOnlinePayment` and has only two |
---|
| 326 | additional schema fields: `p_current` and `p_level` which are |
---|
| 327 | student-specific. It also promises three additional methods which |
---|
| 328 | process student data after successful or approved payment. |
---|
| 329 | |
---|
| 330 | .. literalinclude:: ../../../../src/waeup/kofa/students/interfaces.py |
---|
| 331 | :pyobject: IStudentOnlinePayment |
---|
| 332 | |
---|
[13168] | 333 | Student Accommodation Interfaces |
---|
| 334 | ================================ |
---|
[13025] | 335 | |
---|
| 336 | `IBedTicket` |
---|
| 337 | ------------ |
---|
| 338 | |
---|
| 339 | A bed ticket confirms that a bed space in a hostel has been |
---|
| 340 | allocated to the student for the period of an academic session |
---|
| 341 | (`booking_session`). The `bed_coordinates` specify which bed space |
---|
| 342 | has been booked. Sometimes this value is too cryptic and |
---|
| 343 | inappropriate to guide the student to the bed space. The |
---|
| 344 | `display_coordinates` property can be used to 'translate' the |
---|
| 345 | coordinates and display a customary description of the bed space. |
---|
| 346 | Much like some study level attributes, also `display_coordinates` is |
---|
| 347 | defined as a read-only schema field in order to automatically |
---|
| 348 | display the field on form pages. It is excluded by the |
---|
| 349 | `attrs_to_fields` function and thus not stored in the database. |
---|
| 350 | |
---|
| 351 | .. literalinclude:: ../../../../src/waeup/kofa/students/interfaces.py |
---|
| 352 | :pyobject: IBedTicket |
---|
| 353 | |
---|
| 354 | .. _zope schema: http://docs.zope.org/zope.schema |
---|