Skip to content

Commit

Permalink
feat: Added features document. Some corrections to components presence (
Browse files Browse the repository at this point in the history
#1662)

* Added features document. Changes in components presence algo.
  • Loading branch information
jcpitre authored Feb 1, 2024
1 parent 6dcb8e7 commit b76ce1f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 37 deletions.
32 changes: 32 additions & 0 deletions docs/FEATURES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Discovery of component in feeds

The validator will produce the [list of components](https://docs.google.com/spreadsheets/d/1kpbKOzlHtsJIPo3B4ABYu-Nxwvqutjcdcvgpa0wZvtA) that it finds in the processed feed according to this table:

| Component | Feature | How is the presence of a feature determined (minimum requirements) |
|--------------------------|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Accesibility | Text-to-speech | One **tts_stop_name** value in [stops.txt](https://gtfs.org/schedule/reference/#stopstxt) |
| Accesibility | Wheelchair accesibility | One **wheelchair_accessible** value in [trips.txt](https://gtfs.org/schedule/reference/#tripstxt) <br>OR<br>one **wheelchair_boarding** value in [stops.txt](https://gtfs.org/schedule/reference/#stopstxt) |
| Accesibility | Route Colors | One **color** value <br>OR<br>one text_color value in [routes.txt](https://gtfs.org/schedule/reference/#routestxt) |
| Accesibility | Bike Allowed | One **bikes_allowed** value in [trips.txt](https://gtfs.org/schedule/reference/#tripstxt) |
| Accesibility | Translations | One line of data in [translations.txt](https://gtfs.org/schedule/reference/#translationstxt) |
| Accesibility | Headsigns | One **trip_headsign** in [trips.txt](https://gtfs.org/schedule/reference/#tripstxt)<br>OR<br>one stop_headsign value in [stop_times.txt](https://gtfs.org/schedule/reference/#stop_timestxt) |
| Fares | Fare Products | One line of data in [fare_products.txt](https://gtfs.org/schedule/reference/#fare_productstxt) |
| Fares | Fare Media | One line of data in [fare_media.txt](https://gtfs.org/schedule/reference/#fare_mediatxt) |
| Fares | Route-Based Fares | One **network_id** value in [routes.txt](https://gtfs.org/schedule/reference/#routestxt)<br/>OR<br/>one line of data in [networks..txt](https://gtfs.org/schedule/reference/#networkstxt) |
| Fares | Time-Based Fares | One line of data in [timeframes.txt](https://gtfs.org/schedule/reference/#timeframestxt) |
| Fares | Zone-Based Fares | One line of data in [areas.txt](https://gtfs.org/schedule/reference/#areastxt) |
| Fares | Transfer Fares | One line of data in [fare_transfer_rules.txt](https://gtfs.org/schedule/reference/#fare_transfer_rulestxt) |
| Fares | Fares V1 | One line of data in [fare_attributes.txt](https://gtfs.org/schedule/reference/#fare_attributestxt) |
| Pathways | Pathways (basic)* | One line of data in [pathways.txt](https://gtfs.org/schedule/reference/#pathwaystxt) |
| Pathways | Pathways (extra)* | One value of **max_slope**<br/>OR<br/>**min_width** <br/>OR<br/>**length** <br/>OR<br/>**stair_count** in [pathways.txt](https://gtfs.org/schedule/reference/#pathwaystxt) |
| Pathways | Levels | One line of data in [levels.txt](https://gtfs.org/schedule/reference/#levelstxt) |
| Pathways | In-station traversal time | One **traversal_time** value in [pathways.txt](https://gtfs.org/schedule/reference/#pathwaystxt) |
| Pathways | Pathways directions | One **signposted_as** value<br/>AND<br/>one **reversed_signposted_as** in [pathways.txt](https://gtfs.org/schedule/reference/#pathwaystxt) |
| Pathways | Location types | One **location_type** value in [stops.txt](https://gtfs.org/schedule/reference/#stopstxt) |
| Metadata | Feed Information | One line of data in [feed_info.txt](https://gtfs.org/schedule/reference/#feed_infotxt) |
| Metadata | Attributions | One line of data in [attributions.txt](https://gtfs.org/schedule/reference/#attributionstxt) |
| Flexible Services | Continuous Stops | One **continuous_dropoff** value in [routes.txt](https://gtfs.org/schedule/reference/#routestxt)<br/>OR<br/>one **continuous_pickup** value in [routes.txt](https://gtfs.org/schedule/reference/#routestxt)<br/>OR<br/>one **continuous_dropoff** value in [stop_times.txt](https://gtfs.org/schedule/reference/#stop_timestxt)<br/>OR<br/>one **continuous_pickup** value in [stop_times.txt](https://gtfs.org/schedule/reference/#stop_timestxt) |
| Shapes | Shapes | One line of data in [shapes.txt](https://gtfs.org/schedule/reference/#shapestxt) |
| Transfers | Transfers | One line of data in [transfers.txt](https://gtfs.org/schedule/reference/#transferstxt) |
| Frequency-based Services | Frequencies | One line of data in [frequencies.txt](https://gtfs.org/schedule/reference/#frequenciestxt) |

Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public class FeedMetadata {
public ArrayList<AgencyMetadata> agencies = new ArrayList<>();
private ImmutableSortedSet<String> filenames;

// List of components that only require checking the presence of one record in the file.
private final List<Pair<String, String>> FILE_BASED_COMPONENTS =
List.of(
new Pair<>("Pathways (basic)", GtfsPathway.FILENAME),
new Pair<>("Pathways (extra)", GtfsPathway.FILENAME),
new Pair<>("Transfers", GtfsTransfer.FILENAME),
new Pair<>("Fares V1", GtfsFareAttribute.FILENAME),
new Pair<>("Fare Products", GtfsFareProduct.FILENAME),
Expand All @@ -57,7 +57,6 @@ public class FeedMetadata {
new Pair<>("Zone-Based Fares", GtfsArea.FILENAME),
new Pair<>("Transfer Fares", GtfsFareTransferRule.FILENAME),
new Pair<>("Time-Based Fares", GtfsTimeframe.FILENAME),
new Pair<>("Route-Based Fares", GtfsNetwork.FILENAME),
new Pair<>("Levels", GtfsLevel.FILENAME));

protected FeedMetadata() {}
Expand Down Expand Up @@ -152,13 +151,8 @@ private void loadSpecFeaturesBasedOnFieldPresence(GtfsFeedContainer feedContaine
loadTraversalTimeComponent(feedContainer);
loadPathwayDirectionsComponent(feedContainer);
loadPathwayExtraComponent(feedContainer);
loadBlocksComponent(feedContainer);
loadRouteBasedFaresComponent(feedContainer);
loadContinuousStopsComponent(feedContainer);
loadZoneBasedComponent(feedContainer);
loadTimeBasedFaresComponent(feedContainer);
loadTransferFaresComponent(feedContainer);
loadLevelsComponent(feedContainer);
}

private void loadContinuousStopsComponent(GtfsFeedContainer feedContainer) {
Expand Down Expand Up @@ -192,18 +186,9 @@ private void loadRouteBasedFaresComponent(GtfsFeedContainer feedContainer) {
|| hasAtLeastOneRecordInFile(feedContainer, GtfsNetwork.FILENAME));
}

private void loadBlocksComponent(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Blocks",
hasAtLeastOneRecordForFields(
feedContainer,
GtfsTrip.FILENAME,
List.of((Function<GtfsTrip, Boolean>) GtfsTrip::hasBlockId)));
}

private void loadPathwayDirectionsComponent(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Pathway Directions",
"Pathways Directions",
hasAtLeastOneRecordForFields(
feedContainer,
GtfsPathway.FILENAME,
Expand All @@ -214,7 +199,7 @@ private void loadPathwayDirectionsComponent(GtfsFeedContainer feedContainer) {

private void loadPathwayExtraComponent(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Pathway (extra)",
"Pathways (extra)",
hasAtLeastOneRecordForFields(
feedContainer,
GtfsPathway.FILENAME,
Expand Down Expand Up @@ -308,25 +293,6 @@ private void loadRouteColorsComponent(GtfsFeedContainer feedContainer) {
List.of((Function<GtfsRoute, Boolean>) GtfsRoute::hasRouteTextColor)));
}

private void loadZoneBasedComponent(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Zone-Based Fares", hasAtLeastOneRecordInFile(feedContainer, GtfsArea.FILENAME));
}

private void loadTimeBasedFaresComponent(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Time-Based Fares", hasAtLeastOneRecordInFile(feedContainer, GtfsTimeframe.FILENAME));
}

private void loadTransferFaresComponent(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Transfer Fares", hasAtLeastOneRecordInFile(feedContainer, GtfsFareTransferRule.FILENAME));
}

private void loadLevelsComponent(GtfsFeedContainer feedContainer) {
specFeatures.put("Levels", hasAtLeastOneRecordInFile(feedContainer, GtfsLevel.FILENAME));
}

private void loadAgencyData(GtfsTableContainer<GtfsAgency> agencyTable) {
for (GtfsAgency agency : agencyTable.getEntities()) {
agencies.add(AgencyMetadata.from(agency));
Expand Down

0 comments on commit b76ce1f

Please sign in to comment.