source: main/waeup.kofa/trunk/docs/source/userdocs/students/interfaces.rst @ 13078

Last change on this file since 13078 was 13078, checked in by Henrik Bettermann, 9 years ago

More docs.

File size: 15.1 KB
Line 
1.. _students_interfaces:
2
3Student
4=======
5
6The `Student` class is a container class which means, there are not
7only attributes describing the student entity but also content. Each
8student container contains three subcontainers:
9``studycourse`` (instance of `StudentStudyCourse`), ``payments``
10(instance of `StudentPaymentsContainer`) and ``accommodation``
11(instance of `StudentAccommodation`). The purposes of them are
12described further below. The student container with all its
13subcontainers and subobjects is called **student record**.
14
15Let's talk about the attributes and methods belonging to the
16`Student` class, the so-called 'external behaviour' of student
17objects specified in Zope 'interfaces'. The data stored with each
18student object are subdivided into three parts: base data, personal
19data 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
45The `Student` class implements several interfaces which we will
46quote to unveil the student's 'external behaviour'.
47
48`IStudentBase`
49--------------
50
51`waeup.kofa.students.interfaces.IStudentBase` defines a fundamental
52set of attributes, schema fields and methods which are being used
53throughout the portal. This set is immutable. No class statement
54must be removed or added in customized versions of Kofa.
55
56.. literalinclude:: ../../../../src/waeup/kofa/students/interfaces.py
57   :pyobject: IStudentBase
58
59The **first part** of the interface lists attributes. Except for the
60last two attributes (`password` and `temp_password`) they are all
61read-only property attributes, i.e. attributes with a getter method
62only. These properties are computed dynamically and can't be set.
63Most of them return data derived from the ``studycourse`` subobject.
64
65The **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
76  A very powerful Zope Schema field is `Choice`. Choice fields are
77  constrained to values drawn from a specified set, which can be
78  static or dynamic. This set can be a simple list of choices (=
79  `values`), a `vocabulary` or a `source` which produce dynamic
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.
84  In Kofa we use both. Common to both is, that a set of values is
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
96The **third part** of the interface lists the methods which can be
97applied to student objects.
98
99`IUGStudentClearance`
100---------------------
101
102Much like all the following student interfaces,
103`waeup.kofa.students.interfaces.IUGStudentClearance` describes an
104additional set of schema fields which are exclusively used on form
105pages. They do not play any role beyond that purpose. Any kind of
106schema field can be safely added in customized versions of these
107interfaces to meet the conditions of the university's matriculation
108process. Also `date_of_birth` and `nationality` are not used in the
109base package for further data processing which means, there is no
110dependency on these two parameters. Attention: This might be
111different in customized versions of Kofa. Some views might use these
112parameters to restrict access or make actions (e.g. payment of items)
113conditional 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
119clearance data. The corresponding attribute is automatically set by
120workflow transitions to lock or unlock the edit form page
121respectively. The attribute can also be set by officers via the
122manage form page to lock or unlock the page manually.
123
124`officer_comment` is usually edited by clearance officers when
125rejecting clearance previously requested by the student. The
126attribute contains the message which informs the student about the
127reasons of rejection. The attribute is cleared after final
128clearance. The message can be also found in ``students.log``.
129
130Both `clearance_locked` and `officer_comment` are controlled by
131workflow transitions not by states, see below.
132
133`IPGStudentClearance`
134---------------------
135
136Most universities acquire different data from undergraduate (UG) and
137postgraduate (PG) students. The forms vary widely. Therefore Kofa
138offers a second interface for acquiring PG clearance data. In the
139base package `IPGStudentClearance` inherits from the
140`IUGStudentClearance` interface. The additional `employer` field in
141the 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
150additional set of personal student data which are permantly editable
151by students. The set usually contains further contact data and
152information about the student's relatives.
153
154.. literalinclude:: ../../../../src/waeup/kofa/students/interfaces.py
155   :pyobject: IStudentPersonal
156
157Kofa provides a mechanism which ensures that personal data are being
158kept up to date. Students are regularly requested to update the
159personal data directly after login. The personal data expire 180
160days after saving the data for the last time which is stored in the
161`personal_updated` attribute. Then the `personal_data_expired`
162property returns ``True`` and the student is redirected to the
163personal data edit page when logging in.
164
165`IStudentNavigation`
166--------------------
167
168See docstring.
169
170.. literalinclude:: ../../../../src/waeup/kofa/students/interfaces.py
171   :pyobject: IStudentNavigation
172
173Student Study Course
174====================
175
176All data related to an individual course of study are stored with
177the ``studycourse`` object. This container object is an instance of
178the `StudentStudyCourse` class which implements
179`waeup.kofa.students.interfaces.IStudentStudyCourse`,
180`waeup.kofa.students.interfaces.IStudentNavigation` and
181`waeup.kofa.students.interfaces.IStudentStudyCourseTranscript`. The
182latter does not add further behaviour to our classes but is needed
183for 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
191All attributes are read-only property attributes which are computed
192dynamically.
193
194The first schema field is a `Choice` field which allows values from
195the `CertificateSource`. The source provides all certificates stored
196in the portal. This way, `StudentStudyCourse` objects point to
197exactly one `Certificate` object in the portal. If the certificate
198is removed, an event handler takes care of clearing also all
199referring `certificate` attribute. The tokens of the
200`CertificateSource` are the certicate codes which means, that in
201forms and import files the unique code must be given and the desired
202`Certificate` object will be stored.
203
204The interface has two entry parameter fields. `entry_mode` stores
205the study mode of the programme and `entry_session` the academic
206year when the study course was started. Usually these parameters are
207fixed and must not be changed during course of study.
208
209Very important - or even most important - are the parameters which
210describe 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)
213declare precisely in which academic session and how successfully the
214student has reached the current study level and state in the portal.
215All these attributes are set automatically by the portal und must
216(normally) not be changed via manage form pages or import.
217
218What 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
220verdict tells the portal, if the student has successfully completed
221an academic session or not. Depending on the verdict, the student
222will be either allowed to proceed to the next study level or forced
223to repeat the current level. Without a verdict, the student gets
224stuck and cannot even pay school fees for the next academic year.
225This 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
236progress achieved at that level. In Kofa study levels range from 100
237to 900. There are two additional levels: a pre-studies level (10)
238and a special postgraduate level (999). There are also two probation
239levels per regular study level. Level 120, for instance, means level
240100 on second probation. See `complete numbering of study levels
241<https://kofa-demo.waeup.org/sources#collapseStudyLevels>`_ in the
242base package.
243
244`StudentStudyLevel` instances are container objects which contain
245course tickets. We therefore sometimes speak of a level course list
246instead of a study level. The study level stores and provides the
247information when (`validation_date`) and by whom (`validated_by`)
248the 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
255fly to give an overview of the courses taken. These read-only
256property 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
259latter two are not listed in the attributes section of the interface,
260but as read-only schema fields further below. This is a trick which
261we used to properly display these fields on some display pages and
262pdf slips. However, the `attrs_to_fields` function explicitly
263excludes them when starting the portal, so that these fields are not
264used for persistent storage of same-named attributes in the database.
265
266The property attribute `course_registration_allowed` determines
267whether course registration has ended. In the base package students
268can proceed if they have paid late registration fee. The conditions
269for course registration can be configured in custom packages.
270
271`ICourseTicket`
272---------------
273
274Course tickets allow students to attend a course. Lecturers can
275enter scores at the end of the term. A `CourseTicket` instance
276contains a copy of the original `Course` and `CertificateCourse`
277data. If the courses and/or the referring certificate courses are
278removed, the corresponding tickets remain unchanged. So we do not
279need any event triggered actions on course tickets.
280
281The `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
288The quite long list of schema fields pretends that form pages may
289provide these fields for editing. This is not the case. Except for
290`score`, all these fields are 'for display' only. They can neither
291be changed through the UI nor by batch processing (import). They are
292solely meant for backing up the orginal course data. See also
293:ref:`course_ticket_processor`.
294
295.. note::
296
297  It may happen that a course has been accidentally misconfigured, for
298  example the number of credits was set too high. The course object
299  can be corrected, but, course tickets, which refer to this course,
300  can not. They are neither adjusted automatically nor changeable by
301  the batch processor. The only solution to 'adjust' course tickets is
302  to replace them by new tickets.
303
304Student Payment
305===============
306
307`IStudentOnlinePayment`
308-----------------------
309
310`IStudentOnlinePayment` instances are called student payment tickets
311or sometimes only payments. They contain the data which confirm that
312the student has paid a specific fee.
313`waeup.kofa.students.interfaces.IStudentOnlinePayment` inherits from
314`waeup.kofa.payments.interfaces.IOnlinePayment` and has only two
315additional schema fields: `p_current` and `p_level` which are
316student-specific. It also promises three additional methods which
317process student data after successful or approved payment.
318
319.. literalinclude:: ../../../../src/waeup/kofa/students/interfaces.py
320   :pyobject: IStudentOnlinePayment
321
322Student Accommodation
323=====================
324
325`IBedTicket`
326------------
327
328A bed ticket confirms that a bed space in a hostel has been
329allocated to the student for the period of an academic session
330(`booking_session`). The `bed_coordinates` specify which bed space
331has been booked. Sometimes this value is too cryptic and
332inappropriate to guide the student to the bed space. The
333`display_coordinates` property can be used to 'translate' the
334coordinates and display a customary description of the bed space.
335Much like some study level attributes, also `display_coordinates` is
336defined as a read-only schema field in order to automatically
337display the field on form pages. It is excluded by the
338`attrs_to_fields` function and thus not stored in the database.
339
340.. literalinclude:: ../../../../src/waeup/kofa/students/interfaces.py
341   :pyobject: IBedTicket
342
343.. _zope schema: http://docs.zope.org/zope.schema
Note: See TracBrowser for help on using the repository browser.