{"id":35031266,"url":"https://github.com/hasderhi/wiener-linien-api","last_synced_at":"2026-04-19T16:37:35.942Z","repository":{"id":323319304,"uuid":"1089859172","full_name":"hasderhi/wiener-linien-api","owner":"hasderhi","description":"A small project that uses the OGD Realtime API from Vienna's public transport provider, Wiener Linien. It automatically fetches current departures from a selected station and displays them in an HTML frontend. Also included are three Python scripts that generate a JSON file containing all IDs for each station using publicly available CSV data.","archived":false,"fork":false,"pushed_at":"2025-11-09T12:38:06.000Z","size":589,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-09T14:34:51.245Z","etag":null,"topics":["departure-board","fastapi","ogd-austria","wiener-linien"],"latest_commit_sha":null,"homepage":"https://tk-dev-software.com/software","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hasderhi.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-04T23:00:30.000Z","updated_at":"2025-11-09T13:30:11.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/hasderhi/wiener-linien-api","commit_stats":null,"previous_names":["hasderhi/wiener-linien-api"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/hasderhi/wiener-linien-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasderhi%2Fwiener-linien-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasderhi%2Fwiener-linien-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasderhi%2Fwiener-linien-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasderhi%2Fwiener-linien-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hasderhi","download_url":"https://codeload.github.com/hasderhi/wiener-linien-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hasderhi%2Fwiener-linien-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28074955,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-27T02:00:05.897Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["departure-board","fastapi","ogd-austria","wiener-linien"],"created_at":"2025-12-27T07:00:06.017Z","updated_at":"2026-04-19T16:37:35.934Z","avatar_url":"https://github.com/hasderhi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wiener Linien Departure Board\n\n## Introduction\n\nA small project that uses the OGD Realtime API from Vienna's public transport provider, **Wiener Linien**. It automatically fetches current departures from a selected station and displays them in an HTML frontend. Also included are three Python scripts that generate a JSON file containing all IDs for each station using publicly available CSV data. If you want to build your own departure display at home, this is for you!\n\n![Image displaying the frontend](/project/img1.png)\n\n## Description\n\n### About the API\n\nWiener Linien provides a free, open API for fetching realtime departure information and traffic data. To use the API, you need to provide the **RBL ID** (*Rechnergesteuertes Betriebs-Leitsystem*, \"computer-controlled service management system\"). Each RBL ID corresponds to:\n\n1. A specific station or stop  \n2. A specific line  \n3. A specific direction\n\nFor example, ID **4903** refers to:\n\n1. The station **Rochusgasse**\n2. The line **U3**\n3. The direction **Ottakring**\n\n### ID sources and compilation\n\nMatching RBL IDs with their station names can be tricky. We can download four CSV files from **data.gv.at**:\n\n- `wienerlinien-ogd-fahrwegverläufe.csv`\n- `wienerlinien-ogd-haltepunkte.csv`\n- `wienerlinien-ogd-haltestellen.csv`\n- `wienerlinien-ogd-linien.csv`\n\nTo build accurate name–ID mappings, these files need to be merged. This project includes three Python scripts:\n\n- `extract_raw.py`  \n  First version, deprecated but included for reference\n- `extract.py`  \n  Second version, outputs cleaned data\n- `group_stops.py`  \n  Groups entries with the same name but different IDs, because one station usually has several IDs for different lines and directions\n\nThese scripts generate `stops_grouped.json`, which acts as a registry containing all station IDs. The frontend uses this registry to list stations. When a user selects a station, the corresponding IDs are fetched and passed to the API, and the results are displayed.\n\n### Quirk with multiple entries\n\nThere may still be multiple entries for what appears to be the same station. Bus and tram stops often have different internal names than subway stations. Despite the “U” appearing in the name for some entries, those may refer to tram/bus stops announcing a subway connection rather than the subway platforms themselves. Generally, the first entries are subway stops, and entries containing “S”, “U”, or “\u003c\u003e” tend to be tram/bus entries. This is still a work in progress.\n\n### Backend\n\nThe backend uses the `requests` library and FastAPI to serve data to the frontend. Note that Wiener Linien’s fair-use guidelines recommend a minimum polling interval of **15 seconds**. The default here is **30 seconds**, but large stations (e.g., *Karlsplatz*) may still cause timeouts. If you encounter missing data or slow responses, try increasing the interval to **60 seconds**.\n\nTo change this, edit the `startAutoRefresh()` function in `script.js` and change the timeout value from `30000` to `60000` milliseconds.\n\nMore details about the API can be found in `project/api_description.md`.\n\n### Frontend\n\nThe frontend (`frontend/`) consists of vanilla HTML, CSS, and JavaScript. It calls the backend, which in turn queries the OGD API. Station names and IDs are fetched from the backend, and the frontend periodically pings the backend to avoid outdated information.\n\n## Setup\n\nAll software in this repo *should* work on any OS. If something doesn’t work, feel free to [contact me](https://tk-dev-software.com#contact).\n\n1. Clone the repo and install the dependencies from `requirements.txt`\n2. Download the 4 CSV files from [data.gv.at](https://www.data.gv.at/datasets/cfba4373-a654-3e0b-80f8-348738169f95)  \n   - \"Distributionen\" tab  \n   - Download:\n     - `wienerlinien-ogd-fahrwegverläufe.csv`\n     - `wienerlinien-ogd-haltepunkte.csv`\n     - `wienerlinien-ogd-haltestellen.csv`\n     - `wienerlinien-ogd-linien.csv`\n3. Move the files to `backend/data/`\n4. In a terminal, `cd` to the `/data` folder\n5. Run `py -m extract.py`\n6. Run `py -m group_stops.py`\n7. You should now have:\n   - `stops_clean.json`\n   - `stops_grouped.json`\n8. `cd` back to `/backend`\n9. Run `uvicorn main:app --reload`\n10. Open `frontend/index.html` in your browser\n\nYou're all set!\n\n![Image displaying the frontend](/project/img2.png)\n\n## Usage\n\nSelect any station from the dropdown. Press `e` to hide it. You'll see `Updating...` above the table. Once data arrives, departures for the next ~70 minutes will appear. The table refreshes every 30 seconds.\n\nTo quit, press `CTRL+C` in the terminal, then close the browser tab.\n\n## Tips and Tricks\n\n- One entry can contain multiple subway lines or multiple tram/bus lines, but never both. If multiple entries exist, the first ones usually belong to the subway.\n- If no data appears, check the terminal for `500 Internal Server Error`. Some IDs in the registry may not return data.\n- Switching stations rapidly may overwhelm the API. If lines are missing, wait a moment and try again.\n- When the dropdown is focused, you can type to search for station names.\n\n## Links\n\n[Data source for the CSV files - data.gv.at](https://www.data.gv.at/datasets/cfba4373-a654-3e0b-80f8-348738169f95)\n\n[Explanation what the RBL does - strassenbahnjournal.at](https://strassenbahnjournal.at/wiki/index.php?title=RBL)\n\n[The API page - wienerlinien.at/ogd_realtime/](https://www.wienerlinien.at/ogd_realtime/)\n\n[Official documentation for the API (German) - wienerlinien.at](https://www.wienerlinien.at/ogd_realtime/doku/ogd/wienerlinien-echtzeitdaten-dokumentation.pdf)\n\n[Information page about Open Data - wienerlinien.at](https://www.wienerlinien.at/open-data)\n\n## Author\n\nAnnabeth Kisling\n\n[annabeth@tk-dev-software.com](mailto:annabeth@tk-dev-software.com)\n\n## License and Disclaimer\n\nThis project is released under the MIT License (see `license.md`). I do not own or provide any transport data, nor am I responsible for misuse of the API. Please follow the API fair-use guidelines.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhasderhi%2Fwiener-linien-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhasderhi%2Fwiener-linien-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhasderhi%2Fwiener-linien-api/lists"}