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

SIRI-FM vehicle parking updates #5979

Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
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: 10 additions & 0 deletions doc-templates/VehicleParking.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ All updaters have the following parameters in common:

<!-- INSERT: bikeep -->

## SIRI-FM

The SIRI-FM updaters works slighly differently from the other in that it only updates the availability
of parking but does not create new lots in realtime.

The data source must conform to the [Italian SIRI-FM](https://github.com/5Tsrl/siri-italian-profile) profile
requires SIRI 2.1.

<!-- INSERT: siri-fm -->

## Changelog

- Create initial sandbox implementation (January 2022, [#3796](https://github.com/opentripplanner/OpenTripPlanner/pull/3796))
Expand Down
6 changes: 6 additions & 0 deletions docs/RouterConfiguration.md
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,12 @@ Used to group requests when monitoring OTP.
"feedId" : "bikeep",
"sourceType" : "bikeep",
"url" : "https://services.bikeep.com/location/v1/public-areas/no-baia-mobility/locations"
},
{
"type" : "vehicle-parking",
"feedId" : "parking",
"sourceType" : "siri-fm",
"url" : "https://transmodel.api.opendatahub.com/siri-lite/fm/parking"
}
],
"rideHailingServices" : [
Expand Down
101 changes: 91 additions & 10 deletions docs/sandbox/VehicleParking.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ All updaters have the following parameters in common:

The id of the data source, which will be the prefix of the parking lot's id.

This will end up in the API responses as the feed id of of the parking lot.
This will end up in the API responses as the feed id of the parking lot.

<h4 id="u__2__sourceType">sourceType</h4>

**Since version:** `2.2` ∙ **Type:** `enum` ∙ **Cardinality:** `Required`
**Path:** /updaters/[2]
**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `noi-open-data-hub` | `bikeep`
**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `noi-open-data-hub` | `bikeep` | `siri-fm`

The source of the vehicle updates.

Expand Down Expand Up @@ -125,13 +125,13 @@ Used for converting abstract opening hours into concrete points in time.

The id of the data source, which will be the prefix of the parking lot's id.

This will end up in the API responses as the feed id of of the parking lot.
This will end up in the API responses as the feed id of the parking lot.

<h4 id="u__3__sourceType">sourceType</h4>

**Since version:** `2.2` ∙ **Type:** `enum` ∙ **Cardinality:** `Required`
**Path:** /updaters/[3]
**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `noi-open-data-hub` | `bikeep`
**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `noi-open-data-hub` | `bikeep` | `siri-fm`

The source of the vehicle updates.

Expand Down Expand Up @@ -210,13 +210,13 @@ Tags to add to the parking lots.

The id of the data source, which will be the prefix of the parking lot's id.

This will end up in the API responses as the feed id of of the parking lot.
This will end up in the API responses as the feed id of the parking lot.

<h4 id="u__4__sourceType">sourceType</h4>

**Since version:** `2.2` ∙ **Type:** `enum` ∙ **Cardinality:** `Required`
**Path:** /updaters/[4]
**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `noi-open-data-hub` | `bikeep`
**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `noi-open-data-hub` | `bikeep` | `siri-fm`

The source of the vehicle updates.

Expand Down Expand Up @@ -275,13 +275,13 @@ HTTP headers to add to the request. Any header key, value can be inserted.

The id of the data source, which will be the prefix of the parking lot's id.

This will end up in the API responses as the feed id of of the parking lot.
This will end up in the API responses as the feed id of the parking lot.

<h4 id="u__5__sourceType">sourceType</h4>

**Since version:** `2.2` ∙ **Type:** `enum` ∙ **Cardinality:** `Required`
**Path:** /updaters/[5]
**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `noi-open-data-hub` | `bikeep`
**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `noi-open-data-hub` | `bikeep` | `siri-fm`

The source of the vehicle updates.

Expand Down Expand Up @@ -336,13 +336,13 @@ HTTP headers to add to the request. Any header key, value can be inserted.

The id of the data source, which will be the prefix of the parking lot's id.

This will end up in the API responses as the feed id of of the parking lot.
This will end up in the API responses as the feed id of the parking lot.

<h4 id="u__14__sourceType">sourceType</h4>

**Since version:** `2.2` ∙ **Type:** `enum` ∙ **Cardinality:** `Required`
**Path:** /updaters/[14]
**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `noi-open-data-hub` | `bikeep`
**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `noi-open-data-hub` | `bikeep` | `siri-fm`

The source of the vehicle updates.

Expand Down Expand Up @@ -373,6 +373,87 @@ HTTP headers to add to the request. Any header key, value can be inserted.

<!-- bikeep END -->

## SIRI-FM

The SIRI-FM updaters works slighly differently from the other in that it only updates the availability
of parking but does not create new lots in realtime.

The data source must conform to the [Italian SIRI-FM](https://github.com/5Tsrl/siri-italian-profile) profile
requires SIRI 2.1.

<!-- siri-fm BEGIN -->
<!-- NOTE! This section is auto-generated. Do not change, change doc in code instead. -->

| Config Parameter | Type | Summary | Req./Opt. | Default Value | Since |
|----------------------------------|:---------------:|------------------------------------------------------------------------------|:----------:|---------------|:-----:|
| type = "vehicle-parking" | `enum` | The type of the updater. | *Required* | | 1.5 |
| [feedId](#u__15__feedId) | `string` | The id of the data source, which will be the prefix of the parking lot's id. | *Required* | | 2.2 |
| frequency | `duration` | How often to update the source. | *Optional* | `"PT1M"` | 2.6 |
| [sourceType](#u__15__sourceType) | `enum` | The source of the vehicle updates. | *Required* | | 2.2 |
| [url](#u__15__url) | `uri` | URL of the SIRI-FM Light endpoint. | *Required* | | 2.6 |
| [headers](#u__15__headers) | `map of string` | HTTP headers to add to the request. Any header key, value can be inserted. | *Optional* | | 2.6 |


#### Details

<h4 id="u__15__feedId">feedId</h4>

**Since version:** `2.2` ∙ **Type:** `string` ∙ **Cardinality:** `Required`
**Path:** /updaters/[15]

The id of the data source, which will be the prefix of the parking lot's id.

This will end up in the API responses as the feed id of the parking lot.

<h4 id="u__15__sourceType">sourceType</h4>

**Since version:** `2.2` ∙ **Type:** `enum` ∙ **Cardinality:** `Required`
**Path:** /updaters/[15]
**Enum values:** `park-api` | `bicycle-park-api` | `hsl-park` | `bikely` | `noi-open-data-hub` | `bikeep` | `siri-fm`

The source of the vehicle updates.

<h4 id="u__15__url">url</h4>

**Since version:** `2.6` ∙ **Type:** `uri` ∙ **Cardinality:** `Required`
**Path:** /updaters/[15]

URL of the SIRI-FM Light endpoint.

SIRI Light means that it must be available as a HTTP GET request rather than the usual
SIRI request mechanism of HTTP POST.

The contents must also conform to the [Italian SIRI profile](https://github.com/5Tsrl/siri-italian-profile)
which requires SIRI 2.1.


<h4 id="u__15__headers">headers</h4>

**Since version:** `2.6` ∙ **Type:** `map of string` ∙ **Cardinality:** `Optional`
**Path:** /updaters/[15]

HTTP headers to add to the request. Any header key, value can be inserted.



##### Example configuration

```JSON
// router-config.json
{
"updaters" : [
{
"type" : "vehicle-parking",
"feedId" : "parking",
"sourceType" : "siri-fm",
"url" : "https://transmodel.api.opendatahub.com/siri-lite/fm/parking"
}
]
}
```

<!-- siri-fm END -->

## Changelog

- Create initial sandbox implementation (January 2022, [#3796](https://github.com/opentripplanner/OpenTripPlanner/pull/3796))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.opentripplanner.ext.vehicleparking.sirifm;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.time.Duration;
import org.junit.jupiter.api.Test;
import org.opentripplanner.test.support.ResourceLoader;
import org.opentripplanner.updater.spi.HttpHeaders;

class SiriFmUpdaterTest {

@Test
void parse() {
var uri = ResourceLoader.of(this).uri("siri-fm.xml");
var parameters = new SiriFmUpdaterParameters(
"noi",
uri,
"noi",
Duration.ofSeconds(30),
HttpHeaders.empty()
);
var updater = new SiriFmDatasource(parameters);
updater.update();
var updates = updater.getUpdates();

assertEquals(4, updates.size());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<Siri version="2.1"
xmlns="http://www.siri.org.uk/siri"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.siri.org.uk/siri">
<ServiceDelivery>
<ResponseTimestamp>2024-07-17T11:07:40Z</ResponseTimestamp>
<ProducerRef>RAP Alto Adige - Open Data Hub</ProducerRef>
<FacilityMonitoringDelivery>
<ResponseTimestamp>2024-07-17T11:07:40Z</ResponseTimestamp>
<ProducerRef>RAP Alto Adige - Open Data Hub</ProducerRef>
<FacilityCondition>
<FacilityRef>IT:ITH10:Parking:105</FacilityRef>
<FacilityStatus>
<Status>available</Status>
</FacilityStatus>
<MonitoredCounting>
<CountingType>presentCount</CountingType>
<CountedFeatureUnit>bays</CountedFeatureUnit>
<Count>33</Count>
</MonitoredCounting>
</FacilityCondition>
<FacilityCondition>
<FacilityRef>IT:ITH10:Parking:TRENTO_areaexsitviacanestrinip1</FacilityRef>
<FacilityStatus>
<Status>notAvailable</Status>
</FacilityStatus>
<MonitoredCounting>
<CountingType>presentCount</CountingType>
<CountedFeatureUnit>bays</CountedFeatureUnit>
<Count>300</Count>
</MonitoredCounting>
</FacilityCondition>
<FacilityCondition>
<FacilityRef>IT:ITH10:Parking:TRENTO_autosilobuonconsigliop3</FacilityRef>
<FacilityStatus>
<Status>notAvailable</Status>
</FacilityStatus>
<MonitoredCounting>
<CountingType>presentCount</CountingType>
<CountedFeatureUnit>bays</CountedFeatureUnit>
<Count>633</Count>
</MonitoredCounting>
</FacilityCondition>
<FacilityCondition>
<FacilityRef>IT:ITH10:Parking:TRENTO_cteviabomportop6</FacilityRef>
<FacilityStatus>
<Status>notAvailable</Status>
</FacilityStatus>
<MonitoredCounting>
<CountingType>presentCount</CountingType>
<CountedFeatureUnit>bays</CountedFeatureUnit>
<Count>250</Count>
</MonitoredCounting>
</FacilityCondition>
</FacilityMonitoringDelivery>
</ServiceDelivery>
</Siri>
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.opentripplanner.ext.vehicleparking.bikeep;

import static org.opentripplanner.updater.vehicle_parking.VehicleParkingUpdaterParameters.UpdateType.FULL;

import java.net.URI;
import java.time.Duration;
import org.opentripplanner.updater.spi.HttpHeaders;
Expand All @@ -22,4 +24,9 @@ public record BikeepUpdaterParameters(
public VehicleParkingSourceType sourceType() {
return VehicleParkingSourceType.BIKEEP;
}

@Override
public UpdateType updateType() {
return FULL;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.opentripplanner.ext.vehicleparking.bikely;

import static org.opentripplanner.updater.vehicle_parking.VehicleParkingUpdaterParameters.UpdateType.FULL;

import java.net.URI;
import java.time.Duration;
import org.opentripplanner.updater.spi.HttpHeaders;
Expand All @@ -22,4 +24,9 @@ public record BikelyUpdaterParameters(
public VehicleParkingSourceType sourceType() {
return VehicleParkingSourceType.BIKELY;
}

@Override
public UpdateType updateType() {
return FULL;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.opentripplanner.ext.vehicleparking.hslpark;

import static org.opentripplanner.updater.vehicle_parking.VehicleParkingUpdaterParameters.UpdateType.FULL;

import java.time.Duration;
import java.time.ZoneId;
import org.opentripplanner.updater.vehicle_parking.VehicleParkingSourceType;
Expand All @@ -25,4 +27,9 @@ public record HslParkUpdaterParameters(
public Duration frequency() {
return Duration.ofSeconds(utilizationsFrequencySec);
}

@Override
public UpdateType updateType() {
return FULL;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.opentripplanner.ext.vehicleparking.noi;

import static org.opentripplanner.updater.vehicle_parking.VehicleParkingUpdaterParameters.UpdateType.FULL;

import java.net.URI;
import java.time.Duration;
import org.opentripplanner.updater.spi.HttpHeaders;
Expand All @@ -22,4 +24,9 @@ public record NoiUpdaterParameters(
public VehicleParkingSourceType sourceType() {
return VehicleParkingSourceType.NOI_OPEN_DATA_HUB;
}

@Override
public UpdateType updateType() {
return FULL;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.opentripplanner.ext.vehicleparking.parkapi;

import static org.opentripplanner.updater.vehicle_parking.VehicleParkingUpdaterParameters.UpdateType.FULL;

import java.time.Duration;
import java.time.ZoneId;
import java.util.List;
Expand All @@ -21,4 +23,9 @@ public record ParkAPIUpdaterParameters(
VehicleParkingSourceType sourceType,
ZoneId timeZone
)
implements VehicleParkingUpdaterParameters {}
implements VehicleParkingUpdaterParameters {
@Override
public UpdateType updateType() {
return FULL;
}
}
Loading
Loading