GithubHelp home page GithubHelp logo

forki / ptp-functions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pingthepeople/ptp-functions

0.0 3.0 0.0 2.05 MB

Azure Functions to support data updates and notifications for Ping the People

Home Page: https://pingthepeople.org

License: MIT License

F# 100.00%

ptp-functions's Introduction

These scripts gather data about the progress of legislation in the Indiana General Assembly via its API and send sms/email alerts to users on an opt-in basis. This information help politically-engaged organizations track the progress of bills that are important to them.

There are several distinct processes that occur during the legislative session to make this happen:

  • Canonical data, including bills, committess, and subjects, are pulled from the API once daily on weekday mornings.
  • Legislative activity is pulled from the API and alerts sent every 10 minutes on weekdays for:
    • Legislative events (e.g. "a committee hearing was held for HB 1234")
    • Upcoming committee hearings (e.g. "HB 1234 will read in committee on 3/1/2017")
    • Upcoming chamber readings (e.g. "HB 1234 will have a second reading in the House on 3/1/2017")
  • A daily digest with a rundown of that day's legislative activity, any upcoming activity, and a spreadsheet showing up-to-date legislation status is sent once daily on weekday evenings. Users can opt to see a rundown of all legislative activity, or just the activity on the bills they're tracking.

View a slide deck that illustrates the data update and alert processes.

Building

These scripts are written with F#, a cross-platform functional language built on the .Net framework. You can find instructions for installing F# on your system at fsharp.org.

Configuration

The scripts assume the presence of the following environment variables:

  • IgaApiKey: an API key for the Indiana General Assembly API.
  • SessionYear: the current IGA session year (i.e. 2017)
  • WindowsAzure.StorageAccount: a connection string to a Microsoft Azure storage account. This will store email attachments generated by the service.
  • SqlServer.ConnectionString: a connection string for a SQL server instance. See the Database section for instructions on creating this database.
  • ServiceBus.ConnectionString: a connection string for an Azure Service Bus namespace with Send+Listen permissions. See the Service Bus Queues section for instructions on setting up the Service Bus queues.
  • SendGridApiKey: an API key for SendGrid with permission to send email.
  • Twilio.AccountSid: A Twilio account identifer (for SMS delivery)
  • Twilio.AuthToken: A Twilio API auth token (for SMS delivery)
  • Twilio.PhoneNumber: A Twilio phone number (for SMS delivery)

Deployment

Functions

The scripts are intended to be run as Azure Functions. After creating your Function App and cloning this repository, you can connect the Function App to your GitHub repo. It will automatically detect changes and deploy the functions.

Database

Run the createDbTables.sql script to generate the database tables targeted by the functions. The SqlServer.ConnectionString should reference this database with read/write permissions.

Service Bus Queues

The following Azure Service Bus Queues should be created with default settings (1 GB, partitioned):

  • alert
  • schedule
  • digest
  • notification

ptp-functions's People

Contributors

jhoerr avatar

Watchers

Steffen Forkmann avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.