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

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

Restructure student section documentation.

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