Skip to content

Commit

Permalink
Merge f6f8bff into bf25c9b
Browse files Browse the repository at this point in the history
  • Loading branch information
cka-y committed Mar 7, 2024
2 parents bf25c9b + f6f8bff commit 6aefb25
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class JsonReportSummary {
@SerializedName("counts")
private JsonReportCounts jsonReportCounts;

private List<String> gtfsComponents;
private List<String> gtfsFeatures;

public JsonReportSummary(
FeedMetadata feedMetadata,
Expand Down Expand Up @@ -89,7 +89,7 @@ public JsonReportSummary(
+ ", there will be missing data in the report.");
}

this.gtfsComponents =
this.gtfsFeatures =
feedMetadata.specFeatures == null
? null
: feedMetadata.specFeatures.entrySet().stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ 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 features that only require checking the presence of one record in the file.
private final List<Pair<String, String>> FILE_BASED_FEATURES =
List.of(
new Pair<>("Pathways (basic)", GtfsPathway.FILENAME),
new Pair<>("Transfers", GtfsTransfer.FILENAME),
Expand Down Expand Up @@ -136,26 +136,26 @@ private void loadSpecFeatures(GtfsFeedContainer feedContainer) {
}

private void loadSpecFeaturesBasedOnFilePresence(GtfsFeedContainer feedContainer) {
for (Pair<String, String> entry : FILE_BASED_COMPONENTS) {
for (Pair<String, String> entry : FILE_BASED_FEATURES) {
specFeatures.put(entry.getKey(), hasAtLeastOneRecordInFile(feedContainer, entry.getValue()));
}
}

private void loadSpecFeaturesBasedOnFieldPresence(GtfsFeedContainer feedContainer) {
loadRouteColorsComponent(feedContainer);
loadHeadsignsComponent(feedContainer);
loadWheelchairAccessibilityComponent(feedContainer);
loadTTSComponent(feedContainer);
loadBikeAllowanceComponent(feedContainer);
loadLocationTypesComponent(feedContainer);
loadTraversalTimeComponent(feedContainer);
loadPathwayDirectionsComponent(feedContainer);
loadPathwayExtraComponent(feedContainer);
loadRouteBasedFaresComponent(feedContainer);
loadContinuousStopsComponent(feedContainer);
loadRouteColorsFeature(feedContainer);
loadHeadsignsFeature(feedContainer);
loadWheelchairAccessibilityFeature(feedContainer);
loadTTSFeature(feedContainer);
loadBikeAllowanceFeature(feedContainer);
loadLocationTypesFeature(feedContainer);
loadTraversalTimeFeature(feedContainer);
loadPathwayDirectionsFeature(feedContainer);
loadPathwayExtraFeature(feedContainer);
loadRouteBasedFaresFeature(feedContainer);
loadContinuousStopsFeature(feedContainer);
}

private void loadContinuousStopsComponent(GtfsFeedContainer feedContainer) {
private void loadContinuousStopsFeature(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Continuous Stops",
hasAtLeastOneRecordForFields(
Expand All @@ -176,7 +176,7 @@ private void loadContinuousStopsComponent(GtfsFeedContainer feedContainer) {
List.of((Function<GtfsStopTime, Boolean>) GtfsStopTime::hasContinuousPickup)));
}

private void loadRouteBasedFaresComponent(GtfsFeedContainer feedContainer) {
private void loadRouteBasedFaresFeature(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Route-Based Fares",
hasAtLeastOneRecordForFields(
Expand All @@ -186,7 +186,7 @@ private void loadRouteBasedFaresComponent(GtfsFeedContainer feedContainer) {
|| hasAtLeastOneRecordInFile(feedContainer, GtfsNetwork.FILENAME));
}

private void loadPathwayDirectionsComponent(GtfsFeedContainer feedContainer) {
private void loadPathwayDirectionsFeature(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Pathways Directions",
hasAtLeastOneRecordForFields(
Expand All @@ -197,7 +197,7 @@ private void loadPathwayDirectionsComponent(GtfsFeedContainer feedContainer) {
(Function<GtfsPathway, Boolean>) GtfsPathway::hasReversedSignpostedAs)));
}

private void loadPathwayExtraComponent(GtfsFeedContainer feedContainer) {
private void loadPathwayExtraFeature(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Pathways (extra)",
hasAtLeastOneRecordForFields(
Expand All @@ -218,7 +218,7 @@ private void loadPathwayExtraComponent(GtfsFeedContainer feedContainer) {
List.of((Function<GtfsPathway, Boolean>) GtfsPathway::hasStairCount)));
}

private void loadTraversalTimeComponent(GtfsFeedContainer feedContainer) {
private void loadTraversalTimeFeature(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Traversal Time",
hasAtLeastOneRecordForFields(
Expand All @@ -227,7 +227,7 @@ private void loadTraversalTimeComponent(GtfsFeedContainer feedContainer) {
List.of((Function<GtfsPathway, Boolean>) GtfsPathway::hasTraversalTime)));
}

private void loadLocationTypesComponent(GtfsFeedContainer feedContainer) {
private void loadLocationTypesFeature(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Location Types",
hasAtLeastOneRecordForFields(
Expand All @@ -236,7 +236,7 @@ private void loadLocationTypesComponent(GtfsFeedContainer feedContainer) {
List.of((Function<GtfsStop, Boolean>) GtfsStop::hasLocationType)));
}

private void loadBikeAllowanceComponent(GtfsFeedContainer feedContainer) {
private void loadBikeAllowanceFeature(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Bikes Allowance",
hasAtLeastOneRecordForFields(
Expand All @@ -245,7 +245,7 @@ private void loadBikeAllowanceComponent(GtfsFeedContainer feedContainer) {
List.of((Function<GtfsTrip, Boolean>) (GtfsTrip::hasBikesAllowed))));
}

private void loadTTSComponent(GtfsFeedContainer feedContainer) {
private void loadTTSFeature(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Text-To-Speech",
hasAtLeastOneRecordForFields(
Expand All @@ -254,7 +254,7 @@ private void loadTTSComponent(GtfsFeedContainer feedContainer) {
List.of(((Function<GtfsStop, Boolean>) GtfsStop::hasTtsStopName))));
}

private void loadWheelchairAccessibilityComponent(GtfsFeedContainer feedContainer) {
private void loadWheelchairAccessibilityFeature(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Wheelchair Accessibility",
hasAtLeastOneRecordForFields(
Expand All @@ -267,7 +267,7 @@ private void loadWheelchairAccessibilityComponent(GtfsFeedContainer feedContaine
List.of((Function<GtfsStop, Boolean>) GtfsStop::hasWheelchairBoarding)));
}

private void loadHeadsignsComponent(GtfsFeedContainer feedContainer) {
private void loadHeadsignsFeature(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Headsigns",
hasAtLeastOneRecordForFields(
Expand All @@ -280,7 +280,7 @@ private void loadHeadsignsComponent(GtfsFeedContainer feedContainer) {
List.of((Function<GtfsStopTime, Boolean>) GtfsStopTime::hasStopHeadsign)));
}

private void loadRouteColorsComponent(GtfsFeedContainer feedContainer) {
private void loadRouteColorsFeature(GtfsFeedContainer feedContainer) {
specFeatures.put(
"Route Colors",
hasAtLeastOneRecordForFields(
Expand Down Expand Up @@ -319,17 +319,17 @@ private void loadFeedInfo(GtfsTableContainer<GtfsFeedInfo> feedTable) {
}

private boolean hasAtLeastOneRecordInFile(
GtfsFeedContainer feedContainer, String componentFilename) {
var table = feedContainer.getTableForFilename(componentFilename);
GtfsFeedContainer feedContainer, String featureFilename) {
var table = feedContainer.getTableForFilename(featureFilename);
return table.isPresent() && table.get().entityCount() > 0;
}

private <T extends GtfsEntity> boolean hasAtLeastOneRecordForFields(
GtfsFeedContainer feedContainer,
String componentFilename,
String featureFilename,
List<Function<T, Boolean>> conditions) {
return feedContainer
.getTableForFilename(componentFilename)
.getTableForFilename(featureFilename)
.map(
table ->
table.getEntities().stream()
Expand Down
8 changes: 4 additions & 4 deletions main/src/main/resources/report.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
display: table-row;
}

#gtfs-components-container > div {
#gtfs-features-container > div {
display: flex;
justify-content: center;
align-content: center;
Expand Down Expand Up @@ -285,11 +285,11 @@ <h4>Counts</h4>
<li th:each="count: ${metadata.counts}"><span th:text="${count.key} + ': ' + ${count.value}" /></li>
</ul>
</div>
<div class="summary-cell summary_list" id="gtfs-components-container">
<div class="summary-cell summary_list" id="gtfs-features-container">
<h4>
GTFS Components included
GTFS Features included
<a href="#" class="tooltip" onclick="event.preventDefault();"><span>(?)</span>
<span class="tooltiptext" style="transform: translateX(-100%)">GTFS components provide a standardized vocabulary to define and describe features that are officially adopted in GTFS.</span>
<span class="tooltiptext" style="transform: translateX(-100%)">GTFS features provide a standardized vocabulary to define and describe features that are officially adopted in GTFS.</span>
</a>
</h4>
<hr />
Expand Down
Loading

0 comments on commit 6aefb25

Please sign in to comment.