mikelor / TsaThroughput

Monitors the TSA Published Statistics, Downloads new PDF files and Saves as .json
MIT License
32 stars 5 forks source link

TsaThroughput

Monitors the TSA Published Statistics on the FOIA Electronic Reading Room site. Ths codebase supports the processing of PDF files to JSON and CSV files. With this information, you can see TSA Throughput history. The following animation was created using this data. See sample input and output files in the /data folder.

Read Three Years of TSA Throughput Data.

Animation of TSA Throughput Data

Eventually this will be automated utilizing the below architecture System Component Diagram

Project Organization

At a high level, the project is organized into 3 main folders:

Quickstart

Prerequisites

One Step Update

If you don't care about the details, and just want to update the data to the latest available file published, navigate to the /scripts folder and issue the following command

./updateData.sh <latest filename>

./updateData.sh tsa-throughput-april-19-2020-to-april-25-2020.pdf

This will convert the .pdf file to json and then create .csv files and figures based on the latest data.

A Little More Detail

The updateData.sh script makes it easy to just get'er done. It's contains a couple of other scripts to convert from PDF to JSON, and another to build CSV files.

Running the TSAThroughputApp - Converting From PDF to JSON

Navigate to the /scripts folder and issue the following command

./cvtPdfToJson.sh ../data/tsa-throughput-april-19-2020-to-april-25-2020.pdf

Converting from JSON to CSV

Navigate to the /scripts folder and issue the following command

./cvtJsonToCsv.sh

The above command will process all of the files in the /data/raw/tsa/throughput folder and filter based on -a AIRPORTCODE. If you don't use the -a option, it will process all airports.

Automated Generation of CSV Files for Airports

The repository now includes an automated generation method for creating individual CSV files for each airport. This is achieved through the use of two scripts:

To use the automated generation method to create CSV files for additional airports, run the following command in the /scripts directory:

./generateAirportCsvs.sh

This will generate CSV files for all airports listed in the JSON data and place them in the appropriate directory.

Design Decisions