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

Feat: update features for validator 6.0 #771

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions web-app/src/app/screens/Feed/FeedSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { type components } from '../../services/feeds/types';
import { useTranslation } from 'react-i18next';
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
import { theme } from '../../Theme';
import { DATASET_FEATURES } from '../../utils/consts';
import { getDataFeatureUrl } from '../../utils/consts';

export interface FeedSummaryProps {
feed: GTFSFeedType | GTFSRTFeedType | undefined;
Expand Down Expand Up @@ -312,11 +312,7 @@ export default function FeedSummary({
},
}}
onClick={() => {
window.open(
DATASET_FEATURES[feature]?.linkToInfo ??
DATASET_FEATURES.overview.linkToInfo,
'_blank',
);
window.open(getDataFeatureUrl(feature), '_blank');
}}
/>
</Grid>
Expand Down
99 changes: 79 additions & 20 deletions web-app/src/app/utils/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ interface DatasetFeature {

type DatasetFeatures = Record<string, DatasetFeature>;

export function getDataFeatureUrl(feature: string): string {
return (
DATASET_FEATURES[feature]?.linkToInfo ??
DATASET_FEATURES.overview.linkToInfo
);
}

export const DATASET_FEATURES: DatasetFeatures = {
overview: {
component: '',
Expand All @@ -18,31 +25,38 @@ export const DATASET_FEATURES: DatasetFeatures = {
linkToInfo:
'https://gtfs.org/getting_started/features/accessibility/#text-to-speech',
},
'Wheelchair Accessibility': {
'Stops Wheelchair Accessibility': {
component: 'Accessibility',
fileName: 'trips.txt',
linkToInfo: 'https://gtfs.org/getting_started/features/accessibility',
linkToInfo:
'https://gtfs.org/getting_started/features/accessibility/#stops-wheelchair-accessibility',
},
'Route Colors': {
'Trips Wheelchair Accessibility': {
component: 'Accessibility',
fileName: 'trips.txt',
linkToInfo:
'https://gtfs.org/getting_started/features/accessibility/#trips-wheelchair-accessibility',
},
'Route Colors': {
component: 'Base add-ons',
fileName: 'routes.txt',
linkToInfo:
'https://gtfs.org/getting_started/features/base_add-ons/#route-colors',
},
'Bikes Allowance': {
component: 'Accessibility',
'Bike Allowed': {
component: 'Base add-ons',
fileName: 'trips.txt',
linkToInfo:
'https://gtfs.org/getting_started/features/base_add-ons/#bike-allowed',
},
Translations: {
component: 'Accessibility',
component: 'Base add-ons',
fileName: 'translations.txt',
linkToInfo:
'https://gtfs.org/getting_started/features/base_add-ons/#translations',
},
Headsigns: {
component: 'Accessibility',
component: 'Base add-ons',
fileName: 'trips.txt',
linkToInfo:
'https://gtfs.org/getting_started/features/base_add-ons/#headsigns',
Expand Down Expand Up @@ -76,24 +90,24 @@ export const DATASET_FEATURES: DatasetFeatures = {
linkToInfo:
'https://gtfs.org/getting_started/features/fares/#zone-based-fares',
},
'Transfer Fares': {
'Fare Transfers': {
component: 'Fares',
fileName: 'fare_transfer_rules.txt',
linkToInfo:
'https://gtfs.org/getting_started/features/fares/#fares-transfers',
'https://gtfs.org/getting_started/features/fares/#fare-transfers',
},
'Fares V1': {
component: 'Fares',
fileName: 'fare_attributes.txt',
linkToInfo: 'https://gtfs.org/getting_started/features/fares/#fares-v1',
},
'Pathways (basic)': {
'Pathway Connections': {
component: 'Pathways',
fileName: 'pathways.txt',
linkToInfo:
'https://gtfs.org/getting_started/features/pathways/#pathway-connections',
},
'Pathways (extra)': {
'Pathway Details': {
component: 'Pathways',
fileName: 'pathways.txt',
linkToInfo:
Expand All @@ -104,31 +118,32 @@ export const DATASET_FEATURES: DatasetFeatures = {
fileName: 'levels.txt',
linkToInfo: 'https://gtfs.org/getting_started/features/pathways/#levels',
},
'Traversal Time': {
'In-station traversal time': {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: revisit the upper / lower case of the spelling of this key

component: 'Pathways',
fileName: 'pathways.txt',
linkToInfo:
'https://gtfs.org/getting_started/features/pathways/#in-station-traversal-time',
},
'Pathways Directions': {
'Pathway Signs': {
component: 'Pathways',
fileName: 'pathways.txt',
linkToInfo: 'https://gtfs.org/schedule/reference/#pathwaystxt',
linkToInfo:
'https://gtfs.org/getting_started/features/pathways/#pathway-signs',
},
'Location Types': {
component: 'Pathways',
component: 'Base add-ons',
fileName: 'stops.txt',
linkToInfo:
'https://gtfs.org/getting_started/features/base_add-ons/#location-types',
},
'Feed Information': {
component: 'Metadata',
component: 'Base add-ons',
fileName: 'feed_info.txt',
linkToInfo:
'https://gtfs.org/getting_started/features/base_add-ons/#feed-information',
},
Attributions: {
component: 'Metadata',
component: 'Base add-ons',
fileName: 'attributions.txt',
linkToInfo:
'https://gtfs.org/getting_started/features/base_add-ons/#attributions',
Expand All @@ -139,22 +154,66 @@ export const DATASET_FEATURES: DatasetFeatures = {
linkToInfo:
'https://gtfs.org/getting_started/features/flexible_services/#continuous-stops',
},
'Booking Rules': {
component: 'Flexible Services',
fileName: 'routes.txt',
linkToInfo:
'https://gtfs.org/getting_started/features/flexible_services/#booking-rules',
},
'Fixed-Stops Demand Responsive Services': {
component: 'Flexible Services',
fileName: 'location_groups.txt',
linkToInfo:
'https://gtfs.org/getting_started/features/flexible_services/#fixed-stops-demand-responsive-services',
},
'Zone-Based Demand Responsive Services': {
component: 'Flexible Services',
fileName: 'stop_times.txt',
linkToInfo:
'https://gtfs.org/getting_started/features/flexible_services/#zone-based-demand-responsive-services',
},
'Predefined Routes with Deviation': {
component: 'Flexible Services',
fileName: 'stop_times.txt',
linkToInfo:
'https://gtfs.org/getting_started/features/flexible_services/#predefined-routes-with-deviation',
},
Shapes: {
component: 'Shapes',
component: 'Base add-ons',
fileName: 'shapes.txt',
linkToInfo:
'https://gtfs.org/getting_started/features/base_add-ons/#shapes ',
},
Transfers: {
component: 'Transfers',
component: 'Base add-ons',
fileName: 'transfers.txt',
linkToInfo:
'https://gtfs.org/getting_started/features/base_add-ons/#transfers',
},
Frequencies: {
component: 'Frequency-based Services',
component: 'Base add-ons',
fileName: 'frequencies.txt',
linkToInfo:
'https://gtfs.org/getting_started/features/base_add-ons/#frequency-based-service ',
},
};

// DEPRECATED FEATURES
Copy link
Member

Choose a reason for hiding this comment

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

👍

DATASET_FEATURES['Wheelchair Accessibility'] = {
// as of 6.0
component: 'Accessibility',
fileName: 'trips.txt',
linkToInfo: 'https://gtfs.org/getting_started/features/accessibility',
};
DATASET_FEATURES['Bikes Allowance'] = DATASET_FEATURES['Bike Allowed'];
DATASET_FEATURES['Transfer Fares'] = DATASET_FEATURES['Fare Transfers']; // as of 6.0
DATASET_FEATURES['Pathways (basic)'] = DATASET_FEATURES['Pathway Connections']; // as of 6.0
DATASET_FEATURES['Pathways (extra)'] = DATASET_FEATURES['Pathway Details']; // as of 6.0
DATASET_FEATURES['Traversal Time'] =
DATASET_FEATURES['In-station traversal time'];
DATASET_FEATURES['Pathways Directions'] = {
// as of 6.0
component: 'Pathways',
fileName: 'pathways.txt',
linkToInfo: 'https://gtfs.org/schedule/reference/#pathwaystxt',
};