update documentation

This commit is contained in:
2026-05-18 15:01:53 +02:00
parent 834025e560
commit 7018443b18
13 changed files with 756 additions and 725 deletions
+17
View File
@@ -87,6 +87,20 @@ HAFAS timestamps are Vienna-local strings, not UTC timestamps. Use these helpers
| --- | --- |
| `parseHafasJourneys(json, hafasDate, queryDate)` | Shared HAFAS trip parser that converts raw `outConL` connections into `Journey[]`. It parses scheduled and realtime departure/arrival strings with `parseHafasTime`, computes delay, platform, train labels, change count, and cancellation state. |
### `packages/core/src/journey-scoring.ts`
| Function | What it does |
| --- | --- |
| `rankJourneys(journeys, targetArrivalTime, finalLegDurationMs?)` | Scores journeys by arrival fit, transfer count, duration, and cancellation penalty. It favors arrivals close to the target, direct connections, and shorter journeys, while strongly penalizing late or cancelled journeys. |
### `packages/core/src/defaults.ts`
| Constant | What it does |
| --- | --- |
| `DEFAULT_ORIGIN_ADDRESS`, `DEFAULT_ORIGIN_LAT`, `DEFAULT_ORIGIN_LNG` | Shared fallback origin address and coordinates for Goethegasse 36, 2340 Moedling. |
| `DEFAULT_ORIGIN_STATION_NAME`, `DEFAULT_ORIGIN_STATION_EXT_ID` | Fallback station name and HAFAS station ID for Mödling Bahnhof. |
| `DEFAULT_ORIGIN_STATION` | Pre-assembled `Station` object used when geolocation or saved origin settings are unavailable. |
### `packages/core/src/index.ts`
Barrel file that re-exports the core types, countdown utilities, formatting utilities, status utilities, HAFAS time helpers, and the shared HAFAS parser.
@@ -112,8 +126,10 @@ This client talks to the web app's backend proxy routes. `baseUrl` defaults to a
| `ApiClient.reverseGeocode(lat, lng)` | Calls `/api/geocode/reverse`. Note: the current web app does not define this route, so callers should tolerate `null` or failures. |
| `ApiClient.findNearbyStops(lat, lng, radius?)` | Calls `/api/wienerlinien/stops` and returns nearby stops. |
| `ApiClient.searchStation(query)` | Uses HAFAS `LocMatch` through `/api/hafas` to search station names. |
| `ApiClient.findStationByExtId(extId)` | Uses HAFAS `LocMatch` to resolve one station by external station ID. |
| `ApiClient.findNearestStationByCoords(lat, lng)` | Uses HAFAS coordinate `LocMatch` to find the closest station to GPS coordinates. |
| `ApiClient.monitorStops(stopIds)` | Calls `/api/wienerlinien/monitor` and returns flattened departure rows. |
| `ApiClient.fetchApi(path, init?, params?)` | Private helper that tries configured base URLs and falls through on network errors or unavailable status codes. |
### `packages/api-client/src/index.ts`
@@ -133,6 +149,7 @@ Defines environment-backed service URLs and defaults:
| `WIENER_LINIEN_API_URL` | Wiener Linien API base. |
| `DEFAULT_DAYS` | Default calendar import horizon. |
| `DEFAULT_STATION`, `DEFAULT_STATION_NAME`, `DEFAULT_STATION_EXT_ID` | Web fallback origin. The default origin is Goethegasse 36, 2340 Moedling, using Mödling Bahnhof as the nearest transit station fallback. |
| `OEBB_GTFS_URL` | ÖBB GTFS ZIP source used by the HAFAS route to enrich train metadata when possible. |
| `APP_VERSION` | Health endpoint version string. |
### `apps/web/src/lib/api-service.ts`