Survey Designer is an application that allows users in the field to build surveys in a fast and easy way while giving them the flexibility to make necessary adjustments while also maintaining WFP standard labeling & naming conventions. This is to improve the overall data quality when it comes to survey design, data collection & analysis (saving time and resources) as well as allowing for reproducibility and sharing resources between users. This tool is targeted for users that are using XLSForm or ODK-based tools (such as: MoDa or Kobo).
The application's frontend is designed as a decoupled solution from the backend.
- Authentication: The login process is managed securely via Keycloak.
- Localization: Multi-language support is handled locally, based on translation files located directly within the frontend part of the repository.
- PostgreSQL - Main datastore
- Redis - Caching
- Python 3.11
- poetry - python package manager
- Docker
Some environment variables are required in order to run the application. Use
.env.sample as template to create an .env file (it will be used by the
django settings thanks to python-dotenv).
Example when running in a local environemnt:
# Django
DJANGO_SETTINGS_MODULE="wfp.settings"
SECRET_KEY='django-insecure-=!&_i6qv%8pd!l7-+d=2&-s(bu=h5pc*!^&3)c^4wc)iz8d7*3'
DEBUG=True
ALLOWED_HOSTS='domain.org;localhost;127.0.0.1'
CORS_ALLOWED_ORIGINS='http://domain.org;http://localhost:3000'
# ENV types: local, ci, dev, qa, prod
ENV=local
# Database
POSTGRES_USER=postgres
POSTGRES_DB=app_db
POSTGRES_HOST=postgres
POSTGRES_PASSWORD=r00t
POSTGRES_PORT=5432
# Redis cache
REDIS_URL=redis://redis:6379/0
# Sentry
SEND_TO_SENTRY=false
SENTRY_DSN=""
SENTRY_SAMPLE_RATE=0.001
# Upload to S3
UPLOAD_TO_S3=False
#email
EMAIL_HOST=""
EMAIL_HOST_USER=""
EMAIL_HOST_PASSWORD=""
#auth
OIDC_CLIENT_ID=""
OIDC_CLIENT_SECRET=""
- Configure Postgres and redis then update the .env file to point to the correct servers.
- Run
pnpm installto install node packages. - Run
pnpm devto start frontend dev server. - Run
pnpm buildto build packages for production. - Run
poetry installto create a virtualenv and install all requirements. - Run
poetry run maketo start the application. Or you can use the django runserver if you prefer, just remember to runmake migratefirst. - Run
poetry run make testto run tests. - Run
pre-commit installto install pre-commit hooks.
- Run
docker compose up --build. This will build and start the server. - If
DEBUGisTruethen runpnpm dev. This will build and start the frontend. - Navigate to
http://localhost:8080to view the site.
With the container running
- Add the translation key and text inside:
survey_designer/apps/frontend/src/public/locales/en/translations.json - run
pnpm run translate- This translates the files into all supported languages and creates a production build. - Start the Docker container.
docker compose up -d - run
docker exec -it surveydesigner-api-1 make collectstatic- Enter the containers shell - inside the container run
python manage.py collectstatic- This collects all the static files (dist folder we just created) and stores them in the root static folder. - Start the Vite Frontend
pnpm run dev