cybertools/knowledge/survey
2013-02-24 16:22:54 +01:00
..
__init__.py new knowledge.survey (questionnaire) package 2013-01-16 08:38:34 +01:00
interfaces.py avoid leaking of attributes to subclasses: put in constructor instead of class 2013-02-24 16:22:54 +01:00
questionnaire.py avoid leaking of attributes to subclasses: put in constructor instead of class 2013-02-24 16:22:54 +01:00
README.txt add alternative algorithm with grouped questions and feedback items per question group 2013-02-24 11:10:44 +01:00
tests.py new knowledge.survey (questionnaire) package 2013-01-16 08:38:34 +01:00

==========================
Surveys and Questionnaires
==========================

Let's first set up a  questionaire.

  >>> from cybertools.knowledge.survey.questionnaire import Questionnaire, Question
  >>> quest = Questionnaire()

  >>> qu01 = Question(quest)
  >>> qu02 = Question(quest)
  >>> qu03 = Question(quest)


Question-related Feedback Items
===============================

We now assign result elements with the questions of this questionnaire.

  >>> from cybertools.knowledge.survey.questionnaire import FeedbackItem
  >>> fi01 = FeedbackItem('fi01')
  >>> fi02 = FeedbackItem('fi02')
  >>> fi03 = FeedbackItem('fi03')

  >>> qu01.feedbackItems = {fi01: 0.8, fi03: 0.2}
  >>> qu02.feedbackItems = {fi01: 0.3, fi02: 0.7, fi03: 0.1}
  >>> qu03.feedbackItems = {fi01: 0.2, fi03: 0.9}


Responses
---------

  >>> from cybertools.knowledge.survey.questionnaire import Response
  >>> resp01 = Response(quest, 'john')

  >>> resp01.values = {qu01: 2, qu02: 1, qu03: 4}

Now let's calculate the result for resp01.

  >>> res = resp01.getResult()
  >>> for fi, score in res:
  ...     print fi.text, score
  fi03 4.1
  fi01 2.7
  fi02 0.7


Grouped Feedback Items
======================

  >>> from cybertools.knowledge.survey.questionnaire import QuestionGroup
  >>> qugroup = QuestionGroup(quest)
  >>> quest.questionGroups.append(qugroup)
  >>> qugroup.questions = [qu01, qu02, qu03]
  >>> qugroup.feedbackItems = [fi01, fi02, fi03]

  >>> res = resp01.getGroupedResult()
  >>> for fi, score in res:
  ...     print fi.text, round(score, 2)
  fi02 1.17