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.
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.
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)
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.
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.
The following Azure Service Bus Queues should be created with default settings (1 GB, partitioned):
- alert
- schedule
- digest
- notification