db-interchangesdeprecated

Retrieve accessibility information for interchanges between specific platforms at Deutsche Bahn (DB) stations. This module is still an early prototype, feel free to test and play around, but you shouldn't let people rely on it. See also: Coverage and potential problems.

Usage no npm install needed!

<script type="module">
  import dbInterchanges from 'https://cdn.skypack.dev/db-interchanges';
</script>

README

db-interchanges

Retrieve accessibility information for interchanges between specific platforms at Deutsche Bahn (DB) stations. This module is still an early prototype, feel free to test and play around, but you shouldn't let people rely on it. See also: Coverage and potential problems.

This module is also exposed as a REST API at 1.db-interchanges.juliustens.eu via db-interchanges-rest.

npm version Build status Greenkeeper badge License

Installation and usage

npm install db-interchanges

Warning: This module is a very early prototype, so most methods are quite inefficient and slow. Note also that requesting interchange information will spawn a request to the Overpass API, which sometimes takes a couple of seconds to respond.

const fetchInterchangeInformation = require('db-interchanges')

// leipzig messe, platform 3
const from = {
    stationId: '8012478'
    platform: '3'
}

// leipzig messe, platform 2
const to = {
    stationId: '8012478'
    platform: '2'
}

const opt = {
    fastaToken: '…' // token for the db fasta elevator api. the library provides a default token, but this is likely to be rate-limited if used by a lot of people. you can get your own one here: https://developer.deutschebahn.com/store/apis/info?name=FaSta-Station_Facilities_Status&version=v2&provider=DBOpenData
}

fetchInterchangeInformation(from, to, opt)
    .then(console.log)
    .catch(console.error)

Responses

fetchInterChangeInformation will return the following responses

response situation
null The db-platforms module doesn't contain any information for the specified platform(s), see also Coverage and potential problems.
{ barrierFree: true, elevators: [] } The module found a barrier-free route for the interchange that doesn't require using any elevators.
{ barrierFree: true, elevators: ['123456789'] } The module found a barrier-free route that requires using the elevators with given FaSta ids (see also db-elevators), which are all currently working correctly according to the FaSta API.
{ barrierFree: null, elevators: ['123456789'] } The module found a barrier-free route that requires using the elevators with given FaSta ids see also db-elevators, for which the FaSta API returned status working or unknown, but not broken.
{ barrierFree: false } There either is no barrier-free route at all or an elevator that would make this route barrier-free is currently broken according to the FaSta API.

Coverage and potential problems

When looking up interchange information, db-interchanges first tries to look up the specified platforms using db-platforms. Any interchange for which not both platforms are tagged with OSM data in db-platforms, db-interchanges will be unable to determine any accessibility information. See this list for an overview of the current coverage level in db-platforms.

Note that - as OSM ids are not guaranteed to be stable forever - db-platforms may contain entries that are not valid anymore. This will have the same effect as if a station hadn't been tagged in db-platforms in the first place, so take the coverage list mentioned above with a grain of salt.

After looking up platforms, db-interchanges fetches data from the Overpass API, which might take some seconds. The module will then try to calculate routes between the from and to platforms specified by the user. It filters out any elevators which are tagged on OpenStreetMap but are not included in db-elevators. See this list for an overview of the current coverage level in db-elevators.

The algorithm also fetches the FaSta API for any matched elevators and filters out any broken ones and returns the corresponding barrierFree information (see also Responses).

See also

Contributing

If you found a bug or want to propose a feature, feel free to visit the issues page.