Skip to content

hks-epod/paydash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

fb151b2 · Dec 29, 2021
May 30, 2017
Dec 29, 2021
Apr 4, 2018
Apr 26, 2020
Feb 13, 2018
Oct 18, 2017
Jul 16, 2017
Jul 17, 2016
Feb 6, 2016
Jul 17, 2016
Sep 16, 2016
Oct 23, 2019
Jan 16, 2016
Jun 17, 2016
Sep 8, 2016
Jul 21, 2016
Apr 4, 2018
May 11, 2021
Jul 22, 2016

Repository files navigation

Paydash

Paydash is a monitoring tool for block officials overseeing MGNREGA, India's employment guarantee programme for rural households. Beneficiaries under MGNREGA are supposed to be paid within 15 days of working, but the average worker waited 53 days to receive payment in 2014-2015, undermining MGNREGA's effectiveness as a social safety net.

Paydash aims to reduce delays in beneficiary payments by providing government officials with detailed information on delays -- breaking out performance on payment sub-processes down to the panchayat level and connecting poor performance with the responsible government employee. In addition to diagnostics, Paydash is action-oriented, providing access to pending documents and the contact information of the responsible employee. Paydash aims to empower government officials with better information while introducing more accountability into the payments process, with the ultimate goal of helping MGNREGA workers receive their rightful payments.

Paydash is a joint initiative of the Ministry of Rural Development, the National Informatics Centre, and Evidence for Policy Design at Harvard Kennedy School.

Technology

  • Hapi - Server side framework
  • Handlebar - HTML templating engine
  • Sequelize - MYSQL database ORM
  • SASS - CSS preprocessor
  • D3 - Data visualization library
  • Gulp - Javascript tasks automation
  • WebPack - Asset pipeline

Note: For a detailed list of the toolsets used in paydash, please refer to package.json.

Application Structure

Let's take a tour of the app.

|
| -- app
|   |-- controllers        // Controllers are organised by module names
|   |   |-- <module_name>  // Each controller defines config and handler for that route.
|   |
|   |-- helpers            // Helper functions used across application
|   |-- models             // All sequelize models are defined here
|   |-- routes             // All app routes are defined here
|   |   |-- <route_plugin> // Route module is a hapi plugin and can be toggled from config/manifest.js
|   |
|   `-- templates          // All server-rendered handlebar templates, partials and helpers
|       |-- <module_name>  // Templates are organised by module names.
|   
|-- assets                 // Contains all static resources 
|   |-- fonts              // Fonts used in application
|   |-- images             // Images used in application
|   |-- misc               // Misc resources used in application
|   |-- scripts            // Client javscripts files which are then packed by webpack
|   |-- styles             // All SASS stylesheets
|   |   |-- <module_name>  // Styles are organised by module names. 
|   
|-- config                 // Contains all app configurations
|   |   |-- keys           // GA and other application keys are stored here. (gitignored).
|   |-- assets.js          // Assets configuration file
|   |-- config.js          // Application configuration file which stores all passwords etc. (gitignore).
|   |-- manifest.js        // App manifest file listing all plugins and load order. 
|   
|-- lib                    // Core application lib/plugins 
|-- tasks                  // Contains all gulp tasks 
|-- tests                  // Code tests
|
|-- gulpfile.js            // Gulp entry file 
|-- index.js               // Application starting point
|-- package.js             // Package configuration file
|-- server.js              // Main server file

Code

We're using semi-colons and comma-last. No rhyme or reason; and some of the hapi code convention guidelines. All client-side js code is also in commonJS pattern packs using webpack. Check out .editorconfig, .jsbeautifyrc, .jshintrc for additional code conventions used.

Running the server locally

  • Install node, npm
  • Place a copy of config.js in /config folder.
  • Monitoring services will require Google analytics service account key file placed in config/keys/
  • Run these commands
# Install deps
$ npm install

# Run the node server
$ npm start

# > paydash@1.0.0 start /Users/ravisuhag/Batcave/Workspace/hks-epod/Dev/paydash
# > gulp
# 
# [16:48:55] Using gulpfile ~/Batcave/Workspace/hks-epod/Dev/paydash/gulpfile.js
# [16:48:55] Starting 'fonts'...
# [16:48:56] Starting 'images'...
# [16:48:56] Starting 'misc'...
# [16:48:56] Starting 'styles'...
# [16:48:56] Finished 'styles' after 5.49 ms
# [16:48:56] Starting 'webpack'...
# [16:48:56] Finished 'webpack' after 73 ms
# [16:48:56] Starting 'lint'...
# [16:48:56] Starting 'nodemon'...
# [16:48:56] Finished 'nodemon' after 1.99 ms
# [16:48:56] [nodemon] v1.4.1
# [16:48:56] [nodemon] to restart at any time, enter `rs`
# [16:48:56] [nodemon] watching: *.*
# [16:48:56] [nodemon] starting `node server.js`
# [16:48:57] Finished 'images' after 1.98 s
# [16:48:57] Finished 'misc' after 1.98 s
# Server is listening on 8000

The server should be running at localhost:8000.

Running tests

Lab is part of the hapi.js toolset and what we use to write all of our tests.

$ npm test
# > paydash@1.0.0 test /Users/ravisuhag/Batcave/Workspace/hks-epod/Dev/paydash
# > node node_modules/lab/bin/lab -a code -t 100

# ..............

# 6 tests complete
# Test duration: 1370 ms
# No global variable leaks detected
# Coverage: 100.00%

Contributers

See the awesome people!