jamespfennell / path-train-gtfs-realtime

GTFS Realtime for the PATH train in New York and New Jersey
MIT License
12 stars 3 forks source link

[RFC] Adding alerts for the PATH train #2

Closed cedarbaum closed 1 year ago

cedarbaum commented 1 year ago

It seems there is now a way to get PATH alerts via this endpoint: https://www.panynj.gov/bin/portauthority/everbridge/incidents?status=All&department=Path

I would be cool to convert these to the GTFS realtime format and then consume then via Transiter! However, there are a couple ways to accomplish this:

  1. Modify Matt Razza's public API (assuming they are open to it) and then consume the alerts from here (I've opened a parallel RFC issue here: https://github.com/mrazza/path-data/issues/19)
  2. Directly call the endpoint from here

I don't have a strong opinion, though I suppose (1) could be considered cleaner architecturally whereas (2) would be a bit less work. Curious what your thoughts are here - thanks!

jamespfennell commented 1 year ago

This looks interesting! To me it would seem easiest to add it directly to this project (i.e. option 2), but if you're interested in implementing it I would defer to your choice. :)

cedarbaum commented 1 year ago

Thanks for the feedback, I have this somewhat working now using option 2, but unfortunately there are some data quality issues. In summary, what is retrieved from the URL I posted doesn't really match up with what is in the PATH app or their Twitter feed. I am going to look into this a bit more, but will close this issue for now.

jamespfennell commented 1 year ago

Sorry to hear that this didn't work out! Data quality is definitely a huge problem in the transit data space. When using GTFS feeds which are theoretically structured, transit agencies sometimes do whatever they want. For unstructured data it's even harder.

cedarbaum commented 1 year ago

I think there is still some hope that things will improve! PANJ has a page that displays the alerts from the same source I was using: https://www.panynj.gov/port-authority/en/alerts.html

The problem is that it displays stale information and doesn't add follow-ups (e.g., that the incident is resolved) like their Twitter feed and mobile app. Here is an example from today:

image

My hope is that their goal is to eventually make this page more useful at a glance by only displaying currently active or upcoming alerts, similar to the MTA. Right now, the mobile app's "Alerts" tab is the best place to look that I know about. Unfortunately, that page is delivered to the app in pre-rendered HTML, so that would have to be parsed and then you would only get a timestamp and a message. I am considering opening a PR to https://github.com/mrazza/path-data to do this.

Also, if you're curious, this is the code to convert from the Everbridge incident format to GTFS: https://github.com/cedarbaum/path-train-gtfs-realtime/blob/portauthority-alerts/pathgtfsrt.go#L370. This worked easily end-to-end with Transiter, which was cool to see!

Sorry about the brain dump 😅, hopefully will be able to get something working eventually!