Skip to content

Simple utility for retrieving archived MBTA prediction data

Notifications You must be signed in to change notification settings

ibi-group-team/prediction-loc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prediction-loc

Setup

  • Ensure you have Python 3 installed.

  • Install helper software:

    • Mac Users:
      1. Install Homebrew according to instructions at https://brew.sh
      2. Install Pipenv with brew install pipenv
    • Windows users:
      1. Install Pipenv with pip3 install --user pipenv
  • Install the necessary libraries:
    pipenv install

  • Install and setup AWS authentication with awscli:
    pip3 install --user awscli
    aws configure
    Enter "Access Key ID" and "Secret Access Key" provided by an AWS administrator

  • Ensure certificates are set up.
    If you're using macOS go to Macintosh HD > Applications > Python folder > double click on "Install Certificates.command" file.

  • Configure
    export S3_BUCKET_NAME=bucket-name
    Bucket name is shared on LastPass

Usage

pipenv run python3 getArchive.py --datetime [YYYY-MM-DDTHH:mm] --output [output file location]

Optional arguments
Argument Description
--stop [stop id] Use to only include trip_updates affecting the given stop_id
--route [route id] Use to only include trip_updates affecting the given route
--feed [name] Feed to retrieve. Accepted values: bus (default), subway, cr
--raw Download the file as a raw protobuf instead of human-readable text

Troubleshooting

If the aws command cannot be found, you will need to add it to your PATH:

  1. Find the location of the install by running the command python3 -c 'import awscli; print(awscli)'
  • It should print something similar to <module 'awscli' from '/Users/localuser/Library/Python/3.6/lib/python/site-packages/awscli/__init__.py'\>
  1. Cut off the end of the filepath, starting with lib, and add /bin to get a path that looks like /Users/localuser/Library/Python/3.6/bin
  2. Add that to your PATH by opening (or creating) ~/.bash_profile and adding export PATH=$PATH:/Users/localuser/Library/Python/3.6/bin (using the path you created in step 2)
  3. Open a new terminal window or run source ~/.bash_profile to apply your changes

About

Simple utility for retrieving archived MBTA prediction data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%