npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@hisptz/dhis2-tracker-data-sync

v1.0.3

Published

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

Downloads

7

Readme

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=["[email protected]"]
# 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=

JSON config file (Recommended)

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": [
      "[email protected]"
    ],
    "sendGridKey": "SG.VXXXXXXXX",
    "from": {
      "name": "Tracker Data Sync Script",
      "email": "[email protected]"
    }
  }
}

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.