A package for OpenACS 4.6
The Big Idea
We want to be able to survey users. We want a non-technical person to
be able to design surveys from HTML forms. We want someone who is not
a site-admin to be able to review answers (we just give them admin
over the survey package.)
Survey Question Possibilities
Each survey question specifies an abstract data type for responses:
Each survey also specifies a presentation type:
- shorttext (less than 4000 characters)
- textarea (size can be specified in
- select (from a fixed set of options in
- radio (from a fixed set of options in
- checkbox (from a fixed set of options in
The data model
We use the following tables:
The philosophy about storing the users responses is to use one single table to store all responses, i.e., we do not create a new table
when we create a new survey. In order to make it possible to store all
kinds of data in one table, we give the
survey_questions -- questions for each survey
surveys -- specs for one survey form (except the
survey-sections allows for future development of
branched or multi-part surveys
survey_responses -- user responses to surveys
survey_question_responses -- user responses to
individual questions within a survey
survey_question_responses table five columns.
Only one of the columns will be not-null.
-- if the user picked a canned response
choice_id references survey_question_choices,
boolean_answer char(1) check(boolean_answer in ('t','f')),
attachment_answer integer references cr_revisions(revision_id)
Why the CLOB in addition to the varchar? The CLOB is necessary when
people are using this system for proposal solicitation (people might
type more than 4000 characters).
NOTE: Postgresql uses a text column in place of CLOB.
Attachment_answer allows for uploaded files to be stored in
The user interface for creating a survey is as follows:
- User creates a survey, giving it a name and a description.
- User adds questions one by one, and is given the opportunity to reorder questions.
- To add a question, user first types in the question and selects
its presentation type (radio buttons, checkbox, text field, etc.).
- Then the user is given the opportunity to specify further
attributes for the question depending upon the presentation type that
was chosen. For instance, any "choice" presentation (radio buttons,
checkboxes, and select lists) require a list of choices. A text field
requires the user to specify an abstract data type and the size of the