GTFS: un arrêt de bus scolaire qu'aucune course ne dessert
Objectif Lire le flux GTFS d'une ligne scolaire tel qu'il est publié et trouver l'arrêt qu'aucune course ne dessert, avec la requête qui le prouve.
Les autorités de transport publient leurs horaires en GTFS: des fichiers CSV, dont stops.txt et stop_times.txt. Deux défauts passent un coup d'œil: un arrêt provisoire resté dans le fichier, et un horaire qui cite un arrêt absent.
- deux fichiers, deux connecteurs, par SFTP
- l'arrêt non desservi trouvé en langage naturel, avec son SQL
- l'horaire orphelin trouvé aussi, par un NOT EXISTS
stop_id,stop_name,stop_lat,stop_lon,location_type S-GARE,Gare routière,45.75810,4.82540,0 S-MAIRIE,Mairie,45.76120,4.83010,0 S-ECOLE,École Jules Ferry,45.76480,4.83660,0 S-COLLEGE,Collège Victor Hugo,45.76830,4.84210,0 S-LYCEE-P,Lycée Jean Moulin (arrêt provisoire),45.77190,4.84850,0 S-LYCEE,Lycée Jean Moulin,45.77240,4.84920,0
trip_id,arrival_time,departure_time,stop_id,stop_sequence S1-MATIN,07:05:00,07:05:00,S-GARE,1 S1-MATIN,07:11:00,07:11:00,S-MAIRIE,2 S1-MATIN,07:18:00,07:18:00,S-ECOLE,3 S1-MATIN,07:25:00,07:25:00,S-COLLEGE,4 S1-MATIN,07:32:00,07:32:00,S-LYCEE,5 S1-SOIR,17:40:00,17:40:00,S-LYCEE,1 S1-SOIR,17:47:00,17:47:00,S-COLLEGE,2 S1-SOIR,17:54:00,17:54:00,S-ECOLE,3 S1-SOIR,18:01:00,18:01:00,S-MAIRIE,4 S1-SOIR,18:08:00,18:08:00,S-GARE-NORD,5 S1-NUIT,23:50:00,23:50:00,S-GARE,1 S1-NUIT,24:10:00,24:10:00,S-LYCEE,2
manifests/10-stops.yaml
apiVersion: connectors.lumnik.io/v1kind: Connectormetadata: name: scenario-gtfs-stops-a connector_type: csv-file scopes: [transport-a]spec: transport: kind: sftp host: host.docker.internal port: 2226 user: gtfs path: /feed/stops.txt password_env: SCENARIO_GTFS_A_SFTP # The fingerprint the network's server presents, read out of band (ssh-keyscan | ssh-keygen -lf -). host_key_fingerprint: "SHA256:FINGERPRINT_READ_AT_REPLAY" parser: has_header: true delimiter: "," # GTFS: comma-delimited, UTF-8 encoding: UTF-8 after_process: nonemanifests/11-stop-times.yaml
apiVersion: connectors.lumnik.io/v1kind: Connectormetadata: name: scenario-gtfs-times-a connector_type: csv-file scopes: [transport-a]spec: transport: kind: sftp host: host.docker.internal port: 2226 user: gtfs path: /feed/stop_times.txt password_env: SCENARIO_GTFS_A_SFTP # The fingerprint the network's server presents, read out of band (ssh-keyscan | ssh-keygen -lf -). host_key_fingerprint: "SHA256:FINGERPRINT_READ_AT_REPLAY" parser: has_header: true delimiter: "," # GTFS: comma-delimited, UTF-8 encoding: UTF-8 after_process: nonemanifests/20-arret.yaml
kind: Entityname: arret_alabel: Arrêtdescription: "A stop of the school bus network (GTFS stops.txt): its id, name and position."match: [stop_id]scopes: [transport-a]columns: stop_id: { label: "Identifiant d'arrêt" } stop_name: { label: "Nom de l'arrêt" } stop_lat: { label: "Latitude" } stop_lon: { label: "Longitude" }sources: - table: t_scenario_gtfs_stops_a map: { stop_id: stop_id, stop_name: stop_name, stop_lat: stop_lat, stop_lon: stop_lon }manifests/21-horaire.yaml
kind: Entityname: horaire_alabel: Horaire de passagedescription: "A stop time of a school bus trip (GTFS stop_times.txt): the trip, its order, the time and the stop it names by stop_id."match: [trip_id, stop_sequence]scopes: [transport-a]columns: trip_id: { label: "Course" } stop_sequence: { label: "Rang dans la course" } arrival_time: { label: "Heure d'arrivée" } stop_id: { label: "Identifiant d'arrêt" }sources: - table: t_scenario_gtfs_times_a map: { trip_id: trip_id, stop_sequence: stop_sequence, arrival_time: arrival_time, stop_id: stop_id }$ lm apply -f 10-stops.yaml
Applied connector "scenario-gtfs-stops-c" — 1 endpoint
$ lm apply -f 11-stop-times.yaml
Applied connector "scenario-gtfs-times-c" — 1 endpoint
$ lm connector run scenario-gtfs-stops-c
run scheduled: 4c0e693d-bcd1-4047-9d4a-c8f29a1bbbc6
$ lm run get 4c0e693d-bcd1-4047-9d4a-c8f29a1bbbc6 --wait-evaluated
ID CONNECTOR ENDPOINT STATUS IN OUT SKIPPED DEAD-LETTERS STARTED ENDED EVALUATED
4c0e693d scenario-gtfs-stops-c default Completed 6 6 0 0 2026-11-21 21:01 2026-11-21 21:01 yes
$ lm connector run scenario-gtfs-times-c
run scheduled: ffeb3cda-32a5-4a6d-a57d-8e4872b08052
$ lm run get ffeb3cda-32a5-4a6d-a57d-8e4872b08052 --wait-evaluated
ID CONNECTOR ENDPOINT STATUS IN OUT SKIPPED DEAD-LETTERS STARTED ENDED EVALUATED
ffeb3cda scenario-gtfs-times-c default Completed 12 12 0 0 2026-11-21 21:01 2026-11-21 21:01 yes
$ lm entity apply -f 20-arret.yaml
Applied entity "arret_c" → connector."v_arret_c"
$ lm entity apply -f 21-horaire.yaml
Applied entity "horaire_c" → connector."v_horaire_c"- scenario-gtfs-stops-c
- IN 6 · OUT 6
- scenario-gtfs-times-c
- IN 12 · OUT 12
preuves: replay.log, check_gtfs.txt, 01-unserved.json, 02-unknown.json, 03-evening-trip.json, run-scenario-gtfs-stops-c.txt, run-scenario-gtfs-times-c.txt · transform v1
$ lm ask --scope transport-c --lang fr "Quels arrêts ne sont desservis par aucun horaire ?"
Les arrêts ne desservis par aucun horaire sont :
- Arrêt ID : S-LYCEE-P
- Nom de l'arrêt : Lycée Jean Moulin (arrêt provisoire)
- Latitude : 45.77190
- Longitude : 4.84850
data as of: 2026-11-21T20:01:44.239554Z (last completed run)
STOP_ID STOP_NAME STOP_LAT STOP_LON
S-LYCEE-P Lycée Jean Moulin (arrêt provisoire) 45.77190 4.84850
1 row returned
SQL: SELECT stop_id, stop_name, stop_lat, stop_lon
FROM (SELECT "stop_id", "stop_name", "stop_lat", "stop_lon" FROM connector."v_arret_c") AS "v_arret_c"
WHERE stop_id NOT IN (
SELECT stop_id
FROM (SELECT "trip_id", "stop_sequence", "arrival_time", "stop_id" FROM connector."v_horaire_c") AS "v_horaire_c"
)
LIMIT 500
$ lm ask --scope transport-c --lang fr "Quels horaires citent un arrêt qui n'existe pas ?"
Les horaires suivants citent un arrêt qui n'existe pas :
- **trip_id**: S1-SOIR
- **stop_sequence**: 5
- **arrival_time**: 18:08:00
- **stop_id**: S-GARE-NORD
data as of: 2026-11-21T20:01:44.239554Z (last completed run)
TRIP_ID STOP_SEQUENCE ARRIVAL_TIME STOP_ID
S1-SOIR 5 18:08:00 S-GARE-NORD
1 row returned
SQL: SELECT h.*
FROM (SELECT "trip_id", "stop_sequence", "arrival_time", "stop_id" FROM connector."v_horaire_c") AS "h"
WHERE h."stop_id" IS NOT NULL
AND NOT EXISTS (
SELECT 1
FROM (SELECT "stop_id", "stop_name", "stop_lat", "stop_lon" FROM connector."v_arret_c") AS "a"
WHERE a."stop_id" = h."stop_id"
)
LIMIT 500
$ lm ask --scope transport-c --lang fr "Liste les horaires de la course S1-SOIR avec leur identifiant d'arrêt"
Il y a 5 horaires pour la course S1-SOIR. Voici les détails :
1. Arrivée à S-LYCEE à 17:40:00
2. Arrivée à S-COLLEGE à 17:47:00
3. Arrivée à S-ECOLE à 17:54:00
4. Arrivée à S-MAIRIE à 18:01:00
5. Arrivée à S-GARE-NORD à 18:08:00
data as of: 2026-11-21T20:01:44.239554Z (last completed run)
TRIP_ID STOP_ID ARRIVAL_TIME
S1-SOIR S-LYCEE 17:40:00
S1-SOIR S-COLLEGE 17:47:00
S1-SOIR S-ECOLE 17:54:00
S1-SOIR S-MAIRIE 18:01:00
S1-SOIR S-GARE-NORD 18:08:00
5 rows returned
SQL: SELECT
h."trip_id",
h."stop_id",
h."arrival_time"
FROM
(SELECT "trip_id", "stop_sequence", "arrival_time", "stop_id" FROM connector."v_horaire_c") AS "h"
WHERE
h."trip_id" = 'S1-SOIR'
LIMIT 500- unserved
- S-LYCEE-P · Lycée Jean Moulin (arrêt provisoire)
- orphan
- S1-SOIR rank 5 · S-GARE-NORD
- orphan, sentence
- Les horaires suivants citent un arrêt qui n'existe pas :
- S1-SOIR
- 17:40:00 · S-LYCEE
- S1-SOIR
- 17:47:00 · S-COLLEGE
- S1-SOIR
- 17:54:00 · S-ECOLE
- S1-SOIR
- 18:01:00 · S-MAIRIE
- S1-SOIR
- 18:08:00 · S-GARE-NORD
preuves: replay.log, check_gtfs.txt, 01-unserved.json, 02-unknown.json, 03-evening-trip.json, run-scenario-gtfs-stops-c.txt, run-scenario-gtfs-times-c.txt · transform v1
Limites
- Avant icreated/lumnik#2127, SELECT * remontait aussi les colonnes internes de la vue, et la phrase sur l'orphelin était retenue.
- Avant icreated/lumnik#2125, la question de l'orphelin s'abstenait sur cinq formulations.
- Deux fichiers seulement: trips, routes et calendar ne sont pas lus. Ce n'est pas un validateur GTFS.
- Ligne scolaire fictive, données synthétiques.
Ce scénario demande lumnik Pro.
Voir l'offre →