Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hisptz/dhis2-tracker-data-sync

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hisptz/dhis2-tracker-data-sync

A script to sync tracker data from one DHIS2 instance to another

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by300%
Maintainers
4
Weekly downloads
 
Created
Source

Tracker Data Sync Script

Introduction

This script simplifies transferring of DHIS2 tracker data from one instance to another. It utilizes queuing to ensure the download and upload processes are independent of each other.

Requirements

To run this script you must have

  • Node v18 or above

Installation

To install the script run:

npm -g install @hisptz/dhis2-tracker-data-sync

or with yarn

 yarn global add @hisptz/dhis2-tracker-data-sync

Setting up

To use the script you first need to setup the configuration. There are 2 ways to configure the script;

Environment variables

You can have an .env file on the working directory (Directory in which you will run the script). Then environment file should contain the following variables;

# Source DHIS2 connection
SOURCE_DHIS2_BASE_URL=""
SOURCE_DHIS2_USERNAME=""
SOURCE_DHIS2_PASSWORD=""

# Destination DHIS2 connection
DESTINATION_DHIS2_BASE_URL=""
DESTINATION_DHIS2_USERNAME=""
DESTINATION_DHIS2_PASSWORD=""

# How long should the script wait before timing out the download request
DOWNLOAD_TIMEOUT=10000
# How long should the script wait before timing out the upload request
UPLOAD_TIMEOUT=10000

# Program of the data you want to sync (It should be the same for source and destination)
PROGRAM_ID=""
# Parent organisation unit of all orgunits you want to sync (Shoud be the same for source and destination)
ORGANISATION_UNIT_ID=""

# Allow sending of notifications when the script is done
ENABLE_NOTIFICATIONS=
# Subject of the summary email
EMAIL_SUBJECT=
# Recipient of the emails (Should be a JSON serializable email)
EMAIL_RECIPIENTS=["example@org.com"]
# SendGrid key to use when sending email
SENDGRID_API_KEY=
# Email from which the summary should look like it originates from
EMAIL_FROM_EMAIL=
# Name of the sender 
EMAIL_FROM_NAME=

You can also have a config.json file with the configuration. You will have to provide its absolute value when you're running the script.

{
  "source": {
    "username": "<username>",
    "password": "<password>",
    "baseURL": "http://baseurl"
  },
  "destination": {
    "username": "<username>",
    "password": "<password>",
    "baseURL": "http://baseurl"
  },
  "flowConfig": {
    "downloadTimeout": 10000,
    "uploadTimeout": 10000
  },
  "dataConfig": {
    "program": "<programID>",
    "organisationUnit": "<parent-org-unit-id>"
  },
  "notificationConfig": {
    "enabled": true,
    "emailSubject": "Data Sync Summary",
    "recipients": [
      "admin@example.com"
    ],
    "sendGridKey": "SG.VXXXXXXXX",
    "from": {
      "name": "Tracker Data Sync Script",
      "email": "admin@example.org"
    }
  }
}

Running

To run the script, run;

tracker-data-sync sync 

If you are using a JSON config file then run;

tracker-data-sync sync --config /absolute/path/of/json/config

You can also run;

tracker-data-sync sync --help

For a list of further configurations.

FAQs

Package last updated on 16 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc