dhis2-python: integration client for dhis2
Requirements: Python 3.8+
Quickstart
Install using pip:
$ pip install dhis2
This will install the dhis2 command in your local environment (installing into a virtual environment recommended).
The tool supports a pluggable architecture, but the core supports:
- Inspecting dhis2 instances
dhis2 -i inventory.yml inspect host-id/group-id
- Extracting mCSD and SVCM compatible payload, and pushing those to a FHIR compliant server
dhis2 -i inventory.yml facility-list mcsd mcsd-config.ymldhis2 -i inventory.yml code-list svcm svcm-config.yml
- Extract ICD 11 (MMS)
LinearizationEntitiesas DHIS2 Option Setsdhis2 -i inventory.yml code-list icd11 <icd11-host> --root-id <X>
- Extract ICD 10
ICD10Entitiesas DHIS2 Option Setsdhis2 -i inventory.yml code-list icd10 <icd10-host> --root-id <X>- Please be aware that the icd11 docker image does not include the icd10 code lists, so you have to use the public instance which requires API keys
- Extract Individual Case Safety Reports E2B (R2) XML from DHIS2 instances that have installed the WHO AEFI package
(see description of formats below)
As of now, we do not support sending data to dhis2, only extraction is supported.
Formats
Inventory
The inventory is where you will store all your services, and various groupings you might find useful (most commands will only work on single sources/targets though, with the exception of the inspect command currently)
The basic format is as follows
hosts:
playdev:
type: dhis2
baseUrl: https://play.dhis2.org/dev
username: admin
password: district
playdemo:
type: dhis2
baseUrl: https://play.dhis2.org/demo
auth:
default:
type: http-basic
username: admin
password: district
fhirdemo:
type: fhir
baseUrl: http://localhost:8080/baseR4
icd11local:
type: icd11
baseUrl: http://localhost:8888
icd11official:
type: icd11
baseUrl: https://id.who.int
headers:
Authorization: Bearer YOUR_TOKEN
icd10official:
type: icd10
baseUrl: https://id.who.int
headers:
Authorization: Bearer YOUR_TOKEN
groups:
dhis2:
- playdev
- playdemo
The keys of the hosts and groups block will be used to identifiy targets when using the dhis2 commands.
Please note that:
- Currently only
http-basicis supported for dhis2 - For fhir no authentication is supported (coming soon)
mCSD / SVCM configuration
Both mCSD and SVCM currently has the exact same format so we will describe them together. You will need a source host, target host (or some other target) and a set of filters if desired.
Basic format
source:
id: playdev
target:
id: fhirdemo
This configuration would simply take all org unit or option sets inside of dhis2 and push them to a fhir instance.
If you would want to store the result instead, you can use the log:// target
source:
id: playdev
target:
id: log://
(this is also the default if no target is given)
Individual Case Safety Reports E2B (R2) configuration
Extract of E2B R2 compatible XML is now supported in the tool. To use it, you will need a connection to a dhis2 instance with the DHIS2 WHO AEFI program, and for now only individual tracked entities can be extracted (more flexible query mechanism is coming)
Basic dhis2 config
hosts:
d2aefi:
type: dhis2
baseUrl: https://dhis2-instance.com
username: username
password: password
Example command for extracting E2B XML
dhis2 -i inventory.yml e2b d2aefi --tracked-entity some-te-uid
Metadata
Release files for dhis2 0.7.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dhis2-0.7.5.tar.gz | 24.5 kB | Without provenance | Details for dhis2-0.7.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dhis2-0.7.5-py3-none-any.whl | Python 3 | none | any | Details for dhis2-0.7.5-py3-none-any.whl |
Total release size: 57.1 kB
Release files / dhis2-0.7.5.tar.gz
| Download URL | dhis2-0.7.5.tar.gz |
|---|---|
| Size | 24.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1860fa31dc811c8d52a8bf87452a53505faae6e0c57fabaaaf83c2b913a4564d
|
|
BLAKE2b-256 checksum How to use checksums |
0cf7b05ead6d3a02d0384e3701749bdbd9112dbff8bda0913af5bbfe57f3a80a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.5 CPython/3.9.2 Darwin/20.3.0
|
Release files / dhis2-0.7.5-py3-none-any.whl
| Download URL | dhis2-0.7.5-py3-none-any.whl |
|---|---|
| Size | 32.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c3b42752833ec3e17fb0f9c05b90025809406765437e7fa9b42efda5f6e9eb1d
|
|
BLAKE2b-256 checksum How to use checksums |
24a1c5fe47c0cb323016be0b4e0be267441879efb152a93d392175fb4a1c6799
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.5 CPython/3.9.2 Darwin/20.3.0
|
Security for dhis2 0.7.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.