Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • C chouette-core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 36
    • Merge requests 36
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Administrator
  • chouette-core
  • Wiki
  • GTFS Import

GTFS Import · Changes

Page history
Updated GTFS Import (markdown) authored Jul 25, 2018 by emaffert's avatar emaffert
Hide whitespace changes
Inline Side-by-side
Showing with 59 additions and 57 deletions
+59 -57
  • GTFS-Import.md GTFS-Import.md +59 -57
  • No files found.
GTFS-Import.md
View page @ db9c1e5c
# Structure de l'import
# Import structure
L'import GTFS prend en entrée un zip contenant des fichiers csv.
The GTFS import takes as input a zip file containing csv files.
Les fichiers csv pris en compte par l'import gtfs sont :
The CSV files processed by the import :
- agencies.txt
- stops.txt
- routes.txt
......@@ -11,7 +11,7 @@ Les fichiers csv pris en compte par l'import gtfs sont :
- calendars.txt
- calendar_dates.txt
L'import ignorera les fichiers suivants
Theses files won't be processed :
- fare_attributes.txt
- fare_rules.txt
- shapes.txt
......@@ -19,15 +19,15 @@ L'import ignorera les fichiers suivants
- transfers.txt
- feed_info.txt
Les fichiers doivent respecter le format des fichiers GTFS comme défini dans la documentation officielle.
The CSV files must be compliant with the GTFS standard as defined in the official documentation.
Rappel de la documentation officielle google : https://developers.google.com/transit/gtfs/reference/
Google's official documentation: https://developers.google.com/transit/gtfs/reference/
Des exemples de fichiers GTFS sont disponibles à l'adresse suivante : https://developers.google.com/transit/gtfs/examples/gtfs-feed
Some example GTFS files can be found at the following adress: https://developers.google.com/transit/gtfs/examples/gtfs-feed
# Traitement des fichiers
# Files processing
Les fichiers sont traités dans l'ordre suivant :
Files are processed in that order :
- agencies.txt
- stops.txt
- routes.txt
......@@ -38,17 +38,19 @@ Les fichiers sont traités dans l'ordre suivant :
## agencies.txt
### Validation des données GTFS
### GTFS data validation
Attributs obligatoires :
- agency_id (l'attribut n'est pas obligatoire selon la norme gtfs, mais les Chouette::Companies sont créées à partir de cet identifiant)
Mandatory attributes:
- agency_id
- agency_name
- agency_url
- agency_timezone
### Conversion du modèle GTFS en modèle Chouette
The agency_id attribute isn't mandatory in the GTFS profile, but Chouette::Companies are indexed with this identifier.
Une Agency GTFS sera convertie en Company dans Chouette.
### GTFS model to Chouette model converion
A GTFS Agency is converted in a Chouette Company.
| GTFS Agency | Chouette::Company |
| --- | --- |
......@@ -59,17 +61,17 @@ Une Agency GTFS sera convertie en Company dans Chouette.
## stops.txt
### Validation des données GTFS
### GTFS data validation
Attributs obligatoires :
Mandatory attributes:
- stop_id
- stop_name
- stop_lat
- stop_lon
### Conversion du modèle GTFS en modèle Chouette
### GTFS model to Chouette model converion
Un Stop GTFS sera converti en StopArea dans Chouette.
A GTFS Stop is converted in a Chouette StopArea.
| GTFS Stop | Chouette::StopArea |
| --- | --- |
......@@ -79,25 +81,26 @@ Un Stop GTFS sera converti en StopArea dans Chouette.
| stop_lon | longitude |
| location_type | area_type |
Le Chouette::StopArea aura par défaut un kind "Commercial" et un confirmed_at à l'heure de l'import.
L'attribut GTFS parent_station permet de trouver le parent de l'arrêt qui lui sera associé.
The Chouette StopArea default kind is "Commercial" and its confirmed_at attribute is the import time.
We use the parent_station GTFS attribute to find and associate the StopArea parent.
Si l'attribut GTFS location_type est égal à "1" alors l'attribut Chouette area_type sera égal à "zdlp", sinon l'attribut area_type sera égal à "zdep".
If the location_type GTFS attribut is "1" the area_type Chouette attribute will be "zdlp", otherwise it will be "zdep".
## routes.txt
### Validation des données GTFS
### GTFS data validation
Attributs obligatoires :
Mandatory attributes:
- route_id
- route_short_name
- route_long_name
L'attribut route_type est obligatoire selon le profil GTFS mais n'est pas importé dans Chouette.
The route_type attribute is mandatory in the GTFS profile but isn't imported in Chouette.
### Conversion du modèle GTFS en modèle Chouette
### GTFS model to Chouette model converion
Une Route GTFS sera convertie en Line Chouette.
A GTFS Route is converted in a Chouette Line.
| GTFS Route | Chouette::Line |
| --- | --- |
......@@ -108,13 +111,13 @@ Une Route GTFS sera convertie en Line Chouette.
| route_desc | comment |
| route_url | url |
L'attribut GTFS agency_id permet de trouver la Chouette::Company de la ligne qui lui sera associée.
We use the agency_id GTFS attribute to find and associate the Company to the Line.
## calendars.txt
### Validation des données GTFS
### GTFS data validation
Attributs obligatoires :
Mandatory attributes:
- service_id
- monday
- thuesday
......@@ -126,9 +129,9 @@ Attributs obligatoires :
- start_date
- end_date
### Conversion du modèle GTFS en modèle Chouette
### GTFS model to Chouette model converion
Un Calendar GTFS sera converti en une combinaison de TimeTable et Period Chouette. La TimeTable contient les jours d'application, et la Period qui lui est associée contient les dates de début et de fin de la période concernée.
A GTFS Calendar is converted in a combination of a Chouette Timetable and Period. The Timetable will define the Calendar service days, and its Period the begining and ending dates of the GTFS Calendar.
| GTFS Route | Chouette::TimeTable | Chouette::Period |
| --- | --- | --- |
......@@ -142,80 +145,79 @@ Un Calendar GTFS sera converti en une combinaison de TimeTable et Period Chouett
| start_date | - | period_start |
| end_date | - | period_end |
L'attribut service_id sera stocké dans le champ comment de la TimeTable Chouette sous la forme : "Calendar [service_id]".
The service_id GTFS attribute is stored in the Chouette TimeTable comment attribute as: "Calendar [service_id]".
## calendar_dates.txt
### Validation des données GTFS
### GTFS data validation
Attributs obligatoires :
Mandatory attributes:
- service_id
- date
- exception_type
### Conversion du modèle GTFS en modèle Chouette
### GTFS model to Chouette model converion
Un CalendarDate GTFS sera converti en Date Chouette associée à une TimeTable.
A GTFS CalendarDate is converted in a Chouette Date associated with a TimeTable.
| GTFS CalendarDate | Chouette::Date |
| --- | --- |
| date | date |
| exception_type | in_out |
L'attribut GTFS service_id permet d'associer les Date à la TimeTable correspondante.
We use the service_id GTFS attribute to find and associate the TimeTable to the Date.
L'attribut Chouette in_out est un booléen. Si l'attribut GTFS exception_type est égal à "1" alors in_out sera égal à "true", si exception_type est égal à "2" alors in_out sera égal à "false".
The in_out Chouette attribute is a boolean. If the exception_type GTFS attribute is "1" in_out will be "true", otherwise in_out will be "false".
## trips.txt
### Validation des données GTFS
### GTFS data validation
Attributs obligatoires :
Mandatory attributes:
- route_id
- service_id
- trip_id
### Conversion du modèle GTFS en modèle Chouette
### GTFS model to Chouette model converion
Un Trip GTFS sera converti en une combinaison de Route, JourneyPattern et VehicleJourney Chouette.
A GTFS Trip is converted in a combination of a Chouette Route, JourneyPattern, and VehicleJourney.
Si l'attribut GTFS direction_id est égal à "1" alors l'attribut de la Route Chouette wayback sera égal à "outbound". Si direction_id est égal à 0, alors wayback sera égal à "outbound".
If the direction_id GTFS attribute is "1" then the Chouette Route wayback attribute will be "outbound", otherwise wayback will be "outbound".
Les attributs de la Route Chouette published_name et name seront égaux à l'attribut GTFS trip_short_name s'il existe, sinon à l'attribut trip_headsign s'il existe, sinon à "OUTBOUND" ou "INBOUND" en fonction de l'attribut direction_id.
The Chouette Route published_name and name attributes will be equal to the trip_short_name GTFS attribute if it's present, else to the trip_headsign attribute if it's present, or else to "OUTBOUND" or "INBOUND" depending on the direction_id GTFS attribute.
L'attribut name du JourneyPattern Chouette sera égal à celui de la Route.
The Chouette JourneyPattern name attribute is equal to the Chouette Route name.
L'attribut published_journey_name du VehicleJourney Chouette sera égal à l'attribut GTFS trip_headsign s'il existe, sinon à l'attribut trip_id.
The Chouette VehicleJourney published_journey_name attribute is will be equal to the trip_headsign GTFS attribute if it exists, or else to the trip_id GTFS attribute.
L'attribut GTFS route_id permet d'associer les objets Chouette à la ligne correspondante.
We use the GTFS attribute route_id to find and associate the Line to the Chouette objects.
L'attribut GTFS service_id permet d'associer le VehicleJourney à la TimeTable correspondante.
We use the GTFS attribute service_id to find and associate the TimeTeble to the VehicleJourney.
## stop_times.txt
### Validation des données GTFS
### GTFS data validation
Attributs obligatoires :
Mandatory attributes:
- trip_id
- arrival_time
- departure_time
- stop_id
- stop_sequence
### GTFS model to Chouette model converion
### Conversion du modèle GTFS en modèle Chouette
Un StopTime GTFS sera converti en VehicleJourneyAtStop Chouette associé à un VehicleJourney et un StopArea.
A GTFS StopTime is converted in a Chouette VehicleJourneyAtStop.
| GTFS StopTime | Chouette::VehicleJourneyAtStop |
| --- | --- |
| arrival_time | arrival_time |
| departure_time | departure_time |
L'attribut GTFS trip_id permet d'associer les VehicleJourneyAtStop au VehicleJourney correspondant.
We use the GTFS attribute trip_id to find and associate the VehicleJourney to the VehicleJourneyAtStop.
L'attribut GTFS stop_id permet d'associer les VehicleJourneyAtStop au StopArea correspondant.
We use the GTFS attribute stop_id to find and associate the StopArea to the VehicleJourneyAtStop.
L'attribut stop_sequence permet de donner un ordre aux VehicleJourneyAtStops dans le JourneyPattern correspondant au VehicleJourney.
The Chouette VehicleJourneyAtStop are ordered in the JourneyPattern associated with the VehicleJourney based on the stop_sequence GTFS attribute.
Les attributs GTFS arrival_time et departure_time peuvent contenir des heures supérieures à 24 pour modéliser les horaires après minuit d'une journée de service. Les horaires sont stockées au format 24h dans les VehicleAtStops Chouette, mais les attributs departure_day_offset et arrival_day_offset permettent de modéliser ce problème. Si une heure est supérieure à 24, son offset correspondant sera égal à 1, sinon il sera égal à 0.
\ No newline at end of file
For times occurring after midnight on the service day, the arrival_time and departure_time GTFS attributes can contain a value greater than 24:00:00. In the Chouette VehicleAtStop, arrival_time and departure_time are stored in a 24h format but we use the arrival_day_offset and departure_day_offset attributes to represent such times. If an hour in the GTFS file is greater than 24:00:00 its corresponding offset will be "1", otherwise it'll be "0".
\ No newline at end of file
Clone repository

Architecture

  • Data Models
  • Class Diagram

Install and configure

  • installation manual
  • Optional Feature flags
  • Policy management (TODO)

Best practices in code

Rails code rules

  • Writing a migration
  • Writing a model
  • Writing a controller
  • Writing a view
  • Writing a policy (TODO)
  • Writing a feature (TODO)
  • I18n

Test code rules

  • Writing a spec
  • Writing a javascript test

Exchange format

Neptune

  • Import TODO
  • Export TODO

GTFS

  • Import
  • Export

Netex

  • Import TODO
  • Export TODO