A flexible prompt and user responses data schema utilizing the generic content types
Project description
A flexible prompt and user responses data schema utilizing Django’s content types framework.
This app was born during a university research project. The main use case is data collection. It lets you create numerous kinds of “prompts” (questions or tasks) and record user responses. Prompts can be populated with any kind of database object.
This supports these kind of prompts:
How do you feel today on a 1-5 scale? (Simple likert question)
How do you like {object} on a 1-10 scale? (Object-based likert question)
Which word do you associate with {object}? (Object-based open-ended question)
How related do you think is {object} to these other objects? (Tagging task)
Ratings and tags are simply integer values, their meaning can be defined by your application (e.g. 1 to 5 scales, or -1 = no, +1 = yes, and so on).
Documentation
The full documentation is at https://django-prompt-responses.readthedocs.io.
Quickstart
Install prompt_responses:
pip install django-prompt-responses
Add it to your INSTALLED_APPS:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
...
'prompt_responses',
'sortedm2m', # for the ability to change the order of Prompts in the Django admin
...
)
Create Prompts, e.g. through the integrated admin views.
Deliver a prompt to the user:
prompt = Prompt.objects.get(id=1)
instance = prompt.get_instance()
"""
Use these variables to display the UI:
prompt.type
str(instance)
instance.object
instance.response_objects
"""
Save a user response:
prompt = Prompt.objects.get(id=1)
prompt.create_response(
user=user,
prompt_object=instance.object,
rating=5
)
Analyze data:
prompt = Prompt.objects.get(id=1)
# Mean rating for all responses
rating = prompt.get_mean_rating()
# Mean ratings for all objects
matrix = prompt.get_mean_tag_rating_matrix()
# Mean ratings for one object
ratings = list(prompt.get_mean_tag_ratings(instance.object))
Use the included viewsets in your Django Rest Framework API:
from rest_framework import routers
from prompt_responses.viewsets import PromptViewSet
router = routers.DefaultRouter()
router.register(r'prompts', PromptViewSet)
urlpatterns = [
url(r'^api/', include(router.urls))
]
This offers api/prompts/, api/prompts/<id>/, api/prompts/<id>/instantiate/, api/prompts/<id>/create-response/ (POST) endpoints.
Features
Prompt types
Likert scale ratings
Open-ended free text
Tagging
Populate prompts with objects in order to
let users rate objects from one set
let users rate (tag) relations between two sets of objects
Analytics convenience functions
(Coming soon) Plugable object sampling algorithms
Support for Django Rest Framework
Running Tests
Credits
Tools used in rendering this package:
History
0.1.0 (2017-11-07)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-prompt-responses-0.1.1.tar.gz
.
File metadata
- Download URL: django-prompt-responses-0.1.1.tar.gz
- Upload date:
- Size: 17.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e436b3bf2b24ffa1e9066c289a4cd662855cf2c958f20dd9209967bb439f77e6 |
|
MD5 | 0805d484e9c324231671ce5a5a619abe |
|
BLAKE2b-256 | b9fbd93e253106c7b86096cc10b99077ee55624d1610e67b594db1fbfe80353a |
File details
Details for the file django_prompt_responses-0.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: django_prompt_responses-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 21.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dabbb8a01c94bd978dc37e58191748d09311627a9a0311ce6f4f5b1c50a70345 |
|
MD5 | 444caf7ec8d9c6d04a98602a41a91f15 |
|
BLAKE2b-256 | 7efd819211a59e4f4e82470c1988af9fe2cb495dd83dee2e12be796c0ad8ea5f |