Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dt 6111 Update OTP2 information to Digitransit.fi #260

Merged
merged 66 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
09b7b78
Update example urls to v2
HenrikSundell Feb 29, 2024
5332ce7
Update route ids in example
HenrikSundell Mar 6, 2024
472ad44
Update bike rental api example querries
HenrikSundell Mar 13, 2024
60c69c4
Update url queryparameters for updated api queries
HenrikSundell Mar 14, 2024
2cdad49
Add info about planConnection
HenrikSundell May 16, 2024
cb02120
Update information about Interfaces
HenrikSundell Jul 25, 2024
c9fbb89
Add waltti-alt and varely urls
HenrikSundell Jul 25, 2024
25d259f
Fix rental bicycle query
HenrikSundell Jul 26, 2024
15e6abe
Fix personal bicycle query
HenrikSundell Jul 26, 2024
4cbb514
Update realtime documentation
HenrikSundell Aug 29, 2024
7d77e90
Update bicycle documentation
HenrikSundell Aug 29, 2024
28601fc
Update disruption documentation
HenrikSundell Sep 4, 2024
b9db3bd
Update documentation about itinerary planning
HenrikSundell Sep 4, 2024
7fb38a5
Remove advanced examples page and move relvant info to itinerary plan…
HenrikSundell Sep 4, 2024
86fb898
Update background map version
HenrikSundell Sep 4, 2024
44a8a84
Update background map version
HenrikSundell Sep 4, 2024
5e3e1e3
Add missing routing urls
HenrikSundell Sep 19, 2024
5fd4ce0
Update points of interest API documentation
HenrikSundell Sep 24, 2024
837f0ce
Update OTP url structure
HenrikSundell Oct 2, 2024
16a220c
Update local OTP url structures
HenrikSundell Oct 2, 2024
b8b82be
Update list of feeds with vehicle positions
optionsome Nov 2, 2024
bd8b80d
Write documentation about new canceled trips query
optionsome Nov 2, 2024
56ed2c3
Remove routing-api preview
optionsome Nov 2, 2024
5cfc546
Update real-time information documentation
optionsome Nov 2, 2024
300ed19
Update routing api index
optionsome Nov 2, 2024
eebe189
Move the fuzzyTrip documentation to HFP docs
optionsome Nov 2, 2024
17425ab
Update graphql index
optionsome Nov 2, 2024
c62858c
Update bicycling doc to contain info about cars and e-scooters as well
optionsome Nov 4, 2024
e2d25c2
Fix typo
optionsome Nov 4, 2024
b504362
Add page for translations
optionsome Nov 4, 2024
5365237
Add missing steps
optionsome Nov 4, 2024
61c8596
Update disruption info
optionsome Nov 4, 2024
599aaa1
Update page order
optionsome Nov 4, 2024
4e662ac
Update itinerary planning
optionsome Nov 4, 2024
c744031
Small adjustment
optionsome Nov 4, 2024
89fb886
Update map documentation
optionsome Nov 4, 2024
33f5dab
Update realtime page description
optionsome Nov 4, 2024
9e224dd
Remove references to old cancelled trip times query
optionsome Nov 4, 2024
dc142db
Update some random pages
optionsome Nov 4, 2024
079fd27
Update routing-api architecture page and move schema documentation un…
optionsome Nov 7, 2024
32aff6b
Fix some broken github links
optionsome Nov 7, 2024
5305f4a
Remove a couple of pages we don't want to maintain
optionsome Nov 7, 2024
26b3bd4
Update map architecture doc
optionsome Nov 7, 2024
c23c837
Remove legacy piwik usage
optionsome Nov 8, 2024
ed85dd6
Update SEO description
optionsome Nov 8, 2024
ec184c8
Fix typo
optionsome Nov 8, 2024
340915f
Update list of deployments
optionsome Nov 8, 2024
756a284
Change title for links and couple of link updates
optionsome Nov 8, 2024
a424db7
Update routing-api diagram and link to data building page from routin…
optionsome Nov 8, 2024
8338b0a
Add missing period
optionsome Nov 8, 2024
257637b
Update map architecture diagram
optionsome Nov 8, 2024
619e9cd
Edit DockerInfo component to make sense without some props
optionsome Nov 8, 2024
516d9fa
Update ui service doc
optionsome Nov 8, 2024
6d32136
Specify docker tag
optionsome Nov 8, 2024
cb858a4
Merge branch 'master' into DT-6111
optionsome Nov 8, 2024
bdeb29c
Update routing data diagrams
optionsome Nov 9, 2024
5f1e846
Update routing-data doc
optionsome Nov 9, 2024
19363c5
Create own api page for routing data
optionsome Nov 9, 2024
7d6b4cc
Fix architecture link
optionsome Nov 9, 2024
4e7883a
Refactor and slightly update geocoding documentation
optionsome Nov 9, 2024
564314e
Adjust page titles
optionsome Nov 9, 2024
c6a9482
Reane services to user-interfaces
optionsome Nov 9, 2024
82cdb85
Remove xml format architecture images
optionsome Nov 11, 2024
86a5cac
Add 3rd party digitransit deployments
optionsome Nov 11, 2024
141d762
Fix spelling
optionsome Nov 11, 2024
f855ad9
Apply review suggestions
optionsome Nov 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/components/DockerInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ export default props => {
<div>
<h2>Docker image</h2>
<p>
The resulting Docker image is called{" "}
The Docker image is called{" "}
<strong>{props.docker.imageName}</strong> and it is available at{" "}
<a href={"https://hub.docker.com/r/" + props.docker.imageName}>
{" "}
DockerHub
</a>
. The image can be built using this{" "}
<a href={props.docker.buildScript}>build script</a>.
.
{props.docker.buildScript && (
<span>&nbsp;The image can be built using this{" "}
<a href={props.docker.buildScript}>build script</a>.
</span>
)}
</p>
<p>
To run Docker container, run:
Expand Down
2 changes: 1 addition & 1 deletion src/components/SEO.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default ({ pageTitle, pageDescription, pagePath }) => (

const description =
pageDescription ||
"HSL:n reittiopas.hsl.fi ja Traficomin opas.matka.fi uudistuivat. Apuasi kaivataan kehitystyössä.";
"Uuden ajan reittioppaan käyttöliittymät ja rajapinnat.";

const shareImageUrl = "http://digitransit.fi/share-image.png";

Expand Down
26 changes: 0 additions & 26 deletions src/html.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,32 +81,6 @@ export default class HTML extends React.Component {
id="___gatsby"
dangerouslySetInnerHTML={{ __html: this.props.body }}
/>
<script
type="text/javascript"
dangerouslySetInnerHTML={{
__html: `
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//piwik.digitransit.fi/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
`
}}
/>
<noscript>
<p>
<img
src="//piwik.digitransit.fi/piwik.php?idsite=1"
style={{ border: 0 }}
alt=""
/>
</p>
</noscript>
{this.props.postBodyComponents}
</body>
</html>
Expand Down
64 changes: 15 additions & 49 deletions src/pages/en/developers/apis/1-routing-api/0-graphql/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: GraphQL
# replit:
# title: "Examples"
# note: "The examples below send a GraphQL query using HTTP POST to <code>https://api.digitransit.fi/routing/v1/routers/hsl/index/graphql</code>. This example query asks the server to find a stop with the ID <i>HSL:1040129</i> and return its name, latitude and longitude coordinates, and whether is is accessible by wheelchair.<br/><b>Note:</b> If the examples provided do not return expected results, the stop id may not be in use any more and you should try again with an existing id."
# note: "The examples below send a GraphQL query using HTTP POST to <code>https://api.digitransit.fi/routing/v2/hsl/gtfs/v1</code>. This example query asks the server to find a stop with the ID <i>HSL:1040129</i> and return its name, latitude and longitude coordinates, and whether is is accessible by wheelchair.<br/><b>Note:</b> If the examples provided do not return expected results, the stop id may not be in use any more and you should try again with an existing id."
# embeds:
# -
# title: "Content-Type: application/graphql"
Expand Down Expand Up @@ -70,17 +70,17 @@ The following queries would request a stop with id `HSL:1173434` and return its

### IDs

All objects in the GraphQL API have a global ID (field `id`), which can be used as a cache key or to refetch the object using query type **node**.
Some objects in the GraphQL API have a global ID (field `id`), which can be used as a cache key or to refetch the object using query type **node**.

Global IDs in the Routing API are defined by [Relay](https://facebook.github.io/relay/graphql/objectidentification.htm) and should not be confused with other IDs (such as `gtfsId`) that objects may have.

### Interfaces
optionsome marked this conversation as resolved.
Show resolved Hide resolved

GraphQL supports interfaces, which objects can implement by including fields required by the interface. Two interfaces used in the Routing API are **Node** (which has the field `id` used for global IDs) and **PlaceInterface**.
GraphQL supports interfaces, which objects can implement by including fields required by the interface.

If a query type returns an interface, [inline fragments](https://graphql.org/learn/queries/#inline-fragments) have to be used to access fields defined by the object implementing the interface.

For example, query type **nearest** returns a list of **PlaceInterfaces** and types **BikePark** and **Stop** implement **PlaceInterface**.<br/>
For example, query type **nearest** returns a list of **PlaceInterfaces** and types **VehicleParking** and **Stop** implement **PlaceInterface**.<br/>
The following query returns field `spacesAvailable` for bike parks and field `code` for stops.
```graphql
{
Expand All @@ -95,10 +95,10 @@ The following query returns field `spacesAvailable` for bike parks and field `co
gtfsId
code
}
...on BikePark {
...on VehicleParking {
vehicleParkingId
name
bikeParkId
spacesAvailable
bicyclePlaces
}
}
distance
Expand Down Expand Up @@ -131,49 +131,11 @@ For example, the following query would request a route with name `550` (using *R
}
```

### <a name="batching"></a>Batching

Multiple queries can be combined and sent in one POST request. Batched queries require less server roundtrips and can be processed more efficiently on the server.

For example, the following query would request a stop with id `HSL:1173434` and a route with id `HSL:1009`:
```graphql
{
stop(id: "HSL:1173434") {
name
lat
lon
routes {
shortName
longName
}
}
route(id: "HSL:1009") {
shortName
longName
}
}
```

If the request includes multiple queries with same type, they must be renamed using aliases. For example, the following query would request two routes and return them as `route1` and `route2`:

```graphql
{
route1: route(id: "HSL:2550") {
shortName
longName
}
route2: route(id: "HSL:2551") {
shortName
longName
}
}
```

### Pagination
* Query types which support pagination can be used without pagination by omitting arguments `first` and `after`, in which case all data is returned on one page

Some query types support pagination, which can be used to limit the amount of data returned per query.
<br/>Query types which support pagination return a [Relay cursor connection](https://facebook.github.io/relay/graphql/connections.htm) to the data.
<br/>Query types which support pagination return a [Relay cursor connection](https://relay.dev/graphql/connections.htm) to the data.

For example, **stopsByRadius** supports pagination. The following query requests stops within 300m of 60.19924, 24.94112 and returns 2 stops per page (argument `first`).
```graphql
Expand Down Expand Up @@ -299,11 +261,15 @@ An example response:
In most cases, a GraphQL client should be used instead of plain HTTP requests, as GraphQL clients have many useful features (such as caching, batching and validating queries), which would otherwise have to be implemented manually.

Two commonly used GraphQL clients are
* [Relay](http://facebook.github.io/relay/en/) by Facebook, supports React
* [Apollo](https://www.apollographql.com/client), supports multiple development platforms, including Android and iOS
* [Relay](https://relay.dev/) by Facebook, supports React
* [Apollo](https://www.apollographql.com/), supports multiple development platforms, including Android and iOS

### GraphQL schema

The current development version of the schema is available [here](https://raw.githubusercontent.com/HSLdevcom/OpenTripPlanner/refs/heads/dev-2.x/application/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls). It might not always match the production version completely. The production schema can be accessed either by browsing the files from our latest [release in Github](https://github.com/HSLdevcom/OpenTripPlanner/releases) or by running [this example in GraphQL console](<https://api.digitransit.fi/graphiql/hsl/v2?query=query%2520IntrospectionQuery%2520%257B%250A%2520%2520__schema%2520%257B%250A%2520%2520%2520%2520queryType%2520%257B%250A%2520%2520%2520%2520%2520%2520name%250A%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520mutationType%2520%257B%250A%2520%2520%2520%2520%2520%2520name%250A%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520subscriptionType%2520%257B%250A%2520%2520%2520%2520%2520%2520name%250A%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520types%2520%257B%250A%2520%2520%2520%2520%2520%2520...FullType%250A%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520directives%2520%257B%250A%2520%2520%2520%2520%2520%2520name%250A%2520%2520%2520%2520%2520%2520description%250A%2520%2520%2520%2520%2520%2520locations%250A%2520%2520%2520%2520%2520%2520args%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520...InputValue%250A%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%257D%250A%2520%2520%257D%250A%257D%250A%250Afragment%2520FullType%2520on%2520__Type%2520%257B%250A%2520%2520kind%250A%2520%2520name%250A%2520%2520description%250A%2520%2520fields%28includeDeprecated%253A%2520true%29%2520%257B%250A%2520%2520%2520%2520name%250A%2520%2520%2520%2520description%250A%2520%2520%2520%2520args%2520%257B%250A%2520%2520%2520%2520%2520%2520...InputValue%250A%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520type%2520%257B%250A%2520%2520%2520%2520%2520%2520...TypeRef%250A%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520isDeprecated%250A%2520%2520%2520%2520deprecationReason%250A%2520%2520%257D%250A%2520%2520inputFields%2520%257B%250A%2520%2520%2520%2520...InputValue%250A%2520%2520%257D%250A%2520%2520interfaces%2520%257B%250A%2520%2520%2520%2520...TypeRef%250A%2520%2520%257D%250A%2520%2520enumValues%28includeDeprecated%253A%2520true%29%2520%257B%250A%2520%2520%2520%2520name%250A%2520%2520%2520%2520description%250A%2520%2520%2520%2520isDeprecated%250A%2520%2520%2520%2520deprecationReason%250A%2520%2520%257D%250A%2520%2520possibleTypes%2520%257B%250A%2520%2520%2520%2520...TypeRef%250A%2520%2520%257D%250A%257D%250A%250Afragment%2520InputValue%2520on%2520__InputValue%2520%257B%250A%2520%2520name%250A%2520%2520description%250A%2520%2520type%2520%257B%250A%2520%2520%2520%2520...TypeRef%250A%2520%2520%257D%250A%2520%2520defaultValue%250A%257D%250A%250Afragment%2520TypeRef%2520on%2520__Type%2520%257B%250A%2520%2520kind%250A%2520%2520name%250A%2520%2520ofType%2520%257B%250A%2520%2520%2520%2520kind%250A%2520%2520%2520%2520name%250A%2520%2520%2520%2520ofType%2520%257B%250A%2520%2520%2520%2520%2520%2520kind%250A%2520%2520%2520%2520%2520%2520name%250A%2520%2520%2520%2520%2520%2520ofType%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520kind%250A%2520%2520%2520%2520%2520%2520%2520%2520name%250A%2520%2520%2520%2520%2520%2520%2520%2520ofType%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520kind%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520name%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520ofType%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520kind%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520name%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520ofType%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520kind%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520name%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520ofType%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520kind%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520name%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%257D%250A%2520%2520%257D%250A%257D%250A&operationName=IntrospectionQuery>)

## Further reading

* The [GraphQL site](https://graphql.org/learn/) provides more information on how to use GraphQL
* [How Facebook sees GraphQL](https://facebook.github.io/relay/docs/thinking-in-graphql.html)
* [Thinking in GraphQL](https://relay.dev/docs/principles-and-architecture/thinking-in-graphql/)

16 changes: 10 additions & 6 deletions src/pages/en/developers/apis/1-routing-api/1-graphiql/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ order: 20

### There are a few options for using GraphiQL:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The images in this file seem a bit outdated. You can take some new screenshots and replace the old ones and check if the instructions still follow the new look.


1. Using our hosted browser versions for the three available regions. The browser versions have the correct endpoints configured already.
1. Using our hosted browser versions for the five available regions. The browser versions have the correct endpoints configured already.
* [Helsinki region](https://api.digitransit.fi/graphiql/hsl)
* [Waltti regions](https://api.digitransit.fi/graphiql/waltti)
* [Waltti-Opas regions](https://api.digitransit.fi/graphiql/waltti-alt)
* [Seutu+ regions](https://api.digitransit.fi/graphiql/varely)
* [Entire Finland](https://api.digitransit.fi/graphiql/finland)
2. A browser extension like [ChromeiQL](https://chrome.google.com/webstore/detail/chromeiql/fkkiamalmpiidkljmicmjfbieiclmeij) (see regional endpoints below)
3. For Mac OSX you can use [the desktop GraphiQL app](https://github.com/skevy/graphiql-app) (see regional endpoints below)
Expand All @@ -28,11 +30,13 @@ All options work similarly and their UI looks more or less like this (ChromeiQL

1. If you are using the GraphiQL app or a browser extension, set the GraphQL Endpoint to one of the following:

| Region | Endpoint |
|-----------------|----------------------------------------------------------------------|
| Helsinki region | `https://api.digitransit.fi/routing/v1/routers/hsl/index/graphql` |
| Waltti regions | `https://api.digitransit.fi/routing/v1/routers/waltti/index/graphql` |
| Entire Finland | `https://api.digitransit.fi/routing/v1/routers/finland/index/graphql` |
| Region | Endpoint |
|---------------------|--------------------------------------------------------------------------|
| Helsinki region | `https://api.digitransit.fi/routing/v2/hsl/gtfs/v1` |
| Waltti regions | `https://api.digitransit.fi/routing/v2/waltti/gtfs/v1` |
| Waltti-Opas region | `https://api.digitransit.fi/routing/v2/waltti-alt/gtfs/v1` |
| Seutu+ region | `https://api.digitransit.fi/routing/v2/varely/gtfs/v1` |
| Entire Finland | `https://api.digitransit.fi/routing/v2/finland/gtfs/v1` |

2. Click [this link](https://api.digitransit.fi/graphiql/hsl?query=%7B%0A%20%20stop(id%3A%20%22HSL%3A1040129%22)%20%7B%0A%20%20%20%20name%0A%20%20%20%20lat%0A%20%20%20%20lon%0A%20%20%20%20wheelchairBoarding%0A%20%20%7D%0A%7D) to run the query below in GraphiQL.

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: Real-time information
order: 40
---

The routing API backend is connected to real-time information for some routes. This means that API queries can return real-time information.

**Note:** Real-time information is not always available and somtimes can be potentially slightly inaccurate.

## What does real-time mean?
Real-time means in this context prediction of arrival and departure times, trip cancellations, partial trip cancellations and occupancy status for vehicles that operate on routes.

## How do I know when data is real-time?
Real-time estimates are enabled by default when making itinerary planning requests. Availability of real-time estimates is not guaranteed, but field `realTime` (*true* / *false*) in each leg of the itinerary will indicate whether that leg's arrival / departure time is using real-time or static timetables. When using real-time, it means that uncertainty for arrival time is less than for purely static timetable data.

Real-time estimates for itinerary planning can be turned off by using the argument `preferences: {transit: {timetable: {excludeRealTimeUpdates: true}}}` of **planConnection** query. Setting this to true will mean that the static timetables will be used in routing.

Departures that have been cancelled through a real-time feed can be included using the arguments `preferences: {transit: {timetable: {includeRealTimeCancelations: true}}}` of **planConnection**. This means that an itinerary can include a cancelled departure while some other alternative that contains no cancellations could be filtered out as the alternative containing a cancellation would normally be better.

For stop timetables and route timetables, real-time estimates are available from stop times through `realtimeArrival` and `realtimeDeparture` fields or from leg's `start` and `end` `estimated` field. Note that in stop times, these fields will have the static arrival / departure time by default and field `realtime` indicates whether the values of those fields have been updated from a real-time source.

## Occupancy information
Some vehicles might have real-time occupancy information available. This information can be accessed through `Trip` type's `occupancy` field.

**Note:** Currently, this information is always the current state (or the last known state). There is no occupancy prediction data available.
Loading