Skip to content

Commit 2b8b9ae

Browse files
committed
Add Digitraffic rail trains publisher
1 parent a0b2e8b commit 2b8b9ae

10 files changed

Lines changed: 633 additions & 0 deletions
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Finland Digitraffic Rail Live Smoke 2026-05-31
2+
3+
## Scope
4+
5+
Implemented and deployed the Phase 5 Digitraffic Rail live-trains publisher for Finland.
6+
7+
Source endpoints:
8+
9+
```text
10+
https://rata.digitraffic.fi/api/v1/train-locations/latest/
11+
https://rata.digitraffic.fi/api/v1/live-trains
12+
```
13+
14+
No API key is required.
15+
16+
## Local Verification
17+
18+
Command:
19+
20+
```text
21+
py -3 -m publishers.digitraffic_rail_trains.digitraffic_rail_trains_publisher --dry-run --once
22+
```
23+
24+
Result:
25+
26+
```text
27+
Received 80 train positions from Digitraffic Rail
28+
Cycle complete: 80 published, 0 skipped, 0 errors
29+
```
30+
31+
## Live Bootstrap
32+
33+
Bootstrap command on Oracle host:
34+
35+
```text
36+
python3 -m publishers.digitraffic_rail_trains.bootstrap_digitraffic_rail_trains --force-sml
37+
```
38+
39+
Created resources:
40+
41+
| Resource | ID |
42+
| --- | --- |
43+
| Procedure `urn:os4csapi:procedure:digitraffic-rail-trains:v1` | `04j0` |
44+
| System `urn:os4csapi:system:digitraffic-rail-trains-feed:v1` | `067g2` |
45+
| Datastream `digitrafficRailTrainPosition` | `07i02` |
46+
| Root deployment `urn:os4csapi:deployment:digitraffic-rail-trains-demo:v1` | `06j02` |
47+
| Feed deployment `urn:os4csapi:deployment:digitraffic-rail-trains-feed:v1` | `06jg2` |
48+
49+
SensorHub returned HTTP 500 during the system SensorML PUT, matching the known SensorHub quirk where resource persistence can still succeed. The system and datastream were verified afterward through the public proxy.
50+
51+
## Live Publish
52+
53+
One manual publish cycle on the Oracle host succeeded:
54+
55+
```text
56+
Connected: sys=067g2 ds=07i02
57+
Received 80 train positions from Digitraffic Rail
58+
Cycle complete: 80 published, 0 skipped, 0 errors
59+
```
60+
61+
Persistent service installed and started:
62+
63+
```text
64+
digitraffic-rail-trains-publisher.service
65+
```
66+
67+
Service log verification:
68+
69+
```text
70+
Active: active (running)
71+
Connected: sys=067g2 ds=07i02
72+
Received 80 train positions from Digitraffic Rail
73+
Cycle complete: 80 published, 0 skipped, 0 errors
74+
```
75+
76+
## Public Proxy Verification
77+
78+
Verified through:
79+
80+
```text
81+
https://ogc-csapi-explorer.pages.dev/api/osh
82+
```
83+
84+
Representative latest observation response:
85+
86+
| Field | Value |
87+
| --- | --- |
88+
| System ID | `067g2` |
89+
| System name | `Digitraffic Rail Live Trains Feed - Finland` |
90+
| Datastream ID | `07i02` |
91+
| Datastream output | `digitrafficRailTrainPosition` |
92+
| Sample train | `11190` |
93+
| Sample category | `Locomotive` |
94+
| Sample operator | `vr` |
95+
| Sample timestamp | `2026-05-31T08:12:22Z` |
96+
97+
## Notes
98+
99+
The publisher uses a Finland-wide bounding box and caps each cycle at 80 train positions to avoid overwhelming the Explorer map while keeping the source explicitly Finnish.

docs/research/finland-publisher-expansion/Finland_Oracle_Service_Deployment_2026-05-31.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ All services use the host-local environment file:
2727
| Service | Command | Cadence |
2828
| --- | --- | --- |
2929
| `digitraffic-marine-ais-publisher.service` | `python3 -u -m publishers.digitraffic_marine_ais.digitraffic_marine_ais_publisher --interval 300` | 5 min |
30+
| `digitraffic-rail-trains-publisher.service` | `python3 -u -m publishers.digitraffic_rail_trains.digitraffic_rail_trains_publisher --interval 300` | 5 min |
3031
| `digitraffic-road-weather-publisher.service` | `python3 -u -m publishers.digitraffic_road_weather.digitraffic_road_weather_publisher --interval 300` | 5 min |
3132
| `digitraffic-weathercam-publisher.service` | `python3 -u -m publishers.digitraffic_weathercam.digitraffic_weathercam_publisher --interval 300` | 5 min |
3233
| `fmi-weather-publisher.service` | `python3 -u -m publishers.fmi_weather.fmi_weather_publisher --interval 600` | 10 min |
@@ -41,6 +42,7 @@ Observed first service-managed cycles in `journalctl`:
4142
| Source | Result |
4243
| --- | --- |
4344
| Digitraffic Marine AIS | 60 vessels published, 0 skipped, 0 errors |
45+
| Digitraffic Rail Trains | 80 train positions published, 0 skipped, 0 errors |
4446
| Digitraffic Road Weather | 6 stations connected and published, 0 visible errors |
4547
| Digitraffic Weathercam | 6 cameras connected and published, 0 visible errors |
4648
| FMI Weather | 6 stations connected and published, 0 visible errors |
@@ -53,6 +55,7 @@ Verified through `https://ogc-csapi-explorer.pages.dev/api/osh` that fresh obser
5355
| Source | Datastream | Verified timestamp |
5456
| --- | --- | --- |
5557
| Digitraffic Marine AIS | `07hg2` | `2026-05-31T05:25:32Z` |
58+
| Digitraffic Rail Trains | `07i02` | `2026-05-31T08:12:22Z` |
5659
| Digitraffic Road Weather | `075g2` | `2026-05-31T05:25:24Z` |
5760
| Digitraffic Weathercam | `078g2` | `2026-05-31T05:15:49Z` |
5861
| FMI Weather | `07bg2` | `2026-05-31T05:20:00Z` |

publishers/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ server (e.g. [OpenSensorHub](https://opensensorhub.org/)).
2424
| **Met Office DataHub** | Land Observations hourly weather data | Access-gated / 1 h |
2525
| **Met Office Global Spot** | Site-specific deterministic hourly forecasts | Access-gated / 1 h |
2626
| **Digitraffic Marine AIS** | Finnish Fintraffic/Digitraffic AIS vessel positions | 5 min |
27+
| **Digitraffic Rail Trains** | Finnish Fintraffic/Digitraffic live train positions | 5 min |
2728
| **Digitraffic Road Weather** | Finnish Fintraffic/Digitraffic road-weather stations | 5 min |
2829
| **Digitraffic Weathercam** | Finnish Fintraffic/Digitraffic road-camera image references | 5 min |
2930
| **FMI Weather** | Finnish Meteorological Institute weather observations | 10 min |
@@ -71,6 +72,7 @@ python -m publishers.met_office_datahub.bootstrap_met_office_datahub
7172
# Met Office Global Spot is access-gated; see publishers/met_office_global_spot/README.md
7273
python -m publishers.met_office_global_spot.bootstrap_met_office_global_spot
7374
python -m publishers.digitraffic_marine_ais.bootstrap_digitraffic_marine_ais
75+
python -m publishers.digitraffic_rail_trains.bootstrap_digitraffic_rail_trains
7476
python -m publishers.digitraffic_road_weather.bootstrap_digitraffic_road_weather
7577
python -m publishers.digitraffic_weathercam.bootstrap_digitraffic_weathercam
7678
python -m publishers.fmi_weather.bootstrap_fmi_weather
@@ -168,4 +170,6 @@ python -m publishers.nws.nws_publisher --interval 3600
168170
- **Digitraffic Weathercam** attaches image-reference observations to curated
169171
Digitraffic road-weather station systems, using direct Fintraffic JPEG and
170172
thumbnail URLs for road camera presets.
173+
- **Digitraffic Rail Trains** publishes live Finnish train positions from the
174+
public Digitraffic Rail latest-location JSON endpoint.
171175
- All publishers use `--interval <seconds>` and `--dry-run` CLI flags.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM python:3.12-slim
2+
3+
WORKDIR /app
4+
5+
COPY publishers/ /app/publishers/
6+
7+
ENV OSH_ADDRESS=
8+
ENV OSH_PORT=443
9+
ENV OSH_USER=
10+
ENV OSH_PASS=
11+
12+
ENTRYPOINT ["python", "-m", "publishers.digitraffic_rail_trains.digitraffic_rail_trains_publisher"]
13+
CMD ["--interval", "300"]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Digitraffic Rail Trains Publisher
2+
3+
Publishes live Finnish train position observations from the public Fintraffic Digitraffic Rail JSON API.
4+
5+
## Source Endpoints
6+
7+
- Latest train locations: `https://rata.digitraffic.fi/api/v1/train-locations/latest/`
8+
- Live train metadata: `https://rata.digitraffic.fi/api/v1/live-trains`
9+
- Station metadata: `https://rata.digitraffic.fi/api/v1/metadata/stations`
10+
11+
No API key is required.
12+
13+
## Commands
14+
15+
```bash
16+
python -m publishers.digitraffic_rail_trains.bootstrap_digitraffic_rail_trains --dry-run --force-sml
17+
python -m publishers.digitraffic_rail_trains.digitraffic_rail_trains_publisher --dry-run --once
18+
python -m publishers.digitraffic_rail_trains.digitraffic_rail_trains_publisher --interval 300
19+
```
20+
21+
The runtime publisher filters train locations to the configured Finland-wide bounding box and caps each cycle with `max_trains_per_cycle` from `config.json`.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Digitraffic Rail live-train publisher package."""

0 commit comments

Comments
 (0)