forked from interline-io/transitland-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.graphqls
638 lines (567 loc) · 12.8 KB
/
schema.graphqls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
directive @hasRole(role: Role!) on FIELD_DEFINITION
enum Role {
ANON
ADMIN
USER
}
# Root query and mutation
type Query {
feed_versions(limit: Int, after: Int, ids: [Int!], where: FeedVersionFilter): [FeedVersion!]!
feeds(limit: Int, after: Int, ids: [Int!], where: FeedFilter): [Feed!]!
agencies(limit: Int, after: Int, ids: [Int!], where: AgencyFilter): [Agency!]!
routes(limit: Int, after: Int, ids: [Int!], where: RouteFilter): [Route!]!
stops(limit: Int, after: Int, ids: [Int!], where: StopFilter): [Stop!]!
trips(limit: Int, after: Int, ids: [Int!], where: TripFilter): [Trip!]!
operators(limit: Int, after: Int, ids: [Int!], where: OperatorFilter): [Operator!]!
}
type Mutation {
validate_gtfs(file: Upload, url: String, realtime_urls: [String!]): ValidationResult @hasRole(role: USER)
feed_version_update(id: Int!, set: FeedVersionSetInput!): FeedVersion @hasRole(role: ADMIN)
feed_version_fetch(file: Upload, url: String, feed_onestop_id: String!): FeedVersionFetchResult @hasRole(role: ADMIN)
feed_version_import(sha1: String!): FeedVersionImportResult! @hasRole(role: ADMIN)
feed_version_unimport(id: Int!): FeedVersionUnimportResult! @hasRole(role: ADMIN)
feed_version_delete(id: Int!): FeedVersionDeleteResult! @hasRole(role: ADMIN)
}
# Feed
type Feed {
id: Int!
onestop_id: String!
name: String
feed_namespace_id: String!
file: String!
spec: String!
languages: [String!]
associated_feeds: [String!]
tags: Tags
authorization: FeedAuthorization
urls: FeedUrls
license: FeedLicense
search_rank: String # only for search results
associated_operators: [Operator!]
feed_state: FeedState
feed_versions(limit: Int, where: FeedVersionFilter): [FeedVersion!]!
}
type FeedState {
id: Int!
last_fetch_error: String!
last_fetched_at: Time
last_successful_fetch_at: Time
feed_version: FeedVersion
}
type FeedAuthorization {
type: String!
param_name: String!
info_url: String!
}
type FeedLicense {
spdx_identifier: String!
url: String!
use_without_attribution: String!
create_derived_product: String!
redistribution_allowed: String!
commercial_use_allowed: String!
share_alike_optional: String!
attribution_text: String!
attribution_instructions: String!
}
type FeedUrls {
static_current: String!
static_historic: [String!]!
static_planned: String!
realtime_vehicle_positions: String!
realtime_trip_updates: String!
realtime_alerts: String!
}
# Feed Version
type FeedVersion {
id: Int!
sha1: String!
fetched_at: Time!
url: String!
earliest_calendar_date: Date!
latest_calendar_date: Date!
created_by: String
updated_by: String
name: String
description: String
geometry: Polygon
feed: Feed!
feed_version_gtfs_import: FeedVersionGtfsImport
files(limit: Int): [FeedVersionFileInfo!]!
service_levels(limit: Int, where: FeedVersionServiceLevelFilter): [FeedVersionServiceLevel!]!
agencies(limit: Int, where: AgencyFilter): [Agency!]!
routes(limit: Int, where: RouteFilter): [Route!]!
stops(limit: Int, where: StopFilter): [Stop!]!
trips(limit: Int, where: TripFilter): [Trip!]!
feed_infos(limit: Int): [FeedInfo!]!
}
type FeedVersionFileInfo {
id: Int!
name: String!
rows: Int!
sha1: String!
header: String!
csv_like: Boolean!
size: Int!
}
type FeedVersionGtfsImport {
id: Int!
in_progress: Boolean!
success: Boolean!
exception_log: String!
skip_entity_error_count: Any
entity_count: Any
warning_count: Any
created_at: Time
updated_at: Time
skip_entity_reference_count: Any
skip_entity_filter_count: Any
skip_entity_marked_count: Any
interpolated_stop_time_count: Int
}
type FeedVersionServiceLevel {
id: Int!
route_id: String
route_short_name: String!
route_long_name: String!
start_date: Date!
end_date: Date!
monday: Int!
tuesday: Int!
wednesday: Int!
thursday: Int!
friday: Int!
saturday: Int!
sunday: Int!
}
# Operator
type Operator {
id: Int!
generated: Boolean!
file: String
onestop_id: String
name: String
short_name: String
website: String
tags: Tags
associated_feeds: Any
search_rank: String # only for search results
agencies: [Agency!]
}
# GTFS Entities
type Agency {
id: Int!
onestop_id: String!
agency_email: String!
agency_fare_url: String!
agency_id: String!
agency_lang: String!
agency_name: String!
agency_phone: String!
agency_timezone: String!
agency_url: String!
feed_version_sha1: String
feed_onestop_id: String
feed_version: FeedVersion!
geometry: Polygon
search_rank: String # only for search results
operator: Operator
places(limit: Int, where: AgencyPlaceFilter): [AgencyPlace!]
routes(limit: Int, where: RouteFilter): [Route!]!
census_geographies(layer: String!, radius: Float, limit: Int): [CensusGeography!]
}
type Route {
id: Int!
onestop_id: String
route_id: String!
route_short_name: String!
route_long_name: String!
route_type: Int!
route_color: String!
route_text_color: String!
route_sort_order: Int!
route_url: String!
route_desc: String!
geometry: Geometry!
agency: Agency!
feed_version: FeedVersion!
feed_version_sha1: String!
feed_onestop_id: String!
search_rank: String # only for search results
trips(limit: Int, where: TripFilter): [Trip!]!
route_stops(limit: Int): [RouteStop!]!
headways(limit: Int): [RouteHeadway!]!
geometries(limit: Int): [RouteGeometry!]!
census_geographies(layer: String!, radius: Float, limit: Int): [CensusGeography!]
route_stop_buffer(radius: Float): RouteStopBuffer!
}
type Stop {
id: Int!
onestop_id: String!
location_type: Int!
stop_code: String!
stop_desc: String!
stop_id: String!
stop_name: String!
stop_timezone: String!
stop_url: String!
wheelchair_boarding: Int!
zone_id: String!
geometry: Point!
feed_version_sha1: String!
feed_onestop_id: String!
feed_version: FeedVersion!
level: Level
parent: Stop
children(limit: Int): [Stop!]
route_stops(limit: Int): [RouteStop!]!
pathways_from_stop(limit: Int): [Pathway!]!
pathways_to_stop(limit: Int): [Pathway!]!
stop_times(limit: Int, where: StopTimeFilter): [StopTime!]!
search_rank: String # only for search results
census_geographies(layer: String!, radius: Float, limit: Int): [CensusGeography!]
}
type Pathway {
id: Int!
pathway_id: String!
pathway_mode: Int!
is_bidirectional: Int!
length: Float!
traversal_time: Int!
stair_count: Int!
max_slope: Float!
min_width: Float!
signposted_as: String!
reverse_signposted_as: String!
from_stop: Stop!
to_stop: Stop!
}
type Level {
id: Int!
level_id: String!
level_name: String!
level_index: Float!
}
type Trip {
id: Int!
trip_id: String!
trip_headsign: String!
trip_short_name: String!
direction_id: Int!
block_id: String!
wheelchair_accessible: Int!
bikes_allowed: Int!
stop_pattern_id: Int!
calendar: Calendar!
route: Route!
shape: Shape
feed_version: FeedVersion!
stop_times(limit: Int): [StopTime]!
frequencies(limit: Int): [Frequency!]!
}
type Calendar {
id: Int!
service_id: String!
start_date: Date!
end_date: Date!
monday: Int!
tuesday: Int!
wednesday: Int!
thursday: Int!
friday: Int!
saturday: Int!
sunday: Int!
added_dates(limit: Int): [Date!]!
removed_dates(limit: Int): [Date!]!
}
type Shape {
id: Int!
shape_id: String!
geometry: LineString!
generated: Boolean!
}
type Frequency {
id: Int!
start_time: Seconds!
end_time: Seconds!
headway_secs: Int!
exact_times: Int!
}
type StopTime {
arrival_time: Int!
departure_time: Int!
stop_sequence: Int!
stop_headsign: String
pickup_type: Int
drop_off_type: Int
timepoint: Int
interpolated: Int
stop: Stop!
trip: Trip!
}
type FeedInfo {
id: Int!
feed_publisher_name: String!
feed_publisher_url: String!
feed_lang: String!
feed_version: String!
feed_start_date: Date
feed_end_date: Date
}
# GTFS Support Entities
type AgencyPlace {
city_name: String
adm1_name: String
adm0_name: String
rank: Float
}
type RouteStop {
id: Int!
stop_id: Int!
route_id: Int!
agency_id: Int!
route: Route!
stop: Stop!
agency: Agency!
}
type RouteGeometry {
direction_id: Int!
generated: Boolean!
geometry: LineString!
}
type RouteHeadway {
stop: Stop!
dow_category: Int
direction_id: Int
headway_secs: Int
service_date: Date
service_seconds: Int
stop_trip_count: Int
headway_seconds_morning_count: Int
headway_seconds_morning_min: Int
headway_seconds_morning_mid: Int
headway_seconds_morning_max: Int
headway_seconds_midday_count: Int
headway_seconds_midday_min: Int
headway_seconds_midday_mid: Int
headway_seconds_midday_max: Int
headway_seconds_afternoon_count: Int
headway_seconds_afternoon_min: Int
headway_seconds_afternoon_mid: Int
headway_seconds_afternoon_max: Int
headway_seconds_night_count: Int
headway_seconds_night_min: Int
headway_seconds_night_mid: Int
headway_seconds_night_max: Int
}
# Census entities
type CensusGeography {
id: Int!
layer_name: String!
geoid: String
name: String
aland: Float
awater: Float
geometry: Polygon
values(table_names: [String!]!, limit: Int): [CensusValue]!
# source: CensusSource!
}
type CensusValue {
table: CensusTable!
values: Any! # json blob
# geography: CensusGeography!
}
type CensusTable {
id: Int!
table_name: String!
table_title: String!
table_group: String!
# dataset: CensusDataset!
}
# type CensusDataset {
# id: Int!
# dataset_name: String!
# year_min: Int!
# year_max: Int!
# url: String!
# }
# type CensusField {
# id: Int!
# field_name: String!
# field_title: String!
# table: CensusTable!
# }
# type CensusSource {
# id: Int!
# source_name: String!
# url: String!
# sha1: String!
# dataset: CensusDataset!
# }
# Analysis tools
type RouteStopBuffer {
stop_points: Geometry
stop_buffer: Geometry
stop_convexhull: Polygon
}
# Validation tools
type ValidationResult {
# Validation output
success: Boolean!
failure_reason: String!
errors: [ValidationResultErrorGroup!]!
warnings: [ValidationResultErrorGroup!]!
# FeedVersion-like
sha1: String!
earliest_calendar_date: Date
latest_calendar_date: Date
files: [FeedVersionFileInfo!]!
service_levels(limit: Int, route_id: String): [FeedVersionServiceLevel!]!
agencies(limit: Int): [Agency!]!
routes(limit: Int): [Route!]!
stops(limit: Int): [Stop!]!
feed_infos(limit: Int): [FeedInfo!]!
}
type ValidationResultErrorGroup {
filename: String!
error_type: String!
count: Int!
limit: Int!
errors: [ValidationResultError!]!
}
type ValidationResultError {
filename: String!
error_type: String!
entity_id: String!
field: String!
value: String!
message: String!
}
type FeedVersionFetchResult {
feed_version: FeedVersion
fetch_error: String
found_sha1: Boolean!
found_dir_sha1: Boolean!
}
type FeedVersionImportResult {
success: Boolean!
}
type FeedVersionUnimportResult {
success: Boolean!
}
type FeedVersionDeleteResult {
success: Boolean!
}
# Update inputs
input FeedVersionSetInput {
name: String
description: String
}
# Query filters
input OperatorFilter {
merged: Boolean
onestop_id: String
feed_onestop_id: String
agency_id: String
search: String
tags: Tags
}
input FeedVersionFilter {
feed_onestop_id: String
sha1: String
feed_ids: [Int!] # keep?
}
enum ImportStatus {
success
error
in_progress
}
input FeedFilter {
onestop_id: String
spec: [String!]
fetch_error: Boolean
import_status: ImportStatus
search: String
tags: Tags
}
input AgencyFilter {
onestop_id: String
feed_version_sha1: String
feed_onestop_id: String
agency_id: String
agency_name: String
within: Polygon
near: PointRadius
search: String
}
input RouteFilter {
onestop_id: String
feed_version_sha1: String
feed_onestop_id: String
route_id: String
route_type: Int
within: Polygon
near: PointRadius
search: String
operator_onestop_id: String
agency_ids: [Int!] # keep?
}
input StopFilter {
onestop_id: String
feed_version_sha1: String
feed_onestop_id: String
stop_id: String
within: Polygon
near: PointRadius
search: String
served_by_onestop_ids: [String!]
agency_ids: [Int!] # keep?
}
input StopTimeFilter {
service_date: Date
start_time: Int
end_time: Int
}
input PathwayFilter {
pathway_mode: Int
}
input TripFilter {
service_date: Date
trip_id: String
route_ids: [Int!] # keep?
route_onestop_ids: [String!] # keep?
feed_version_sha1: String
feed_onestop_id: String
}
input FeedVersionServiceLevelFilter {
start_date: Date
end_date: Date
all_routes: Boolean
distinct_on: String
route_ids: [String!]
}
input AgencyPlaceFilter {
min_rank: Float
search: String
}
input CalendarDateFilter {
date: Date
exception_type: Int
}
input PointRadius {
lat: Float!
lon: Float!
radius: Float!
}
# Scalar types
scalar Tags
scalar Geometry
scalar Time
scalar Date
scalar Point
scalar LineString
scalar Seconds
scalar Polygon
scalar Map
scalar Any
scalar Upload