docs: include previously ignored documentation files
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
# Boarding Plan — Table Relations (BusPro schema)
|
||||
|
||||
> **Authority: [`docs/buspro-database-reference.md`](../buspro-database-reference.md) §8.4.**
|
||||
> Retained for the detailed ER diagram of the `ZustiegsPlanung*` subsystem.
|
||||
|
||||
Read-only reference for building the boarding-plan API endpoint (look up a plan
|
||||
by `IDZustiegsPlanung`, returning names, addresses, and times).
|
||||
|
||||
The query walks:
|
||||
**`ZustiegsPlanung` → persons → (name via `BuchungTN`/`AdressePerson`) →
|
||||
`PersonStelle` junction → `BusStelle` (time) → `Zustieg` (address) → `Bus`.**
|
||||
`ZustiegsPlanungPersonStelle` is the pivot that ties a passenger to a timed stop.
|
||||
|
||||
## ER diagram
|
||||
|
||||
```mermaid
|
||||
erDiagram
|
||||
ZustiegsPlanung ||--o{ ZustiegsPlanungBus : "IDZustiegsPlanung_FS"
|
||||
ZustiegsPlanung ||--o{ ZustiegsPlanungPerson : "IDZustiegsPlanung_FS"
|
||||
ZustiegsPlanungBus ||--o{ ZustiegsPlanungBusStelle : "IDZustiegsPlanungBus_FS"
|
||||
ZustiegsPlanungPerson ||--o{ ZustiegsPlanungPersonStelle : "IDZustiegsPlanungPerson_FS"
|
||||
ZustiegsPlanungBusStelle ||--o{ ZustiegsPlanungPersonStelle : "IDZustiegsPlanungBusStelle_FS"
|
||||
|
||||
ZustiegsPlanungPerson }o..|| BuchungTN : "IDBuchungTN_FS"
|
||||
BuchungTN }o..|| AdressePerson : "IDAdressePerson_FS (name)"
|
||||
ZustiegsPlanungBusStelle }o..o| Zustieg : "IDZustieg_FS (soft, address)"
|
||||
|
||||
ZustiegsPlanung {
|
||||
bigint IDZustiegsPlanung PK
|
||||
datetime Datum
|
||||
}
|
||||
ZustiegsPlanungBus {
|
||||
bigint IDZustiegsPlanungBus PK
|
||||
string ReiseleiterName
|
||||
}
|
||||
ZustiegsPlanungBusStelle {
|
||||
bigint IDZustiegsPlanungBusStelle PK
|
||||
datetime Zeit "TIME"
|
||||
smallint Sortierung
|
||||
}
|
||||
ZustiegsPlanungPerson {
|
||||
bigint IDZustiegsPlanungPerson PK
|
||||
}
|
||||
ZustiegsPlanungPersonStelle {
|
||||
bigint IDZustiegsPlanungPersonStelle PK
|
||||
string Art "Einstieg/Ausstieg"
|
||||
}
|
||||
AdressePerson {
|
||||
string Name
|
||||
string Vorname
|
||||
}
|
||||
Zustieg {
|
||||
string Strasse
|
||||
string Plz
|
||||
string Ort
|
||||
}
|
||||
```
|
||||
|
||||
## ASCII fallback
|
||||
|
||||
```
|
||||
ZustiegsPlanung (the planning id)
|
||||
/ \
|
||||
IDZustiegsPlanung_FS IDZustiegsPlanung_FS
|
||||
/ \
|
||||
ZustiegsPlanungBus ZustiegsPlanungPerson ──IDBuchungTN_FS──▶ BuchungTN
|
||||
│ (Reiseleiter) │ │
|
||||
IDZustiegsPlanungBus_FS IDZustiegsPlanungPerson_FS IDAdressePerson_FS
|
||||
│ │ ▼
|
||||
▼ ▼ AdressePerson
|
||||
ZustiegsPlanungBusStelle ◀──┐ ZustiegsPlanungPersonStelle (NAME)
|
||||
• Zeit (TIME) │ • Art (boarding/alighting)
|
||||
• IDZustieg_FS ··soft··▶ Zustieg (ADDRESS)
|
||||
└──IDZustiegsPlanungBusStelle_FS───┘ (junction: passenger ↔ stop)
|
||||
```
|
||||
|
||||
**Legend:** `||--o{` / solid = enforced FK constraint; `}o..` / `··soft··` =
|
||||
convention-only `_FS` reference (no DB constraint — join defensively, expect
|
||||
`NULL`/`0`/orphaned values).
|
||||
|
||||
## Notes for the query
|
||||
|
||||
- **Name** is not stored in the plan; join out live via
|
||||
`ZustiegsPlanungPerson.IDBuchungTN_FS → BuchungTN.IDAdressePerson_FS → AdressePerson`.
|
||||
- **Time** lives on `ZustiegsPlanungBusStelle.Zeit` (per stop), not on the plan
|
||||
header (`ZustiegsPlanung.Datum` is the plan date).
|
||||
- **Address** comes from `Zustieg` (the boarding point). Prefer reaching it via
|
||||
`ZustiegsPlanungBusStelle.IDZustieg_FS` so it never depends on
|
||||
`ZustiegsPlanungPerson.IDZustieg_FS` being populated.
|
||||
- A passenger can have multiple `ZustiegsPlanungPersonStelle` rows (boarding +
|
||||
alighting), distinguished by `Art`. Filter on `Art` for boarding-only.
|
||||
- To verify against real data: the actual `Art` codes (`nvarchar(6)`), and
|
||||
whether `BusStelle.IDZustieg_FS` always matches the passenger's
|
||||
`Person.IDZustieg_FS` on the boarding leg.
|
||||
Reference in New Issue
Block a user