GTFS icon indicating copy to clipboard operation
GTFS copied to clipboard

Update to latest GTFS reference

Open hypervtechnics opened this issue 5 years ago • 7 comments

Reference here: https://developers.google.com/transit/gtfs/reference#field_definitions

I started working on this. Will open PR when ready/pushable.

Changes to be made

  • Everywhere
    • [ ] Update xml documentation from reference
    • [ ] Check filename attributes
    • [x] Enums fixed numeric values
  • stops.txt
    • [x] Location type
    • [ ] Wheelchair boarding
    • [x] Parent station
  • routes.txt
    • [ ] Route sort order
  • trips.txt
    • [ ] Bikes allowed
  • routes.txt
    • [ ] Time point type nullable (?)
  • fare_attributes.txt
    • [ ] Transfers as enum (?)
    • [ ] Duration a uintn (?)
    • [x] Agency id
    • [ ] Price as double (?)
  • frequencies.txt
    • [ ] Headway secs as uint
    • [ ] Start and end time as DateTime
    • [ ] Exact times as enum
  • transfers.txt
    • [ ] Minimum transfer type as uint?
  • feed_info.txt
    • [ ] Contact email and url
    • [ ] Implement parsing (#56)
  • levels.txt and pathways.txt
    • [x] Add to model?

REMEMBER: update read/write logic, hash codes, equal operators

Entities/Files to be checked

  • [x] agency.txt
  • [x] stops.txt
  • [x] routes.txt
  • [x] trips.txt
  • [x] stop_times.txt
  • [x] calendar.txt
  • [x] calendar_dates.txt
  • [x] fare_attributes.txt
  • [x] fare_rules.txt
  • [x] shapes.txt
  • [x] frequencies.txt
  • [x] transfers.txt
  • [x] pathways.txt
  • [x] levels.txt
  • [x] feed_info.txt
  • [ ] Are the file requirements respected (if possible depending on strict mode)?

hypervtechnics avatar Oct 02 '19 14:10 hypervtechnics

@xivk I looked through the current reference. Any things to add/discuss from the changes to be made? I found some values to be strings which are ints as per GTFS reference. Is there a specific reason for this?

Otherwise I will start applying the changes during the next weeks.

hypervtechnics avatar Oct 15 '19 07:10 hypervtechnics

There was a huge pull request that I think fixes most of this. I will be grooming this code a bit before releasing a package but I have high hopes for it.

xivk avatar Nov 15 '19 11:11 xivk

Can you update the above states of what got implemented fully/partially/not when looking over the code?

hypervtechnics avatar Nov 15 '19 11:11 hypervtechnics

Ok will do that later when I get a chance to look at it more closely. Maybe @peetjvv can chip in here.

xivk avatar Nov 15 '19 11:11 xivk

@hypervtechnics

Seems I can't edit your list directly, so I will list the items to check off here. TODO items on your list which should be implemented/resolved in #62 are:

Everywhere:

  • Enums fixed numeric values

stops.txt:

  • Location type (including all new locations that are part of the pathways expansion)
  • Parent station

fare_attributes.txt:

  • agency_id (I have no idea why a fare_attribute has an agency_id in GTFS since it is already linked to an agency through the fare_attribute->fare_rule->route->agency connection)

levels.txt and pathways.txt:

  • the current implementation should be fully implemented in the entities and the SQLite db
  • in case you're interested, I know there are more changes to these files (and new supporting files) are being planned: https://docs.google.com/document/d/1qJOTe4m_a4dcJnvXYt4smYj4QQ1ejZ8CvLBYzDM5IyM/edit#heading=h.dpooq7li7zcq

Items I'm unsure about:

Everywhere:

  • Check filename attributes

stops.txt:

  • Wheelchair boarding

routes.txt:

  • route sort order (all outputted GTFS feeds will have all the entities sorted by id. not sure if that is what you were referring to)

peetjvv avatar Nov 15 '19 14:11 peetjvv

Check filename attributes

I mean e.g. those: https://github.com/itinero/GTFS/blob/033877c5b5ad708a04a4027cc453739f9fabff1f/src/GTFS/Entities/Agency.cs#L30

They seem to be unused but some of the filenames are not the filenames mentioned in the reference. Maybe the whole library can be adapted to an attribute-based approach which would be more flexible regarding spec updates. Only as an idea tho.

Wheelchair boarding

In the spec the enums are slightly different depending on the stop type. Just noted to inspect it :)

route sort order

grafik

I mean this. It is an additional field of route.

hypervtechnics avatar Nov 17 '19 21:11 hypervtechnics

I'm not sure what the filename attributes are used for really. Never touched them. Agreed, it would be ideal to use the field and file attributes in the output.

I've never really used wheelchair boarding myself, so I didn't pick up on the inconsistencies with the enums.

I didn't know about the new route_sort_order field either. Never really needed to support that field.

peetjvv avatar Nov 18 '19 09:11 peetjvv