-
3.1. Installations
3.2. Configuration
3.2.1. App configuration
3.2.2. Metadata configuration
-
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
Node script app for generating Unique Identifier Code(UIC) for AGYW, Caregiver and OVC in KB Lesotho instance.
- Node 10+
- npm 6+
- git
Clone the app and install all app dependencies
git clone https://github.com/hisptz/lodiis-uic-generator.git
cd lodiis-uic-generator
npm install
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.
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,
};
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,
};
In order for a script to run it needs ids for the program required to generate UICs for it tracked entity instances.
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
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.
Within script directory run command below
./run-app.sh generate
or
node index.js generate
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)]
./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
When you specify auto action in a command the command will generate UICs for data in a week period.
./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
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]
./run-app.sh update status STOPPED
or
node index.js update status STOPPED
This command will update status of the script to STOPPED