Skip to content

Commit

Permalink
at: Add 2025 feeds
Browse files Browse the repository at this point in the history
  • Loading branch information
jbruechert committed Dec 1, 2024
1 parent 00ffde1 commit ff0553c
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 48 deletions.
93 changes: 66 additions & 27 deletions feeds/at.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
],
"sources": [
{
"name": "PTA-Eastern-Region-Flex",
"name": "Linz-AG-2024",
"type": "http",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/80/2024/file",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/69/2024/file",
"license": {
"url": "https://mobilitaetsverbuende.atlassian.net/wiki/spaces/DBP/pages/185237505/Terms+of+Use"
},
Expand All @@ -28,9 +28,9 @@
}
},
{
"name": "PTA-Styria-Flex",
"name": "Linz-AG-2025",
"type": "http",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/79/2024/file",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/69/2025/file",
"license": {
"url": "https://mobilitaetsverbuende.atlassian.net/wiki/spaces/DBP/pages/185237505/Terms+of+Use"
},
Expand All @@ -41,9 +41,9 @@
}
},
{
"name": "PTA-Carinthia-Flex",
"name": "Railway-Current-Reference-Data-2024",
"type": "http",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/78/2024/file",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/66/2024/file",
"license": {
"url": "https://mobilitaetsverbuende.atlassian.net/wiki/spaces/DBP/pages/185237505/Terms+of+Use"
},
Expand All @@ -54,9 +54,9 @@
}
},
{
"name": "PTA-Upper-Austria-Flex",
"name": "Railway-Current-Reference-Data-2025",
"type": "http",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/77/2024/file",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/66/2025/file",
"license": {
"url": "https://mobilitaetsverbuende.atlassian.net/wiki/spaces/DBP/pages/185237505/Terms+of+Use"
},
Expand All @@ -67,9 +67,9 @@
}
},
{
"name": "PTA-Vorarlberg-Flex",
"name": "PTA-Vorarlberg-2024",
"type": "http",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/75/2024/file",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/58/2024/file",
"license": {
"url": "https://mobilitaetsverbuende.atlassian.net/wiki/spaces/DBP/pages/185237505/Terms+of+Use"
},
Expand All @@ -80,9 +80,9 @@
}
},
{
"name": "PTA-Salzburg-Flex",
"name": "PTA-Vorarlberg-2025",
"type": "http",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/73/2024/file",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/58/2025/file",
"license": {
"url": "https://mobilitaetsverbuende.atlassian.net/wiki/spaces/DBP/pages/185237505/Terms+of+Use"
},
Expand All @@ -93,9 +93,9 @@
}
},
{
"name": "Linz-AG",
"name": "PTA-Tyrol-2024",
"type": "http",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/69/2024/file",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/57/2024/file",
"license": {
"url": "https://mobilitaetsverbuende.atlassian.net/wiki/spaces/DBP/pages/185237505/Terms+of+Use"
},
Expand All @@ -106,9 +106,9 @@
}
},
{
"name": "Railway-Current-Reference-Data",
"name": "PTA-Tyrol-2025",
"type": "http",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/66/2024/file",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/57/2025/file",
"license": {
"url": "https://mobilitaetsverbuende.atlassian.net/wiki/spaces/DBP/pages/185237505/Terms+of+Use"
},
Expand All @@ -119,9 +119,9 @@
}
},
{
"name": "PTA-Vorarlberg",
"name": "PTA-Upper-Austria-2024",
"type": "http",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/58/2024/file",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/56/2024/file",
"license": {
"url": "https://mobilitaetsverbuende.atlassian.net/wiki/spaces/DBP/pages/185237505/Terms+of+Use"
},
Expand All @@ -132,9 +132,9 @@
}
},
{
"name": "PTA-Tyrol",
"name": "PTA-Upper-Austria-2025",
"type": "http",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/57/2024/file",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/56/2025/file",
"license": {
"url": "https://mobilitaetsverbuende.atlassian.net/wiki/spaces/DBP/pages/185237505/Terms+of+Use"
},
Expand All @@ -145,9 +145,9 @@
}
},
{
"name": "PTA-Upper-Austria",
"name": "PTA-Carinthia-2024",
"type": "http",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/56/2024/file",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/55/2024/file",
"license": {
"url": "https://mobilitaetsverbuende.atlassian.net/wiki/spaces/DBP/pages/185237505/Terms+of+Use"
},
Expand All @@ -158,9 +158,9 @@
}
},
{
"name": "PTA-Carinthia",
"name": "PTA-Carinthia-2025",
"type": "http",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/55/2024/file",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/55/2025/file",
"license": {
"url": "https://mobilitaetsverbuende.atlassian.net/wiki/spaces/DBP/pages/185237505/Terms+of+Use"
},
Expand All @@ -171,7 +171,7 @@
}
},
{
"name": "PTA-Salzburg",
"name": "PTA-Salzburg-2024",
"type": "http",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/54/2024/file",
"license": {
Expand All @@ -184,7 +184,20 @@
}
},
{
"name": "PTA-Styria",
"name": "PTA-Salzburg-2025",
"type": "http",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/54/2025/file",
"license": {
"url": "https://mobilitaetsverbuende.atlassian.net/wiki/spaces/DBP/pages/185237505/Terms+of+Use"
},
"fix": true,
"function": "mvo_keycloak_token",
"http-options": {
"fetch-interval-days": 2
}
},
{
"name": "PTA-Styria-2024",
"type": "http",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/53/2024/file",
"license": {
Expand All @@ -197,7 +210,20 @@
}
},
{
"name": "PTA-Eastern-Region",
"name": "PTA-Styria-2025",
"type": "http",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/53/2025/file",
"license": {
"url": "https://mobilitaetsverbuende.atlassian.net/wiki/spaces/DBP/pages/185237505/Terms+of+Use"
},
"fix": true,
"function": "mvo_keycloak_token",
"http-options": {
"fetch-interval-days": 2
}
},
{
"name": "PTA-Eastern-Region-2024",
"type": "http",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/52/2024/file",
"license": {
Expand All @@ -208,6 +234,19 @@
"http-options": {
"fetch-interval-days": 2
}
},
{
"name": "PTA-Eastern-Region-2025",
"type": "http",
"url": "https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/52/2025/file",
"license": {
"url": "https://mobilitaetsverbuende.atlassian.net/wiki/spaces/DBP/pages/185237505/Terms+of+Use"
},
"fix": true,
"function": "mvo_keycloak_token",
"http-options": {
"fetch-interval-days": 2
}
}
]
}
50 changes: 29 additions & 21 deletions src/generate-austria.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import requests
import json

CURRENT_TIMETABLE_YEAR = 2024
TIMETABLE_YEARS = [2024, 2025]


def remove_duplicate_dashes(text: str) -> str:
Expand All @@ -24,6 +24,28 @@ def remove_duplicate_dashes(text: str) -> str:
return "".join(out)


def add_feed(sources: list[dict], year: int):
url = f"https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/{set_id}/{year}/file"
sources.append(
{
"name": remove_duplicate_dashes(
data_set["nameEn"]
.replace("Timetable Data", "")
.replace("(GTFS)", "")
.strip()
.replace(" ", "-")) + "-" + str(year),
"type": "http",
"url": url,
"license": {"url": data_set["termsOfUseUrlEn"]},
"fix": True,
"function": "mvo_keycloak_token",
"http-options": {
"fetch-interval-days": 2
}
}
)


if __name__ == "__main__":
ignore = [
"70", # Same data but outdated
Expand All @@ -34,32 +56,18 @@ def remove_duplicate_dashes(text: str) -> str:
"https://data.mobilitaetsverbuende.at/api/public/v1/data-sets?tagIds=20&tagFilterModeInclusive=false"
).json()

sources = []
sources: list[dict] = []

for data_set in data_sets:
set_id = data_set["id"]
if set_id in ignore:
continue

url = f"https://data.mobilitaetsverbuende.at/api/public/v1/data-sets/{set_id}/{CURRENT_TIMETABLE_YEAR}/file"
sources.append(
{
"name": remove_duplicate_dashes(
data_set["nameEn"]
.replace("Timetable Data", "")
.replace("(GTFS)", "")
.strip()
.replace(" ", "-")),
"type": "http",
"url": url,
"license": {"url": data_set["termsOfUseUrlEn"]},
"fix": True,
"function": "mvo_keycloak_token",
"http-options": {
"fetch-interval-days": 2
}
}
)
if "Flex" in data_set["nameEn"]:
continue

for year in TIMETABLE_YEARS:
add_feed(sources, year)

region = {}

Expand Down

0 comments on commit ff0553c

Please sign in to comment.