Skip to content
/ duva Public

API Application that provides the ability to export XLSForm Data from an Onadata server or CSV File to a Hyper file database

License

Notifications You must be signed in to change notification settings

onaio/duva

Repository files navigation

Duva

Build Status

Duva is an API built using the FastAPI framework that provides functionality to create & periodically update Tableau Hyper databases from CSV files. Currently the application supports connection to an OnaData server from which it'll pull data from an XLSForm and periodically export to a Tableau Hyper database

Requirements

  • Python 3.6+
  • Redis

Installation

Via Docker

The application comes with a docker-compose.yml file to facilitate easier installation of the project. Note: The docker-compose.yml file is tailored for development environments

To start up the application via Docker run the docker-compose up command.

Alternative Installation

  1. Clone repository
$ git clone https://github.com/onaio/duva.git
  1. Create & start a virtual environment to install dependencies
$ virtualenv duva
$ source duva/bin/activate
  1. Install base dependencies
$ pip install -r requirements.pip
  1. (Optional: For developer environments) Install development dependencies.
$ pip install -r dev-requirements.pip
  1. Create postgres user & database for the application
$ psql -c "CREATE USER duva WITH PASSWORD 'duva';"
$ psql -c "CREATE DATABASE duva OWNER duva;"

At this point the application can be started. Note: Ensure the redis server has been started

$ ./scripts/start.sh

Configuration

The application can be configured either by manual editing of the app/settings.py file or via environment variables i.e export APP_NAME="Duva". More information on this here

API Documentation

Documentation on the API endpoints provided by the application can be accessed by first running the application and accessing the /docs route.

Testing

This project utilizes tox for testing. In order to run the test suite within this project run the following commands:

$ pip install tox
$ tox

Alternatively, if you'd like to test the application with only the python version currently installed in your computer follow these steps:

  1. Install the developer dependencies
$ pip install -r dev-requirements
  1. Run the test suite using pytest
$ ./scripts/run-tests.sh

OR

$ PYTHONPATH=. pytest -s app/tests

FAQ

  1. How do I access the shell for the application ?

The application shell can be accessed via python3. You can import the crud module to perform any C.R.U.D(Create, Read, Update & Delete) actions on the models

  1. What handles the authentication ?

Authentication is handled via the functions in app/api/auth_deps.py. The onadata module contains a helper class used to keep OAuth2 Credentials valid.

  1. How do I go about adding an extra field in responses ?

All responses returned by the application are managed using pydantic schemas. In case you'd like to modify a response ensure the field exists in the model and update the schemas module

About

API Application that provides the ability to export XLSForm Data from an Onadata server or CSV File to a Hyper file database

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages