CITA Traffic Platform / Documentation
Feeds and Data Model
Find the source schedule, choose the right table, and preserve identity and local-time meaning.
Thesis-source commands assume the Quickstart checkout and configuration. In each new terminal, run export COMPOSE_PROJECT_NAME=cita-docs-review before using Compose.
Jump to a section
Find the configured feed
Base path: https://cita.lu/info_trafic/datex. The catalog below describes configuration, not current endpoint availability.
| Path / group | Count | Interval | Parser |
|---|---|---|---|
/trafficstatus_ + a1, a3, a4, a6, a7, a13, b40 | 7 | 300 s | measurements |
/situationrecord36 | 1 | 60 s | incidents_datex36 |
/trafficregulation36 | 1 | 900 s | regulations_datex36 |
/parking_dynamic.xml | 1 | 300 s | parking_dynamic |
/parking_static.xml | 1 | 86,400 s | parking_static |
Measurements/parking examples use DATEX II model basis 2; incidents/regulations use basis 3. Their parsers handle different structures, namespaces, optional values, and repeated records.
Choose the tables for your question
| Question | Tables | Key / relationship |
|---|---|---|
| Which bytes arrived? | raw_feed_snapshots | Unique (feed_name,sha256); archive path, parser/version/status |
| When was it fetched again? | feed_fetch_observations | Many observations → one snapshot; failed fetch can have no snapshot |
| Which measurements were parsed? | measurement_observations → measurement_values | Observation key; (observation_id,value_index); snapshot references |
| What feeds historical charts? | measurements | Compatibility key (measurement_time,road,site_id) |
| Which event version? | situations → incident_records | (source_feed,record_id,record_version); child comments/lanes/vehicle groups |
| Which regulation? | traffic_regulation_orders → traffic_regulations | Source/version keys; source geometries and optional derived GeoJSON |
| What changed at a parking site? | parking_sites, parking_observations | Versioned metadata; observation-time values joined by site reference |
| What failed? | parser_warnings, collection_runs, feed_status | Warning → snapshot; run and source state |
Detailed tables upsert by natural keys. In the submitted code, a compatibility measurement conflict updates speed, occupancy, flow, and collection time, not every metadata field. Reprocessing may change projections; raw bytes preserve the received representation.
Inspect a fetch and its snapshot
docker compose exec -T postgres psql -U cita -d cita -c "
SELECT f.id AS fetch_id, f.feed_name, f.outcome, f.is_duplicate,
s.id AS snapshot_id, s.parse_status, s.parsed_record_count
FROM feed_fetch_observations f
LEFT JOIN raw_feed_snapshots s ON s.id=f.snapshot_id
ORDER BY f.id DESC LIMIT 10;"Expected: The quickstart gives two fetch rows sharing one parsed snapshot. Its detailed record count includes child values, so it is not the number of measurement sites.
Apply the base schema and ordered migrations with python -m database.migrate. Applied filenames are stored in schema_migrations. Schema initialization does not restore archived observations.
Group time and missing values correctly
EXTRACT(HOUR FROM measurement_time AT TIME ZONE 'Europe/Luxembourg')
EXTRACT(ISODOW FROM measurement_time AT TIME ZONE 'Europe/Luxembourg')Store timezone-aware times and convert before extracting local weekdays/hours. Summer UTC grouping shifts the local profile by two hours. Keep road, site, and stored direction distinct when forming series.
inboundTowardsTown and outboundFromTown are stored categories, not verified compass/city-bound directions. Null is not zero. Three zero main values are treated as an inactive sensor before congestion is considered. Partial records remain stored; missing coordinates exclude a map point, not all possible analysis.
The A3 figure input retains positive speed, flow, and occupancy. Unsupported regulation CRS data remains preserved with a warning rather than mapped under an assumed reference system.
Source files
Paths identify the relevant files and symbols in the inspected source distribution; they are not links to an assumed public repository. See access requirements.
config/feeds.py- FeedConfig / ALL_FEEDS
database/schema.sql- Compatibility and operational tables
database/migrations/001_lossless_collection.sql- Domain tables, foreign keys, unique indexes
database/migrate.py- Migration registry
database/lossless.py- _upsert / _persist_dashboard_compatibility
database/db.py- load_rush_hour_profile
traffic/classification.py- Validity/inactive/stale ordering
collector/parsers/regulations_datex36.py- Geometry and CRS warnings