Skip to content

DWB-eHealth/dhis2-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 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 duplicated structure)

Dashboard org unit edit

This script allows you to change the organization unit for a set of selected dashboard's items.
The selection is duplicated using a generated UID.
Each item is then listed throught outputs on the user terminal command. Once selected, the item(s) will be submitted for changes.

Changes

Title : the title of the selected item(s) can be replaced to match the new organization unit choice. The three most common titles present in the selection will be displayed for change.
Organization units : one or multiple organization units IDs can be entered by the user to update the selected item from the numbered list.
Position : the position and size of each element remain unchanged after the updates.

After the operation is done, a JSON file is generated in the report folder.

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 (one or multiple)

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