Code Monkey home page Code Monkey logo

Comments (23)

balajeek avatar balajeek commented on June 12, 2024 3

https://www.panynj.gov/bin/portauthority/ridepath.json

from path-data.

mrazza avatar mrazza commented on June 12, 2024 2

Current guess is an issue with the production load balancer. Will need to investigate later.

Thanks for opening.

from path-data.

balajeek avatar balajeek commented on June 12, 2024 1

any luck?

from path-data.

mrazza avatar mrazza commented on June 12, 2024 1

Sorry folks. Hope to look at this soon.

from path-data.

balajeek avatar balajeek commented on June 12, 2024

Thank you.

from path-data.

balajeek avatar balajeek commented on June 12, 2024

No worries.
In meantime i was digging thru the path official site to see how they showed their real-time departures, and i figured out the json file they use which make me convenient becaz all i needed is the json to use with my node-red. I am all good now.
But hope to see your api working soon. Thank you.

from path-data.

danramteke avatar danramteke commented on June 12, 2024

i figured out the json file

@balajeek can you share a link?

from path-data.

mrazza avatar mrazza commented on June 12, 2024

Nice!

from path-data.

markd315 avatar markd315 commented on June 12, 2024

I for one am a little bit confused now because I thought the original motivation for this API was to cache and quickly retrieve data since the PATH app uses a slow pub/sub method to get the data.

Is this json endpoint new? Is it retrieving only schedule data and not real-time? At this point, what are the relative disadvantages of the official data vs this API, aside from me doing the dev work to reingest and parse it?

from path-data.

balajeek avatar balajeek commented on June 12, 2024

I started using the api just recently about a month ago, and i could precisely tell what station i want and it does give me that in json format. when it stopped working and couple of days later i noticed path official site have the real-time data showing, so i wondered it has to come from some where, so i started looking it chrome developer console and ended up find this link that contains all the stations and timings in json format and it get updated real-time.

May be its new !

from path-data.

markd315 avatar markd315 commented on June 12, 2024

As long as it has real time data I might consider migrating my usage to it as well thank you for the context @balajeek

edit:
I looked today and the cors settings for this server are not set up for proper consumption, and since I have a browser app I will just wait for Matt's api to be back up

from path-data.

cannondale0815 avatar cannondale0815 commented on June 12, 2024

https://www.panynj.gov/bin/portauthority/ridepath.json

This works great in Home Assistant -- thanks @balajeek !

from path-data.

balajeek avatar balajeek commented on June 12, 2024

@cannondale0815 , how did you use in HA, would you mind sharing.
I initially did on HA but i did not like that HA is constantly pulling data and i did not find a way to set only on certain times of the day or based on geo-location. So i moved it to node-red automation which works okay for me.

from path-data.

cannondale0815 avatar cannondale0815 commented on June 12, 2024

@balajeek I have the below in my configuration.yaml, and it refreshes every 45 seconds. I don't see a reason why I should limit my polling to only certain times of the day, so every 45 seconds is ok with me (I did the same with mrazza's API before).

FYI: I am only interested in two trains, and their arrival at one particular station.

rest:
  - resource: https://www.panynj.gov/bin/portauthority/ridepath.json
    scan_interval: 45
    sensor:
      - name: "PATH train 1 lineName"
        value_template: >
          {% set stationGRV = value_json.results | selectattr("consideredStation","eq","GRV") | first %}
          {% set destinationToNY = stationGRV.destinations | selectattr("label", "eq", "ToNY") | first %}
          {% set headSignTrain1 = destinationToNY.messages[0].headSign %}
          {{ headSignTrain1 }}
      - name: "PATH train 1 projectedArrival"
        value_template: >
          {% set stationGRV = value_json.results | selectattr("consideredStation","eq","GRV") | first %}
          {% set destinationToNY = stationGRV.destinations | selectattr("label", "eq", "ToNY") | first %}
          {% set arrivalTimeTrain1 = destinationToNY.messages[0].arrivalTimeMessage %} 
          {{ arrivalTimeTrain1 }}
      - name: "PATH train 2 lineName"
        value_template: >
          {% set stationGRV = value_json.results | selectattr("consideredStation","eq","GRV") | first %}
          {% set destinationToNY = stationGRV.destinations | selectattr("label", "eq", "ToNY") | first %}
          {% set headSignTrain2 = destinationToNY.messages[1].headSign %}
          {{ headSignTrain2 }}
      - name: "PATH train 2 projectedArrival"
        value_template: >
          {% set stationGRV = value_json.results | selectattr("consideredStation","eq","GRV") | first %}
          {% set destinationToNY = stationGRV.destinations | selectattr("label", "eq", "ToNY") | first %}
          {% set arrivalTimeTrain2 = destinationToNY.messages[1].arrivalTimeMessage %}
          {{ arrivalTimeTrain2 }}

from path-data.

markd315 avatar markd315 commented on June 12, 2024

For anyone who just wants a version of Matt's old real time jsfiddle working again I adapted it to consume the new data source. Cors proxy was the hard part had to try a bunch of free ones to get it working.

https://jsfiddle.net/3hgm9Lrv/3/show

Can also use it as an example of how to fetch and parse in this new format if you want.

from path-data.

markd315 avatar markd315 commented on June 12, 2024

^ Note that I have just experimentally determined this source is not providing the real-time data but just the schedule information. So it's a stopgap solution.

from path-data.

balajeek avatar balajeek commented on June 12, 2024

Thats great the web version is live again. wondering is it possible that i could modify a copy of your jsfiddle to keep only two stations i need, so i could incorporate in an iframe for my use. thanks.

from path-data.

markd315 avatar markd315 commented on June 12, 2024

Thats great the web version is live again. wondering is it possible that i could modify a copy of your jsfiddle to keep only two stations i need, so i could incorporate in an iframe for my use. thanks.

yeah any of these are essentially open source you can modify it to your needs without asking anyone. Think you just put like /edit for the url instead of /show.

from path-data.

cannondale0815 avatar cannondale0815 commented on June 12, 2024

^ Note that I have just experimentally determined this source is not providing the real-time data but just the schedule information. So it's a stopgap solution.

It never actually provided super reliable data to begin with. Even if it said that it was on time, the train often wasn't. And if it was saying "delayed" with an arrival time, who ever knew what that meant -- does it mean the arrival time is the new estimated time, or the scheduled time but delayed.

from path-data.

kerrickstaley avatar kerrickstaley commented on June 12, 2024

The URL https://www.panynj.gov/bin/portauthority/ridepath.json is inaccessible from a web app due to CORS [1]. So mrazza's API is still helpful at least for me.

[1] The error I get is

Access to fetch at 'https://www.panynj.gov/bin/portauthority/ridepath.json' from origin 'http://localhost:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

from path-data.

markd315 avatar markd315 commented on June 12, 2024

The URL https://www.panynj.gov/bin/portauthority/ridepath.json is inaccessible from a web app due to CORS [1]. So mrazza's API is still helpful at least for me.

[1] The error I get is

Access to fetch at 'https://www.panynj.gov/bin/portauthority/ridepath.json' from origin 'http://localhost:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Yes, refer to my comments. I would still love to get the Matt API up and running again because it has the real-time data. If all you need is a way to get the schedule data in JSON you can still consume the site even though the CORS is effed by using a proxy. See my latest jsfiddle for an example of how to do that if you need.

from path-data.

kerrickstaley avatar kerrickstaley commented on June 12, 2024

The ridepath.json URL has real-time arrival information; it doesn’t just use a schedule. However, it seems like it’s not as good as path-data because the data it outputs is lagged by ~80 seconds.

I blogged about this in more detail at https://www.kerrickstaley.com/2022/11/26/timeline-of-a-train-departure

from path-data.

mrazza avatar mrazza commented on June 12, 2024

Sorry folks.

Life and work got in the way and this should be fixed now. Please let me know if it's not.

from path-data.

Related Issues (9)

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.