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

Location Groups July 2024 #1017

Open
wants to merge 23 commits into
base: dev-flex-2024
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
aabc35b
resolve schema update crashes
miles-grant-ibigroup May 15, 2024
fc342df
match server data structure
miles-grant-ibigroup May 15, 2024
de5f50d
clean up pattern card
miles-grant-ibigroup May 15, 2024
c54b3a2
first attempt at implementing new location groups
miles-grant-ibigroup May 17, 2024
95b1fb9
Merge branch 'dev-flex-2024' into location-group-may-2024
miles-grant-ibigroup May 21, 2024
a930f56
fix: define and document MAP_BASE_URL to prevent gray maps
Aletor93 Jul 3, 2024
10d4ff4
remove unitary `stop_id`, re-unite patternStops
miles-grant-ibigroup Jul 11, 2024
a0800cd
lint
miles-grant-ibigroup Jul 11, 2024
a0e16c2
fix pattern stop adding
miles-grant-ibigroup Jul 18, 2024
d8d8ef5
fix pattern stop location map rendering
miles-grant-ibigroup Jul 18, 2024
d731c34
fix: comment default MAP_BASE_URL
Aletor93 Jul 29, 2024
f256f0f
Merge pull request #1016 from Aletor93/fix-mapbox-gray-maps
miles-grant-ibigroup Jul 29, 2024
bf947a6
correctly label stops/locations
miles-grant-ibigroup Aug 2, 2024
6fa434f
fix pattern stop reordering
miles-grant-ibigroup Aug 7, 2024
71b16ea
correctly handle adding non-stops to pattern
miles-grant-ibigroup Aug 8, 2024
9ff7ee9
correct stopStrategies patternStop pushing
miles-grant-ibigroup Aug 16, 2024
2c78875
send `pattern_id` along with every pattern stop
miles-grant-ibigroup Sep 12, 2024
0c34d0d
Merge branch 'dev' into pattern-location-groups-july-2024
miles-grant-ibigroup Sep 17, 2024
e5ec45b
inital flow type fixes
daniel-heppner-ibigroup Oct 16, 2024
b705a1a
correct flow issues (non location group)
miles-grant-ibigroup Jan 3, 2025
ee6429c
fix tests
miles-grant-ibigroup Jan 3, 2025
4dae31a
use new `GtfsLocation` where previously `GtfsLocationGroup` was used
miles-grant-ibigroup Jan 3, 2025
04ffe0b
add missing polish
miles-grant-ibigroup Jan 3, 2025
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
3 changes: 2 additions & 1 deletion configurations/default/env.yml.tmp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ MAP_BASE_URL: optional-map-tile-url
MAPBOX_ACCESS_TOKEN: your-mapbox-access-token
MAPBOX_MAP_ID: mapbox/outdoors-v11
MAPBOX_ATTRIBUTION: <a href="https://www.mapbox.com/about/maps/" target="_blank">&copy; Mapbox &copy; OpenStreetMap</a> <a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a>
# MAP_BASE_URL: http://tile.openstreetmap.org/{z}/{x}/{y}.png # Uncomment it if maps are gray
SLACK_CHANNEL: optional-slack-channel
SLACK_WEBHOOK: optional-slack-webhook
GRAPH_HOPPER_KEY: your-graph-hopper-key
Expand All @@ -23,4 +24,4 @@ GRAPH_HOPPER_KEY: your-graph-hopper-key
# - 83
GOOGLE_ANALYTICS_TRACKING_ID: optional-ga-key
# GRAPH_HOPPER_POINT_LIMIT: 10 # Defaults to 30
DISABLE_AUTH: true
DISABLE_AUTH: true
4 changes: 3 additions & 1 deletion docs/dev/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ Enables the GTFS Editor module.
- `MAPBOX_ACCESS_TOKEN`
- `R5_URL` (optional parameter for r5 routing in editor pattern drawing)

**Note:** If maps are gray, add the property `MAP_BASE_URL: http://tile.openstreetmap.org/{z}/{x}/{y}.png` into `env.yml`.

### R5 network validation

While the application handles basic validation even without the `r5_network`
Expand Down Expand Up @@ -320,4 +322,4 @@ extensions:
enabled: true
api: http://api.transitfeeds.com/v1/getFeeds
key: your-api-key
```
```
36 changes: 29 additions & 7 deletions gtfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -650,10 +650,20 @@
inputType: TIME
columnWidth: 6
- name: "stop_id"
required: true
required: false
inputType: GTFS_STOP
columnWidth: 6
helpContent: "The stop_id field contains an ID that uniquely identifies a stop. Multiple routes may use the same stop. The stop_id is referenced from the stops.txt file. If location_type is used in stops.txt, all stops referenced in stop_times.txt must have location_type of 0."
- name: "location_id"
required: false
inputType: GTFS_ID
columnWidth: 6
helpContent: "The location_id field contains an ID that uniquely identifies a location. Multiple routes may use the same stop. The stop_id is referenced from the stops.txt file. If location_type is used in stops.txt, all stops referenced in stop_times.txt must have location_type of 0."
- name: "location_group_id"
required: false
inputType: TEXT
columnWidth: 6
helpContent: "The location_group_id field contains an ID that uniquely identifies a location group. Multiple routes may use the same stop. The stop_id is referenced from the stops.txt file. If location_type is used in stops.txt, all stops referenced in stop_times.txt must have location_type of 0."
- name: "stop_sequence"
required: true
inputType: POSITIVE_INT
Expand Down Expand Up @@ -1162,6 +1172,16 @@
helpContent: "The stop_url field contains the URL of a web page about a particular location. This should be different from the agency_url and the route_url fields."

# FIXME: helpContent is lifted from https://github.com/MobilityData/gtfs-flex/blob/master/spec/reference.md
- id: locationgroupstop
flex: true
name: location_group_stops.txt
fields:
- name: "location_group_id"
required: true
inputType: TEXT
- name: "stop_id"
required: true
inputType: GTFS_ID
- id: locationgroup
flex: true
name: location_groups.txt
Expand All @@ -1178,9 +1198,11 @@
inputType: TEXT
columnWidth: 12
helpContent: "Name of the location group. Must be defined either once, or exhaustively for a single location_group_id."
# TODO: enable validation to match spec (only appear when appropriate)
- name: "location_id"
required: false
inputType: GTFS_STOP_OR_LOCATION_LIST
columnWidth: 12
helpContent: "Identifies a stop or location belonging to the location group."
extraFields:
- name: "stop_id"
required: false
inputType: GTFS_STOP_OR_LOCATION_LIST
columnWidth: 12
helpContent: "Identifies a stop or location belonging to the location group."
activeComponentOverride: "locationgroupstop"

7 changes: 7 additions & 0 deletions i18n/polish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ components:
autoPublish: Automatycznie publikuj
dateFormat: MMM D, YYYY
deployable: Rozmieszczany
flex: Flexible service
edit: Edytować
lastUpdatedDate: Last updated %date%
noUpdates: No updates
Expand Down Expand Up @@ -632,6 +633,10 @@ components:
title: Real-time updaters
walkSpeed: Walk Speed
GeneralSettings:
flex:
title: Flex Service
checkbox: Feed includes flex service
description: Enable this feed source to include flex service. Checking this checkbox will enable flex tools in the editor. Flex service describes operations that follow a schedule, but also include flexible features such as dial-a-ride service, route deviation, continuous stops, or point to zone service.
autoFetch:
checkbox: Auto fetch feed source
hint: Set this feed source to fetch automatically. (Feed source URL must be
Expand Down Expand Up @@ -744,6 +749,8 @@ components:
stop:
label: Stops
title: Edit stops
GtfsServiceSelect:
placeholder: Select existing service ID
GtfsValidationExplorer:
accessibilityValidation: Accessibility Explorer
table:
Expand Down
4 changes: 3 additions & 1 deletion lib/editor/actions/active.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
removeEditorLock
} from './editor'
import {saveTripPattern} from './tripPattern'
import { saveLocation } from './location'
import { saveLocation, saveLocationGroup } from './location'

export const clearGtfsContent = createVoidPayloadAction('CLEAR_GTFSEDITOR_CONTENT')
export const receivedNewEntity = createAction(
Expand Down Expand Up @@ -373,6 +373,8 @@ export function saveActiveGtfsEntity (
return dispatch(saveTripPattern(feedId, (entity: any)))
case 'location':
return dispatch(saveLocation(feedId, (entity: any), refetch))
case 'locationgroup':
return dispatch(saveLocationGroup(feedId, (entity: any), refetch))
default:
// Default method for agencies, stops, routes, fares, calendars.
// Trip patterns and feed info are handled above. Trips are handled in
Expand Down
7 changes: 4 additions & 3 deletions lib/editor/actions/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ function getCloneProps (entityId: number, component: string, state: AppState) {
patternId: newPatternId,
shapeId: newShapeId,
shapePoints: pattern.shapePoints.map(sp => ({...sp, shapeId: newShapeId})),
patternLocationGroups: pattern.patternLocationGroups && pattern.patternLocationGroups.map(plg => ({...plg, patternId: newPatternId})),
patternLocations: pattern.patternLocations.map(pl => ({...pl, patternId: newPatternId})),
patternStops: pattern.patternStops.map(ps => ({...ps, patternId: newPatternId}))
}
case 'route':
Expand Down Expand Up @@ -480,9 +478,12 @@ export function fetchBaseGtfs ({
location_groups {
id
location_group_id
location_id
location_group_name
}
location_group_stops {
location_group_id
stop_id
}
feed_info {
id
feed_id
Expand Down
64 changes: 64 additions & 0 deletions lib/editor/actions/location.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,70 @@ import type {GtfsLocation} from '../../types'

import { receivedNewEntity, savedGtfsEntity } from './active'

export function saveLocationGroup (
feedId: ?string,
locationGroup: GtfsLocation,
refetch: ?boolean = true
) {
return function (dispatch: dispatchFn, getState: getStateFn) {
if (!feedId || !locationGroup) {
return
}
// dispatch(savingActiveLocation()) //Update this?

const notNew = !entityIsNew(locationGroup) // Checks if id is -2 or undefined
const method = notNew ? 'put' : 'post'
const idParam = notNew ? `/${locationGroup.id || ''}` : ''
const {sessionId} = getState().editor.data.lock

const mappingStrategy = getMapFromGtfsStrategy('locationGroup')
const data = mappingStrategy(locationGroup)

const locationGroupUrl = `/api/editor/secure/locationgroup${idParam}?feedId=${feedId}&sessionId=${sessionId || ''}`
const locationGroupStopsUrl = `/api/editor/secure/locationgroupstop${idParam}?feedId=${feedId}&sessionId=${sessionId || ''}`

dispatch(secureFetch(locationGroupStopsUrl, method, data))
.then(res => res.json())
.then(savedEntity => {
dispatch(savedGtfsEntity())
const namespace = getEditorNamespace(feedId, getState())
// Refetch entity and replace in store
if (refetch) {
dispatch(fetchGTFSEntities({
namespace,
id: savedEntity.id,
type: 'locationgroupstop',
editor: true,
replaceNew: !notNew
}))
} else {
// Push new entity into store.
dispatch(receivedNewEntity({component: 'locationgroupstop', entity: savedEntity}))
}
})
return dispatch(secureFetch(locationGroupUrl, method, data))
.then(res => res.json())
.then(savedEntity => {
dispatch(savedGtfsEntity())
const namespace = getEditorNamespace(feedId, getState())
// Refetch entity and replace in store
if (refetch) {
dispatch(fetchGTFSEntities({
namespace,
id: savedEntity.id,
type: 'locationgroup',
editor: true,
replaceNew: !notNew
}))
} else {
// Push new entity into store.
dispatch(receivedNewEntity({component: 'locationgroup', entity: savedEntity}))
Promise.resolve(savedEntity)
}
})
}
}

export function saveLocation (
feedId: ?string,
location: GtfsLocation,
Expand Down
Loading
Loading