Skip to content

It is scipt for generating Primary and Secondary UIC

Notifications You must be signed in to change notification settings

hisptz/lodiis-uic-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License: GPL v3 Commitizen friendly

LODIIS UIC GENERATOR

  1. Introduction

  2. Pre-requiestes

  3. Get started with app

    3.1. Installations

    3.2. Configuration

    3.2.1. App configuration

    3.2.2. Metadata configuration

  4. Operations of script

    4.1. Generate

    4.1.1. Generate for all data

    4.1.2. Generate UIC for beneficiary updated in a specific time 4.2. Auto 4.3. Update status

1. Introduction

Node script app for generating Unique Identifier Code(UIC) for AGYW, Caregiver and OVC in KB Lesotho instance.

2. Pre-requiestes

- Node 10+
- npm 6+
- git

3. Get started with app

3.1. Installations

Clone the app and install all app dependencies

git clone https://github.com/hisptz/lodiis-uic-generator.git
cd lodiis-uic-generator
npm install

3.2. Configuration

There are two configurations to be done for the smooth generation of UICs for the benefeciaries in KB Lesotho DHIS2 instance, which are app and metadata configurations.

3.2.1. App configuration

It includes configurations for connection between script to DHIS2 instance. This configuration is in config directory, create file and save as server-config.js , its contents as in server-config.example.js file within config directory. See below sample

const sourceServer = {
  url: 'url_to_dhis_instance',
  username: 'username',
  password: 'password',
};

module.exports = {
  sourceServer,
};

3.2.2. Metadata configuration

It includes configuration to set metadata ids for the fields and programs which are required. This configuration is in config directory, create file and save as metadata-config.js , its contents as in metadata-config.example.js file within config directory. See below sample

const programTypes = {
  caregiver: "CG",
  ovc: "OVC",
  dreams: "DRM",
  bursary: "BUR",
  lbse: "LB",
};

const metadata = {
  firstname: "<firstname_metadata_id>",
  surname: "<surname_metadata_id>",
  primaryUIC: "<primaryUIC_metadata_id>",
  secondaryUIC: "<secondaryUIC_metadata_id>",
  age: "<age_metadata_id>",
};

const programs = [
  {
    id: "<program-id>",
    type: "<program-type-as-referred-above>", // programTypes.bursary,
    isChild: "<true_if_it_is_child_and_false_if_not>",
  },
  {
    id: "<program-id>",
    childProgram: {
      id: "<id_of_program_with_child_with_this_program>", //Example: ovc
      type: "<type_of_child_program>", // programTypes.ovc,
    },
    type: "<type_of_program>", // programTypes.caregiver,
  },
  {
    id: "<program-id>",
    type: "<type_of_program>", // programTypes.ovc,
    isChild: "<true_if_it_is_child_and_false_if_not>",
  },
];

module.exports = {
  metadata,
  programs,
  programTypes,
};

Source programs

In order for a script to run it needs ids for the program required to generate UICs for it tracked entity instances.

4. Operations of script

Once all configuration has been done, we can start using the script. There are several command for generation of UICs. They can be achieved using run-app.sh . But we recommend to use screen to do manual data upload as it takes time complete based on volume of data. There are three types of actions Generate, auto and update

4.1. Generate

UICs can be generated for all beneficiaries without UICs or by specific dates of beneficiaries updated. All of these can be specified in a comaand.

4.1.1. Generate for all available data in programs

Within script directory run command below

./run-app.sh generate

or

node index.js generate

4.1.2. Generate UIC for beneficiary updated in a specific time

Within script directory run command below

./run-app.sh generate from [START_DATE(YYYY-MM-DD)] to [END_DATE(YYYY-MM-DD)]

or

node index.js generate from [START_DATE(YYYY-MM-DD)] to [END_DATE(YYYY-MM-DD)]
Example
./run-app.sh generate from 2021-01-21 to 2021-02-10

or

node index.js generate from 2021-01-21 to 2021-02-10

This command will generate UICs for all beneficiaries who have been updated from 2021-01-21 to 2021-02-10

4.2. Auto

When you specify auto action in a command the command will generate UICs for data in a week period.

Example
./run-app.sh generate auto

or

node index.js generate auto

This command will generate UICs for all beneficiaries who have been updated from in a week period

4.3. Update Status

Status of the script can be updated using update action. When you specify update action in a command you should also specify word status and type of status. This action is useful when the script has been terminated manually, so this action can be run to update status manually. Available statuses are:

Status Desciption
STOPPED Script has been stopped
RUNNING Script is running
UNDER_MAINTENANCE Script is under maintenance
./run-app.sh update status [STATUS]

or

node index.js update status [STATUS]
Example
./run-app.sh update status STOPPED

or

node index.js update status STOPPED

This command will update status of the script to STOPPED

About

It is scipt for generating Primary and Secondary UIC

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •