Giter VIP home page Giter VIP logo

prt-monitor's Introduction

PRT-Monitor

Twitter bot ๐Ÿค– written in Python ๐Ÿ that monitors WVU's PRT.

Dependencies

Background

PRT Monitor is a Twitter bot that tracks the uptime/downtime of WVU's PRT and helps users stay updated on whether it is running. The PRT is an elevated tram car system for public transit and is located throughout Morgantown, WV. It is used by locals and students to get around campus or the city itself. The goals of the system were to minimize traffic and provide an alternative public transportation option. Morgantown, like much of West Virginia, has unique geographical and weather limitations, making a non-traditional public transit system necessary.

Check out this cool historical snapshot of the PRT here.

Despite how effective the PRT is in Morgantown, it is not perfect. There are only 5 stations to board the PRT, so commuters need to travel some distance before or after their PRT ride to complete there trip. It is not uncommon to walk about 15 minutes to the nearest station, only to find out that the PRT is temporarily out of service to to unforseen circumstances, such as weather. Before PRT Monitor existed, the best way to find out of the PRT is running was following the official twitter account or checking the status on the website, but these sources do not report each outage. Typically they only announce an outage if it is expected to be longer than 30 minutes of downtime.

PRT Monitor will report any outage as long as it lasts at least 5 minutes and because it is a twitter account, users can receive push notifications instead of manually checking a webpage. The goal of the project is to help commuters save time in their busy schedules by letting them know about service outages before they get to a station.

Details:

The project is entirely written in python and is running on a Raspberry Pi 3 Model B in headless mode. The scripts are triggered by CRON and I use a Twitter App for the tweeting functionality. You can see PRT Monitor in action on Twitter.

What does it do?

PRT_Monitor.py

Every 5 minutes this requests the PRT status from a JSON feed. If the status is different than the last status, then it will record the new status in a CSV file and tweet the new status.

So this doubles as both the twitter bot and the "monitor" at the same time.

PRT_Analysis.py

This script is executed every Friday at 5pm. And here is what it does:

  1. Adds up how many times the PRT has gone down during the semester.
  2. Calculates the amount of time the PRT was out of service (doesn't include when the PRT is closed).
  3. Calculates the amount of time the PRT was working normally.
  4. Calculates the percentage of uptime.
  5. Tweets the stats in a pretty format.

You're welcome to check my math (was never particularly good at it). ๐Ÿ˜ฌ

PRT_Prediction.py

This one is just an idea I had. It doesn't work yet. But I was thinking that I could predict outages based on historical data and weather.

prt-monitor's People

Contributors

rainerdeal avatar

Stargazers

 avatar  avatar

Watchers

 avatar

prt-monitor's Issues

Prevent PRT Analysis Repeat Tweets

During the summer when the PRT is closed (most of the time), PRT Monitor continues tweeting the analysis tweet even if nothing has changed about the stats.

Possible solutions:

  • if PRT status is 7 (closed) then don't tweet

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.