Development

Follow instructions in Installation, but install it with additional --dev -e . flag:

pipenv install --ignore-pipfile --dev -e .

Entry point for the code is at __main__.py.

Testing

pytest is used for Unit testing.

pipenv run python setup.py test

Profiling

To run profiles with cProfile (50.000 ODK records) and /usr/bin/time (10.000 ODK records), run:

pipenv run python setup.py profile

Debugging

In order to debug the module, you can create a file called debug.py next to __main__.py (with same code content) and create a debug profile in PyCharm like this:

_images/debug_config_pycharm.png

Releasing

  • Use Semantic Versioning:

    “Consider a version format of X.Y.Z (Major.Minor.Patch). Bug fixes not affecting the API increment the patch version, backwards compatible API additions/changes increment the minor version, and backwards incompatible API changes increment the major version.”

    https://semver.org

Commandline interface

  • delete ALL events (asks first)
  • export program metadata w/ dependencies
  • print error categories (exceptions)
pipenv run smartva-dhis2-cli --help
usage:

--delete_events       Delete all events
--download_program_metadata
                      Download DHIS2 program metadata
--print_error_categories
                      Print error categories inserted into the database

Updating Documentation

  • add RestructuredText files (like this one) to docs and link them in index.rst
  • pipenv shell, then cd docs and finally make html