Skip to content

DWB-eHealth/dhis2-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Configuration

Python : version 3.14
Install registered requirements using pip install -r requirements.txt
Rename the .env.example file, .env

Env file

DHIS2_BASE_URL="http://dhis.com/api"
DHIS2_USERNAME="username"
DHIS2_PASSWORD="password"
REPORTS_DIRECTORY ="./reports"
CASE_NUMBER_COLUMN_ID =""

List of requirements

  • blinker==1.9.0
  • certifi==2026.1.4
  • charset-normalizer==3.4.4
  • click==8.3.1
  • colorama==0.4.6
  • et_xmlfile==2.0.0
  • idna==3.11
  • itsdangerous==2.2.0
  • Jinja2==3.1.6
  • MarkupSafe==3.0.3
  • numpy==2.4.2
  • openpyxl==3.1.5
  • packaging==26.0
  • python-dateutil==2.9.0.post0
  • python-dotenv==1.2.1
  • requests==2.32.5
  • six==1.17.0
  • tzdata==2025.3
  • urllib3==2.6.3
  • Werkzeug==3.1.5

Scripts index

Clone dashboard
Dashboard_org_unit_edit
Edit event
Tracked entity instance report

Clone dashboard

Cloning a dashboard requires two login credentials.
Once the identifies for each dashboard are entered, the content of the first one will be copied and transferred to the second. If the destination dashboard is not empty, a message will appear offering you the option to cancel the operation or add the elements from the source dashboard to the bottom of the destination dashboard.
If the destination dashboard is empty, it will be structured in the same way as the source dashboard, including the position and size of the elements.
A JSON file for the cloned dashboard is created after this operation.
! Some types of elements cannot be copied in their entirety, including informational items.

Required inputs

  • Source dashboard ID (dashboard to clone)
  • Destination dashboard ID (dashboard receiving the copied content)

Dashboard org unit edit

This script allows you to modify the organization units of the elements displayed on a dashboard.
Each item is associated with a numbered list. Once selected by the user, the elements will be duplicated, and their copies will receive the identifier of the entered organizational unit. The position and size of each element remain unchanged.
The title of the selected set of elements can be modified from a list of the three most common titles. These titles can then be adapted to the newly entered organizational unit.
After the operation is done, the new version of the dashboard will be exported as a JSON file.

Required inputs

  • Dashboard ID
  • Items on which the organisation unit will be changed (one, multiple, or all)
  • New item title changes (not required)
  • New organisation unit

Edit event

An event value can only be changed if the condition entered as an input is true.
As a result, an xlsx file will be created displaying the old and new values for the event along with its ID and the data element ID.

Required inputs

  • Organisation unit ID
  • Data element ID
  • Event ID
  • Condition to meet
  • New value

Tracked entity instance report

This report is made to assess the programs in which the patient is admitted and discharged the same day. It will compare the date of the first and last event for each tracked entity instance within a date range. To check if the patient has been discharged the same day as his admission, the script will provide an xlsx file displaying the tracked entity instance attributes and a status.

Required inputs

  •    Program ID
  •    Organisation unit ID
  •    Date of the enrollment
  •    Date of the last registered event
  •    Data element ID (one or multiple)

Available status

Same admission and discharge date

Discharge date different from admission date

Admission date registered after discharge date

Missing data

The report is provided with required columns, including

  •    ID
  •    Case number
  •    Organisation unit
  •    Admission and discharge result

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages