Skip to content

NYPL/location-closure-aggregator-lambda

Repository files navigation

LocationClosureAggregatorLambda

This repository contains the code used by the LocationClosureAggregator-qa and LocationClosureAggregator-production AWS lambda functions. It primarily aggregates a series of closure alerts picked up by the LocationClosureAlertPoller. Specifically, it does the following:

  1. Determines the true length of each closure based on the alert data and the time the alerts were polled. See the TAD for specifics.
  2. Constructs closure records based on the determined length and other information from the closure alerts
  3. Inserts the resulting records into Redshift
  4. Deletes the closure alerts from the Redshift staging table

The Redshift connection parameters must be provided as REDSHIFT_DB_HOST, REDSHIFT_DB_NAME, REDSHIFT_DB_USER, and REDSHIFT_DB_PASSWORD environment variables in order for the code to run. It's also assumed that all of these variables except the database name have been encrypted via KMS.

Git workflow

This repo uses the Main-QA-Production git workflow.

main has the latest and greatest commits, qa has what's in our QA environment, and production has what's in our production environment.

Deployment

CI/CD is not enabled. To deploy a new version of this function, first modify the code in the git repo and open a pull request to the appropriate environment branch. Then run source deployment_script.sh and upload the resulting zip. Note that if any files are added or deleted, this script must be modified. For more information, see the directions here.

About

Code for a lambda function that aggregates location closure alerts to determine the true closure duration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published