Sprint 45

Chouette

Import Shapes in GTFS

The GTFS import creates or updates Shapes in the Workbench Shape Referential.

Chouette SaaS associates the GTFS Shape with the Chouette Shape via the GTFS shape_id and the Chouette “external” code. This association is performed in the scope of the Workbench owner, so two teams can import independently their Shapes.

If a such Shape is found, the Shape will be updated. Otherwise, the Shape is created.

When GTFS Trips are imported, they are associated to a Shape according their shape_id (by looking for a Shape with the same “external” code and the the same Workbench owner).

Chouette SaaS - Shapes Referential

Export GTFS in GTFS

The GTFS export will use shapes associated to a JourneyPattern included in the export scope.

If the Chouette Shape “external” code is unique in the GTFS export scope, it uses as value for the GTFS Shape shape_id. Otherwise, the GTFS export uses the the Scope ID.

The Shape associated to a Journey Pattern is used for each associated GTFS trip (exported for Vehicle Journeys).

Endpoint for line metadatas on Publication API

The Publication API provides an endpoint to retrieve the Line statuses, on /api/v1/datas/<api slug>/lines.json.

For each Line in the aggregated data set, the Line status API returns:

  • the Line object id

  • the Line name

  • the creation time of the most recent metadata associated to the Line

[ { objectid: "chouette:Line:d1b1f581-8b68-456c-8de8-714c142a8ec9:LOC", name: "Nye County Airport", updated_at: "2021-06-22 14:45:58 +0200" }, { objectid: "chouette:Line:d1b1f581-8b68-456c-8de8-714c142a8ec9:LOC", name: "Airport - Amargosa Valley", updated_at: "2021-06-22 14:45:58 +0200" }, ... ]

Ara

Import API

The user can define models in Ara referential by importing a Ara CSV file.

The expected request should provide:

  • Headers

    • Authorization with one of the referential tokens

    • Content-Type multipart

  • JSON Content with import option

    • force (boolean)

  • Multipart file

    • the CSV formatted Ara file

The API endpoint returns :

Response codes

  • 200 if something is imported (even if there’s errors)

  • 404 if Referential not found

  • 401 if wrong token

  • 415 if wrong content type

  • 400 otherwise

The response body is a JSON structure with :

  • Models imported (total + each individually) 

  • Errors (Error reading or parsing a line)

{ "Import": { "Total": N, "StopAreas": N, "Lines": N, "VehicleJourneys": N, "StopVisits": N }, "Errors": [ "Error on line N: XX", "Error on line N: XX", ] }

The Ara import API is documented as a part of the Ara Referential Owner API.