Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include names in paths in CSV #930

Merged
merged 7 commits into from
Feb 29, 2024
Merged

Include names in paths in CSV #930

merged 7 commits into from
Feb 29, 2024

Conversation

abyrd
Copy link
Member

@abyrd abyrd commented Feb 2, 2024

This makes it possible to represent stops and routes in CSV output using their names in addition to (or instead of) their IDs. Users have commented that they greatly prefer to work with the names, and often only with the names. Though they're not guaranteed to be unique, in some data sets names are clear enough to work well.

Showing route names has the additional major benefit of showing which modification created a route (instead of a meaningless UUID) in routes that did not come from GTFS.

As recently discussed, this also introduced a freeform Set<String> flags field in requests for enabling experimental, undocumented, or arcane behavior in backend or workers. When making a JSON request this will look like "flags": ["csv_names", "csv_no_ids"]. This should progressively replace all previous special behavior flags that were embedded inside analysis names etc.

I have tested this locally and it seems to work for all three entity representations.

Now that it's implemented, a few questions emerge. One is whether it's really worth it to define an enum for EntityRepresentation { ID_ONLY, NAME_ONLY, ID_AND_NAME } or it should just be two boolean parameters. Another is whether this would be better represented by actually adding a real enum-typed parameter to the requests. It would require less conversions and make it easier to toggle stop and route representations separately for example.

I think the flags facility should still be retained for other purposes even if we stop using it for this purpose.

reverse order of name and ID in output and enum.
string flags are maintained in request but no longer used.
deleted code serves as example of how to use flags.
@abyrd
Copy link
Member Author

abyrd commented Feb 16, 2024

Updated to add a nested CsvRequestOptions structure to control route, stop, feed ID representation independently (as decided on 2024-02-08 meeting).

Order of name and ID have been reversed to place name first.
String flags system continues to exist in requests but is no longer used to enable this feature.

This has been tested locally with no CsvRequestOptions, and with options affecting each of routes and stops separately, as well as together. It seems to work as intended.

  "csvResultOptions": {
    "stopRepresentation": "NAME_ONLY",
    "routeRepresentation": "NAME_AND_ID"
  },

@abyrd abyrd marked this pull request as ready for review February 16, 2024 16:51
Copy link
Member

@ansoncfit ansoncfit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall -- just a few suggestions to tidy imports.

@abyrd abyrd self-assigned this Feb 29, 2024
@abyrd abyrd enabled auto-merge February 29, 2024 02:49
@abyrd abyrd merged commit 5aa45f5 into dev Feb 29, 2024
2 checks passed
@abyrd abyrd deleted the path-route-names branch February 29, 2024 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants