Coder Social home page Coder Social logo

transitmatters / new-train-tracker Goto Github PK

View Code? Open in Web Editor NEW
30.0 4.0 11.0 1.33 MB

Tracking the MBTA's new Orange, Red, and Green trains

Home Page: http://traintracker.transitmatters.org/

License: MIT License

Python 18.65% HTML 1.13% CSS 6.89% JavaScript 1.41% TypeScript 68.29% Shell 3.64%

new-train-tracker's Issues

Add the Mattapan line

A user wrote in to point out that the ancient PCC cars are being retrofitted with new components, which may be of interest to the same folks who are interested in hunting down new trains. New or not, this will be a good addition as fleet delivery wears on and the NTT becomes just the "train tracker" with Blue, Silver, etc.

We could possibly tack this onto the bottom of the Ashmont strip map, though that's technically harder (and maybe not as appropriate for the use case) than just putting it into its own tab.

fix silverline logging

The changes to tally the new vehicles seen don't account for the logging of the silverline that's happening.
Separating the processing from the tallying would be ideal.

Database Overhaul

Should include list of npm commands and things to look out for if setting up a new instance of the project, maybe some troubleshooting tips...

  • At the very least modify the README to list a running Postgres server as a dependency
  • Also add some links to helpful, tested OS-specific instructions on how to set one up
  • For our own purposes try to install this from scratch on an EC2/Lightsail Ubuntu instance and write down or script the steps we needed to take
  • Factor any OS-agnostic steps we missed into create_history_db.py
  • (Optional) Replace or supplement secrets.py with environment variables?
  • #84

Display average travel time between stations

It could be cool to be able to click on two stations and see the average travel time between them, especially if you're trying to schedule when you should leave to catch one of the new trains

Fix healthcheck

Healthcheck doesn't work anymore since moving to chalice. Should fix it so it stops erroring out

Save state on refresh

NTT page refreshes should send you back to the same line/mode you were already viewing. No need for URL state though, I don't think...

Create Ansible playbook specifically for fresh deployments

The current deploy-on-lightsail.yml Ansible playbook can only be used to update existing deployments of the Train Tracker. It wouldn't be a bad idea to have a separate playbook designed for performing fresh deployments of the app.

Show how busy each train is

The v3 api provides info about how busy the trains are. On the new orange and red line trains the data is given per car. We should show that on the map for the curious folks

secrets.py should not be overwritten point blank

@z0glen made a delightful change to permit NTT to run without an adjacent PostgreSQL server. That included a secrets.py modification, which the CD job overwrote on merge with the instance copy. I added Zach's change to said copy, but ideally the key would be patched in (or read from env? or elsewhere?)

Determine if EC2 is necessary, switch to Chalice from flask

We should determine if EC2 is necessary for modern NTT

It seems as though we may be able to get away with NTT being a Chalice app instead of a flask one

This could reduce overhead, costs, and generally make it more similar to all our other apps

If this is wrong, we can close this

Handle 429 from MBTA gracefully

We're getting 429 from the MBTA, which is causing the service to crash occasionally

We can fix this a few different ways:

  1. Cache responses for 15 seconds to slightly reduce call frequency
  2. Get a seperate v3 API specifically for production NTT
  3. More gracefully catch 429 to at least not crash

Add loading animation for train popover

When clicking on a car to see last update / predictions, the popover jerks to expand after the request to the backend finishes. This should be a smoother animation

Make the `apple-touch-icon` work for iOS

We have an apple-touch-icon.png file in the repo which is supposed to be used when the NTT is added to the Home Screen. This...isn't working, and I can't figure out why. There's probably something I'm not doing correctly with the image itself or the link tag in template.html.

Extend Green Line visualization/tracking to account for GLX

GLX is currently planned to open in December for the Union Branch and May for the Medford Branch. We need to extend the GL code to take into account these new stations. @idreyn If you have any details as to what exactly needs to be done feel free to drop them here for whoever ends up picking this up.

Add timestamps to log files

The cron task (cd /home/ubuntu/new-train-tracker && /home/ubuntu/.local/bin/pipenv run python3 -m server.history.update_history_db >> /home/ubuntu/new-train-database-updates.log) and the mbta_api call (new-train-tracker/server/mbta_api.py: print(f"Writing problematic API response to {log_path}")) both generate log files that don't have timestamps. It would be great to add timestamps to these for diagnosing issues.

Add ability to filter by sub-line (GL B/C/D/E & RL Ashmont/Braintree)

This would be very helpful for when there's several trains bunched up in one rendered location, and you have to keep selecting the location to scroll through the trains, and it doesn't always scroll through all of them.

Alternatively/simultaneously, it would be nice to color code the sub-lines and expand a bunch of overlapping trains when one is selected.

Add codepaths to allow running the tracker without a database

Since we're considering using the Data Dashboard infrastructure for the history data, we can eventually wind down this repo's dependency on a locally-hosted Postgres database. As a first step, let's make our Postgres dependency opt-in โ€” so that the app will build and run without a database available, and provide dummy/fallback data in its absence.

Add labels for GL branch stations

Mobile viewports are too small to fit full station names but we could:

  • Make them teeny tiny
  • Abbreviate them
  • Make them appear when the station dot is tapped

Make it easier to deploy local changes to Beta

Currently, deploy-playbook.yml is hardcoded to deploy whatever is on the org main branch - this is good for CD, but we should extend the playbook and deploy.sh to make it easier to deploy local changes without having to manually edit the playbook

Better API key management

[ ] Specify API key an with environment variable
[ ] Via the file secrets.py
[ ] Make the API calls not fail if an API key isn't present via env var or secrets.py

OL strip map line becomes translucent on NEW -> ALL transition

To reproduce:

  • Load the tracker
  • Move to OL
  • Switch from NEW to ALL trains

The strip map line will go translucent. This is a visual cue we use for the non-selected branch of GL and RL and should never happen on the OL.

Screen.Recording.2022-09-21.at.9.58.20.PM.mov

Update Python to 3.12

Because we're running on EC2 we should be able to update to Python 3.11 or 3.12 today

Every other product at TM is using Python 3.10 now, we should at least get NTT in-line. Soon we'll be on 3.11 and 3.12

RL last seen not updating properly

I wonder if this is due to Ashmont shuttling? We received this to labs@.

Hi,
Earlier today (Friday, 20-October-2023) the redline new trains tracker said there were two new trains on the line. Now, when I look, (after 5:30 PM same day), it says there are no new trains, and that a new red line train was last seen 6 days ago.

That looks like a bug....

Thanks

Backup last_seen.json

The NTT working directory now contains last_seen.json for the "last seen" times. We should back that up automatically, in case something happens to the server.

Add analytics

We use Google Analytics for the data dashboard, so let's hook that up here too.

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.