From ff0553c3a16378eaa3c483cdc6ce67ce3302136c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonah=20Br=C3=BCchert?= Date: Sun, 1 Dec 2024 23:37:17 +0100 Subject: [PATCH] at: Add 2025 feeds --- feeds/at.json | 93 +++++++++++++++++++++++++++++------------ src/generate-austria.py | 50 ++++++++++++---------- 2 files changed, 95 insertions(+), 48 deletions(-) diff --git a/feeds/at.json b/feeds/at.json index 6a7dcbd3..6c8e2a76 100644 --- a/feeds/at.json +++ b/feeds/at.json @@ -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" }, @@ -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" }, @@ -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" }, @@ -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" }, @@ -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" }, @@ -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" }, @@ -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" }, @@ -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" }, @@ -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" }, @@ -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" }, @@ -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" }, @@ -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" }, @@ -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": { @@ -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": { @@ -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": { @@ -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 + } } ] } diff --git a/src/generate-austria.py b/src/generate-austria.py index 69d14589..fca13206 100755 --- a/src/generate-austria.py +++ b/src/generate-austria.py @@ -6,7 +6,7 @@ import requests import json -CURRENT_TIMETABLE_YEAR = 2024 +TIMETABLE_YEARS = [2024, 2025] def remove_duplicate_dashes(text: str) -> str: @@ -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 @@ -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 = {}