Skip to content

palladium-group/lodiis-beneficiary-status-update

 
 

Repository files navigation

LODIIS Beneficiary Status Update

Introduction

LODIIS beneficiary status update's script is node script with typescript support, aim for update beneficairies status of dreams/agyw or OVC intervantion based on service provisons for a specificia period of time. Theses status including active, in-active and missed services.

Pre-requiestes for the script

Below are pre-requiested for the script to be able to clone and run the script successfully. Typescript mostly for building source code into js bundled codes for running the script.

- GIT
- Node v12+
- npm v6+
- typescript v4+

Get started with script

To get start up we need to clone or download the source codes and having better under stand of source codes for set up prior development or run the script.

To clone the app, make sure you have installed the GIT command line and tun below command on the terminal

git clone https://github.com/hisptz/lodiis-beneficiary-status-update.git

Source code structure for script

Once codes strcture of downloaded or cloned script has below structure

lodiis-beneficiary-status-update
|-- dist
|-- node_modules
|-- resources
|-- src
|   |-- app
|   |   |--app-process.ts
|   |   |- beneficiary-data.ts
|   |   |--index.ts
|   |-- configs
|   |   |-- app-config.example.ts
|   |   |-- index.ts
|   |-- constants
|   |   |-- beneficiary-status-constants.ts
|   |   |-- index.ts
|   |-- models
|   |   |-- app-config-model.ts
|   |   |-- beneficiary-status-config-model.ts
|   |   |-- dhis2-tracked-entity-instance.ts
|   |   |-- index.ts
|   |-- utils
|   |   |-- app-util.ts
|   |   |-- beneficiary-data-util.ts
|   |   |-- dhis2-program-util.ts
|   |   |-- dhis2-tracked-entity-instance.ts
|   |   |-- excel-util.ts
|   |   |-- file-util.ts
|   |   |-- http-util.ts
|   |   |-- index.ts
|   |   |-- logs-util.ts
|   |--index.ts
|-- .gitigonre
|-- .prittierrc
|-- LICENSE
|-- package-lock.json
|-- package.json
|-- README.md
|-- run-script.sh
|-- tsconfig.json

Based on above source code structure, folder or sub folder below is descriptions and contents under each

  • dist: This is auto-generate folder contained compiled js bundled file from all ts files in src directory
  • node_modules: This is autogenrate folder for all installed packages for supporting script to run. It generated on installation of all dependences of the scripts
  • resources: This is autogenrate by the script, it contains generated logs files for the scripts as it run though put the process of updating beneficiary's status.
  • src: This main srouce code directory, and the index.ts is the main entry file for the script. It contains below sub directories below:-
    • app: Contains all main process of the app including app process as well as manipulation process for beneficiary data.
    • configs: This is for configurations of the script including access to dhis2 instance where script will be using for updating beneficiary status.
    • constants: Contains all constants/references for beneficiary status updates including program metadata references used, status and duration limit for changes of beneficiary status.
    • models: Contains models/interfaces of script metadata including app configs, dhis2 tracked entity instance and beneficiary status configuration.
    • utils: Contains utils functions or classes necessary for running the all process during deduction and updation for beneficairy status. It includes app utils, beneficiary data utils, dhis2 program and tracked entity instance utils, excel utils, file utils, http utils as well as logs utils

Setup & Configurations

Prior run the script need configurations of the script by set up acess credential to DHIS2 instance where the script will proxy to update beneficiaries.

To set up access creadntial create the file app-config.ts on src/configs with below contents

import { AppConfigModel } from '../models';

export const appConfig: AppConfigModel = {
  username: 'dhis_username',
  password: 'dhis_password',
  baseUrl: 'dhis_base_url'
};

After installation run below command to install neccessary packages for the script

npm install

Operation of script

After set up the script and install all script's dependences, you can run the app for development purpose or deployments.

For development, inorder to tracking changes as changing source codes, you can run below command while inside the script dicectory

npm run dev

For deployment, you can run below command while inside the script dicectory

sh run-script.sh

To view script logs as the script is run or in progress, you can run below command while inside the script dicectory

tail -f resources/logs/logs.txt

About

Custom script for automatic updating status for beneficiaries

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 99.7%
  • Shell 0.3%