public-transport / hafas-client

JavaScript client for HAFAS public transport APIs.
ISC License
271 stars 54 forks source link

fully parse journey & journey leg frequencies #96

Closed derhuerst closed 2 months ago

derhuerst commented 5 years ago

hafas-client already parses the frequency of alternatives of a journey leg (if returned by HAFAS) and exposes them as journeyLeg.cycle.min & journeyLeg.cycle.max. If HAFAS has also returned a list of alternative trips via .freq.jnyL, it will parse & expose them via journeyLeg.alternatives.

Missing pieces not parsed yet:

Some example data (just search for "freq"):

derhuerst commented 5 years ago

@schildbach @alexander-albers Do you know more?

schildbach commented 5 years ago

I'm afraid I wasn't even aware of the fields.

derhuerst commented 5 years ago

I've requested 5 journeys from U Voltastr (900000007103) to U Weinmeisterstr. (900000100051). As expected, each just contains of a single U8 leg. The corresponding minC, maxC, numC and jnyL values are shown below:

S5 2018-12-01T23:03:00.000+01:00 (0s delay)
  minC 120 maxC 660 numC 24
  freq.jnyL [
    S9 2018-12-01T23:06:00.000+01:00
    S7 2018-12-01T23:11:00.000+01:00
    S3 2018-12-01T23:16:00.000+01:00
    S7 2018-12-01T23:21:00.000+01:00
    S5 2018-12-01T23:23:00.000+01:00
  ]
S9 2018-12-01T23:07:00.000+01:00 (60s delay)
  minC 120 maxC 660 numC 23
  freq.jnyL [
    S7 2018-12-01T23:11:00.000+01:00
    S3 2018-12-01T23:16:00.000+01:00
    S7 2018-12-01T23:21:00.000+01:00
    S5 2018-12-01T23:23:00.000+01:00
    S9 2018-12-01T23:26:00.000+01:00
  ]
S7 2018-12-01T23:11:00.000+01:00 (0s delay)
  minC 120 maxC 900 numC 23
  freq.jnyL [
    S3 2018-12-01T23:16:00.000+01:00
    S7 2018-12-01T23:21:00.000+01:00
    S5 2018-12-01T23:23:00.000+01:00
    S9 2018-12-01T23:26:00.000+01:00
    S3 2018-12-01T23:36:00.000+01:00
  ]
S3 2018-12-01T23:16:00.000+01:00 (0s delay)
  minC 120 maxC 900 numC 22
  freq.jnyL [
    S7 2018-12-01T23:21:00.000+01:00
    S5 2018-12-01T23:23:00.000+01:00
    S9 2018-12-01T23:26:00.000+01:00
    S3 2018-12-01T23:36:00.000+01:00
    S7 2018-12-01T23:41:00.000+01:00
  ]
S7 2018-12-01T23:21:00.000+01:00 (0s delay)
  minC 120 maxC 900 numC 21
  freq.jnyL [
    S5 2018-12-01T23:23:00.000+01:00
    S9 2018-12-01T23:26:00.000+01:00
    S3 2018-12-01T23:36:00.000+01:00
    S7 2018-12-01T23:41:00.000+01:00
    S5 2018-12-01T23:43:00.000+01:00
  ]
derhuerst commented 5 years ago

Things I know so far:

derhuerst commented 2 months ago

Done as of #97. Published as of hafas-client@3.6.0.