Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Python JavaScript HTML

This branch is 189 commits ahead of dimagi:master

Merge pull request #31 from caktus/feature/fragile-char-counter

Make character counter a bit more robust
latest commit 1540c763dc
@vkurup vkurup authored
Failed to load latest commit information.
decisiontree Make character counter a bit more robust
docs Limit line length in documentation
requirements Add celery to test requirements
.coveragerc Update README
.gitignore Ignore .swp and .swo files
AUTHORS Add authors list and license. Include PyPi classifiers and remove dis…
LICENSE.txt Remove year from license Add authors list and license. Include PyPi classifiers and remove dis…
README.rst Feedback from @vkurup
setup.cfg Remove South migrations Install django-colorful
tox.ini Feedback from @vkurup



This application is a generic implementation of a decision tree, which is completely database-configurable. Users are asked questions and respond via SMS messages using the RapidSMS framework built on top of Django.

The original code for this application was written by Dimagi and is currently packaged and maintained by Caktus Consulting Group, LLC.


rapidsms-decisiontree-app is tested on RapidSMS 0.19, Django 1.7, and Python 2.7. There is optional support for django-celery.


  • Support for sessions (i.e. 100 different users can all go through a session at the same time)
  • Branching logic for the series of questions
  • Tree visualization
  • Errors for unrecognized messages (e.g. 'i don't recognize that kind of fruit') and multiple retries before exiting the session


The latest stable release of rapidsms-decisiontree-app can be installed from the Python Package Index (PyPi) with pip:

pip install rapidsms-decisiontree-app

Once installed you should include 'decisiontree' in your INSTALLED_APPS setting.


You'll need to create the necessary database tables:

python migrate decisiontree

At this point data can only be viewed/changed in the Django admin. If you want to enable this on the front-end you can include the decisiontree.urls in your root url patterns.

urlpatterns = [
    url(r'^surveys/', include('decisiontree.urls')),

See the full documentation for additional configuration options.

Running the Tests

Test requirements are listed in requirements/tests.txt file in the project source. These requirements are in addition to RapidSMS and its dependencies.

After you have installed 'decisiontree' in your project, you can use the Django test runner to run tests against your installation:

python test decisiontree decisiontree.multitenancy

Minimal test settings are included in decisiontree.tests.settings; to use these settings, include the flag --settings=decisiontree.tests.settings.

To easily run tests against different environments that rapidsms-decisiontree-app supports, download the source and navigate to the rapidsms-decisiontree-app directory. From there, you can use tox to run tests against a specific environment:

tox -e python2.7-django1.7.X

Or omit the -e argument to run tests against all environments that rapidsms-decisiontree-app supports.

To see the test coverage you can run:

coverage run python test decisiontree decisiontree.multitenacy
coverage report -m

A common .coveragerc file is include in the repo.

Something went wrong with that request. Please try again.