Name

Classlist — A perl module used to extract information from the course's classlists

Description

Classlist files are arbitrarily formatted colon-delimited files, and traditionally scripts would be written which would select fields from this file using magic numbers. This is not self-documenting, and is prone to failure if file formats change.

The goal of this module is to provide an interface to the traditional MFCF-supplied classlists, as well as special course staff and exceptions files, which is not dependent on the particulars of how these files are formatted.

Classlist Fields

The module provides a number of constants, which must be accessed by prepending Classlist:: to the constant names. Some of these correspond directly to classlist fields; others represent a friendly extension of the direct access fields. Some of these explanations are adapted from the classlist man page.

As a user-friendly feature, functions in this module will accept either the constant for a field name (such as Classlist::IDNUM) or a string representation of that field (such as "idnum" or "IDNUM").

Classlist::IDNUM
The 8-digit ID number.
Classlist::USERID
The minimal unique userid, with safety features such as truncatation to 8 characters and lower-case.
Classlist::FULL_USERID
The full userid (can be longer than 8 characters) as read from the classlist file.
Classlist::LECTURE
The lecture(s), comma-delimited, that the individual is associated with.
Classlist::TUTORIAL
The tutorial(s), comma-delimited, that the individual is associated with.
Classlist::PRACTICUM
The practicum(s), comma-delimited, that the individual is associated with.
Classlist::LAB
The lab(s), comma-delimited, that the individual is associated with.
Classlist::TEST
The test writing slot(s), comma-delimited, that the individual is associated with.
Classlist::TYPE
One of student, ta, ia, tutor, isc, instructor.
Classlist::STUDY
The department (sort of) the student is registered in.
Classlist::PLAN
The plan that the student is registered in.
Classlist::GROUP
The faculty the student is registered in.
Classlist::YEAR
The current year the student is registered in.
Classlist::DEGREE
The degree the student is currently registered in.
Classlist::NAME
Full name; family name, comma, remaining names.
Classlist::INITIALS
The given initials of the student.
Classlist::FAMILY
The student's family name.
Classlist::STATUS
R-registered, E-pre-registered, W-withdrawn
Classlist::TIME
P-partime, F-fulltime
Classlist::SESSION
The session that the student is registered in.
Classlist::TERM
The MFCF-style term for which this information was read.

Terms

Many of the functions in this module can operate on particular terms. These terms are to be specified in the MFCF format (see the man page for the TermCode module for details), and any term the class has been offered and for which there is a corresponding .classlist.term file is acceptable.

Alternate classlist files

In addition to the classlist files provided automatically, there are other special files that can be provided to record information for the current term. These files should appear in the root directory of the account; ie, /u/csXXX.

.exceptionlist.term

This file is simply a list of userids for people who aren't officially in the course for the specified term (possibly because of a late add that has not yet registered). Each userid should appear on its own line.

.coursestaff.term

This file specifies course staff for the current term. This could be used to give special priveleges to certain members of course staff, obtain a list of all current TAs easily after initial setup, etc. The file should contain the following colon-delimited fields, one staff member per line:

  • The full userid.
  • The type of staff; one of ta, ia, tutor, isc, instructor.
  • A comma delimited list of the lectures this staff member is affiliated with.
  • A comma delimited list of the tutorials this staff member is affiliated with.
  • A comma delimited list of the labs this staff member is affiliated with.
  • A comma delimited list of the practicums this staff member is affiliated with.

Provided functions

The following functions are available for export from the module.

read_term_files(term, ...)
Returns a classlist reference given the contents of the classlist, exceptionlist, and coursestaff files for the specified terms.
read_classlist_files(term, ...)
Returns a classlist reference given the contents of the classlist files for the specified terms.
read_exceptionlist_files(term, ...)
Returns a classlist reference given the contents of the exceptionlist files for the specified terms.
read_coursestaff_files(term, ...)
Returns a classlist reference given the contents of the coursestaff files for the specified terms.
make_safe_userid(userid)
A convenience function which returns the userid truncated to 8 characters and converted to lowercase.
filter_classlist(clref, field, regex)
This function takes as arguments a classlist reference, a field to filter on, and a regular expression to apply to that field. It returns a classlist reference containing only those elements in the specified field which match the regular expression.
dump_fields(src_val, src_field, dest_fields, isregex?, clref)
Takes a value to match for a source field, the source field to match, a reference to an array of destination fields, a boolean that is true is src_val is a regular expression, and a classlist reference. For all entries whose src_field matches src_val, print them one per line, where each line consists of the values of each of the dest_fields, colon-delimited.
Topic revision: r1 - 2016-01-11 - YiLee
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback