Proposed Spec Doc for Survey Package Expansion

This document is intended to foster community discussion about the best ways to expand the survey package to make it more fully meet the needs of the community, as expressed in this thread from two weeks ago. Throughout this document I will use the following terms:

The current data model and its shortcomings

The current 4.x based survey module provides a simple and effective way for Admins to collect information from Participants and for Participants to revise their submissions. It permits Admins to read individual responses submitted by Participants and analyze them, which is likely the most effective way to analyze unique answers (i.e. text fields, text areas and file attachments). However, this system leaves much to be desired when it comes to Multiple Choice answer as well as Dates. Although it permits downloading information (through the use of CSV export) to programs such as Microsoft Excel, which will allow the Admin to perform a more sophisticated mathematical analysis of the material, this is not very Admin or Participant friendly. The methods of data analysis are insufficient for large sites where the information collected could not possibly be reviewed by the Admins (due to the sheer volume), or when one wants to provide immediate and useful feedback to Participants about their submissions. We need to improve the Survey package in the following ways:

Sophisticated Analysis of Surveys

In order to think about useful ways to analyzed submitted survey responses, I would like to ask you to consider the following possible uses for the survey module. Although I am sure there are other types of surveys people may want to conduct, I think that you will see that they can be captured by a comprehensive "test scoring system":

  1. Scored Surveys in Online Classroom Use (i.e. DotLRN sites)
  2. Health Tests (similar to Personality Tests)
Feedback for Participants

The Admin should have the ability to determine the amount of information returned to the participant, and at which point in time this information is returned. In purely multiple choice tests, it would be nice to automatically score a test, and return the incorrect responses with an explanation of why their response was incorrect. In written tests we would want to take the submission, and then once the teacher has scored the students work, automatically notify the student, either by sending them the teachers responses with scores or sending them an email message encouraging them to come back to the site and look at the scores as well as teachers comments. In Health surveys it would be nice to automatically respond with statements based on scores in subcategories. If one took a personality test (similar to Health survey) would could return statements based on scores in subcategories, but one might also want to respond with a graph that says the average person that took the test on this website had "x" scores in these categories or something similar. None of this would be new in terms of functionality, but it does mean that we need to have a selective way of determining how response are made.

Integration with other packages

Since I am new to OpenACS I am not intimately familiar with the various ways in which packages can be integrated with one another. However, i am certain that the Survey package should not be dependent on other packages like curriculum, or similar. Thus something like a service contract that can be activated and deactivated (possibly though the use of parameters) seems like the way to go. I would like suggestions on the technical work required to implement this.

Data Model Changes

Since Survey_Sections already exists in the data model, all we need to do is activate this feature (at least in postgresql it is not possible to create mulitple sections for a survey). So categories seem to be taken care of. I have thought long and hard about the Data model changes needed, and think i have come up with a simple non-invasive and elegant solution. Please let me know what you think.

In order to facilitate scores we should add some columns to preexisting tables, and add some new tables and views.

Feedback Within Survey (Technical)

One of the difficulties in providing feedback within survey is that there are a number of different comment types, each of which poses its own set of problems. It would be beneficial to be able to provide feedback in the following ways:

Admins should be able to provide custom feedback to a participant (that only pertains to that participant) on the following acs_objects: The Admin should also be able to pre-define a canned response (or set of responses) for any and all off these objects, and easily assign them to an object and a specific participant. Assigning a canned feedback response to a participant should be able to be accomplished either automatically (in the case where a user gets a multiple choice question with one wrong answer, wrong) or manually through something like a radio list.

Participants should be able to provide feedback (make comments) on any/all of the same acs_objects which the admin allows to be commentable.

The general comments system is insufficient for these purposes because it does not bind a comment to a specific acs_object and acs_user (just to an object). That is why we will need to create a survey specific feedback system. The table survey_scoring_feedback will allow for the creation of canned responses that are bound to any acs_object. This would provide a mechanism for the Admin to bind a canned feedback response to a participant on any and all survey_response objects by selecting that comment and inserting it into the survey_question_responses table. In order to bind feedback to the objects survey or survey_section, we would need a mechanism for knowing that object has been completed by a user... a functionality I would propose that we implement for the reasons listed in the section on binding surveys to objects.

Binding Surveys to Objects (Technical)

In order to facilitate sub-surveys, branching, sequencing, and or integration with other openacs packages, I propose the following. Much like the general comments system allows you to bind a comment to any acs_object, i think it would be wise to allow a survey to be bound to any acs_object. This would provide useful functionality both within survey, as well as for the integration of other packages with survey. The trick here is in conditional binding, what I mean by this is that the survey would only be presented to the user if the object calling it meets a certain set of criteria. The simplest way of doing this is to allow admin to create binding specific sql statements, where, if a row is returned by that statement, the called upon survey is presented. For example, if you bind a survey to a survey_question object, you could do the following:

Original "calling" survey asks the following question (which itself is a survey_question acs_object with the object_id of 12345): Since we have told the object "How many children do you have?" (to be exact the question_id associated with this question) that it is bound to a seperate survey. This could be done as simply as having a field within the survey_questions table, which if null means it is not bound to anything, and if filled with a number means it is bound to a seperate survey with that specific object_id... we can then process the sql statement specified by the Admin which says:
db_0or1row

select * from 
  survey_question_responses sqr, acs_objects obj
where 
    sqr.response_id = obj.object_id
    and sqr.question_id = '12345' (the survey_question object_id that is bound to this subsurvey)
    and obj.creation_user = THE_PARTICIPANTS_USER_ID
    and sql.number_answer > '0'
If we return with no rows the bound surveys "entry" requirements have not been met and we do not present them with it (they must have entered either '0' or null. However, if the user responded with a number which is 1 or greater, we can present them with a survey which asks for the names of their children
This could have uses throughout the ACS toolkit, one could bind downloads the surveys, one could bind, user_comments to surveys, etc. Each acs package that wanted to use surveys would only need to to develop an option to check a table that stores the relation of acs_objects to the surveys they are bound do (and the criteria for presenting these surveys). An object requesting a survey could be required to pass a return_url to that survey, so once it has been completed it could return the user to where they previously had been.

One small problem we could have here is binding a survey to another survey or survey_section... because there currently is no table that stores whether or not a survey or survey_section was completed by a participant, it would be difficult to inform the "bound survey system" when to check whether or not the criteria was met to present a bound survey. It would be easy enough to add a table that announces the completion of a survey or survey_section by a user much like the survey_question_respones table verifies the completion of a single question...

Special thanks to Michael Stiegman for presenting the idea of object bound surveys to me

Sophisticated Survey Templates

Given the various ways in which Survey can be used, it would be a good idea to have a number of new templates to deal with this new functionality, and to make it easier to integrate survey into each developers applications. Something like edit-this-page/templates, each of which can be individual selected based on the use of a particular survey is what i had been thinking about.