-
Notifications
You must be signed in to change notification settings - Fork 5
/
gtfs.kql
2847 lines (2518 loc) · 136 KB
/
gtfs.kql
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
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.create-merge table [_cloudevents_dispatch] (
[specversion]: string,
[type]: string,
[source]: string,
[id]: string,
[time]: datetime,
[subject]: string,
[datacontenttype]: string,
[dataschema]: string,
[data]: dynamic
);
.create-or-alter table [_cloudevents_dispatch] ingestion json mapping "_cloudevents_dispatch_json"
```
[
{"column": "specversion", "path": "$.specversion"},
{"column": "type", "path": "$.type"},
{"column": "source", "path": "$.source"},
{"column": "id", "path": "$.id"},
{"column": "time", "path": "$.time"},
{"column": "subject", "path": "$.subject"},
{"column": "datacontenttype", "path": "$.datacontenttype"},
{"column": "dataschema", "path": "$.dataschema"},
{"column": "data", "path": "$.data"}
]
```
.create-merge table [Agency] (
[agencyId]: string,
[agencyName]: string,
[agencyUrl]: string,
[agencyTimezone]: string,
[agencyLang]: string,
[agencyPhone]: string,
[agencyFareUrl]: string,
[agencyEmail]: string,
[___type]: string,
[___source]: string,
[___id]: string,
[___time]: datetime,
[___subject]: string
);
.alter table [Agency] docstring "{\"description\": \"Information about the transit agencies.\"}";
.alter table [Agency] column-docstrings (
[agencyId]: "{\"description\": \"Identifies a transit brand which is often synonymous with a transit agency.\"}",
[agencyName]: "{\"description\": \"Full name of the transit agency.\"}",
[agencyUrl]: "{\"description\": \"URL of the transit agency.\"}",
[agencyTimezone]: "{\"description\": \"Timezone where the transit agency is located.\"}",
[agencyLang]: "{\"description\": \"Primary language used by this transit agency.\", \"schema\": [\"null\", \"string\"]}",
[agencyPhone]: "{\"description\": \"A voice telephone number for the specified agency.\", \"schema\": [\"null\", \"string\"]}",
[agencyFareUrl]: "{\"description\": \"URL of a web page that allows a rider to purchase tickets or other fare instruments for that agency online.\", \"schema\": [\"null\", \"string\"]}",
[agencyEmail]: "{\"description\": \"Email address actively monitored by the agency\\u2019s customer service department.\", \"schema\": [\"null\", \"string\"]}",
[___type] : 'Event type',
[___source]: 'Context origin/source of the event',
[___id]: 'Event identifier',
[___time]: 'Event generation time',
[___subject]: 'Context subject of the event'
);
.create-or-alter table [Agency] ingestion json mapping "Agency_json_flat"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "agencyId", "path": "$.agencyId"},
{"column": "agencyName", "path": "$.agencyName"},
{"column": "agencyUrl", "path": "$.agencyUrl"},
{"column": "agencyTimezone", "path": "$.agencyTimezone"},
{"column": "agencyLang", "path": "$.agencyLang"},
{"column": "agencyPhone", "path": "$.agencyPhone"},
{"column": "agencyFareUrl", "path": "$.agencyFareUrl"},
{"column": "agencyEmail", "path": "$.agencyEmail"},
]
```
.create-or-alter table [Agency] ingestion json mapping "Agency_json_ce_structured"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "agencyId", "path": "$.data.agencyId"},
{"column": "agencyName", "path": "$.data.agencyName"},
{"column": "agencyUrl", "path": "$.data.agencyUrl"},
{"column": "agencyTimezone", "path": "$.data.agencyTimezone"},
{"column": "agencyLang", "path": "$.data.agencyLang"},
{"column": "agencyPhone", "path": "$.data.agencyPhone"},
{"column": "agencyFareUrl", "path": "$.data.agencyFareUrl"},
{"column": "agencyEmail", "path": "$.data.agencyEmail"},
]
```
.drop materialized-view AgencyLatest ifexists;
.create materialized-view with (backfill=true) AgencyLatest on table Agency {
Agency | summarize arg_max(___time, *) by ___type, ___source, ___subject
}
.alter table [Agency] policy update
```
[{
"IsEnabled": true,
"Source": "_cloudevents_dispatch",
"Query": "_cloudevents_dispatch | where (specversion == '1.0' and type == 'GeneralTransitFeedStatic.Agency') | project['agencyId'] = tostring(data.['agencyId']),['agencyName'] = tostring(data.['agencyName']),['agencyUrl'] = tostring(data.['agencyUrl']),['agencyTimezone'] = tostring(data.['agencyTimezone']),['agencyLang'] = tostring(data.['agencyLang']),['agencyPhone'] = tostring(data.['agencyPhone']),['agencyFareUrl'] = tostring(data.['agencyFareUrl']),['agencyEmail'] = tostring(data.['agencyEmail']),___type = type,___source = source,___id = ['id'],___time = ['time'],___subject = subject",
"IsTransactional": false,
"PropagateIngestionProperties": true,
}]
```
.create-merge table [Areas] (
[areaId]: string,
[areaName]: string,
[areaDesc]: string,
[areaUrl]: string,
[___type]: string,
[___source]: string,
[___id]: string,
[___time]: datetime,
[___subject]: string
);
.alter table [Areas] docstring "{\"description\": \"Defines areas.\"}";
.alter table [Areas] column-docstrings (
[areaId]: "{\"description\": \"Identifies an area.\"}",
[areaName]: "{\"description\": \"Name of the area.\"}",
[areaDesc]: "{\"description\": \"Description of the area.\", \"schema\": [\"null\", \"string\"]}",
[areaUrl]: "{\"description\": \"URL of a web page about the area.\", \"schema\": [\"null\", \"string\"]}",
[___type] : 'Event type',
[___source]: 'Context origin/source of the event',
[___id]: 'Event identifier',
[___time]: 'Event generation time',
[___subject]: 'Context subject of the event'
);
.create-or-alter table [Areas] ingestion json mapping "Areas_json_flat"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "areaId", "path": "$.areaId"},
{"column": "areaName", "path": "$.areaName"},
{"column": "areaDesc", "path": "$.areaDesc"},
{"column": "areaUrl", "path": "$.areaUrl"},
]
```
.create-or-alter table [Areas] ingestion json mapping "Areas_json_ce_structured"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "areaId", "path": "$.data.areaId"},
{"column": "areaName", "path": "$.data.areaName"},
{"column": "areaDesc", "path": "$.data.areaDesc"},
{"column": "areaUrl", "path": "$.data.areaUrl"},
]
```
.drop materialized-view AreasLatest ifexists;
.create materialized-view with (backfill=true) AreasLatest on table Areas {
Areas | summarize arg_max(___time, *) by ___type, ___source, ___subject
}
.alter table [Areas] policy update
```
[{
"IsEnabled": true,
"Source": "_cloudevents_dispatch",
"Query": "_cloudevents_dispatch | where (specversion == '1.0' and type == 'GeneralTransitFeedStatic.Areas') | project['areaId'] = tostring(data.['areaId']),['areaName'] = tostring(data.['areaName']),['areaDesc'] = tostring(data.['areaDesc']),['areaUrl'] = tostring(data.['areaUrl']),___type = type,___source = source,___id = ['id'],___time = ['time'],___subject = subject",
"IsTransactional": false,
"PropagateIngestionProperties": true,
}]
```
.create-merge table [Attributions] (
[attributionId]: string,
[agencyId]: string,
[routeId]: string,
[tripId]: string,
[organizationName]: string,
[isProducer]: int,
[isOperator]: int,
[isAuthority]: int,
[attributionUrl]: string,
[attributionEmail]: string,
[attributionPhone]: string,
[___type]: string,
[___source]: string,
[___id]: string,
[___time]: datetime,
[___subject]: string
);
.alter table [Attributions] docstring "{\"description\": \"Provides information about the attributions.\"}";
.alter table [Attributions] column-docstrings (
[attributionId]: "{\"description\": \"Identifies an attribution for the dataset.\", \"schema\": [\"null\", \"string\"]}",
[agencyId]: "{\"description\": \"Identifies the agency associated with the attribution.\", \"schema\": [\"null\", \"string\"]}",
[routeId]: "{\"description\": \"Identifies the route associated with the attribution.\", \"schema\": [\"null\", \"string\"]}",
[tripId]: "{\"description\": \"Identifies the trip associated with the attribution.\", \"schema\": [\"null\", \"string\"]}",
[organizationName]: "{\"description\": \"Name of the organization associated with the attribution.\"}",
[isProducer]: "{\"description\": \"Indicates if the organization is a producer.\", \"schema\": [\"null\", \"int\"]}",
[isOperator]: "{\"description\": \"Indicates if the organization is an operator.\", \"schema\": [\"null\", \"int\"]}",
[isAuthority]: "{\"description\": \"Indicates if the organization is an authority.\", \"schema\": [\"null\", \"int\"]}",
[attributionUrl]: "{\"description\": \"URL of a web page about the attribution.\", \"schema\": [\"null\", \"string\"]}",
[attributionEmail]: "{\"description\": \"Email address associated with the attribution.\", \"schema\": [\"null\", \"string\"]}",
[attributionPhone]: "{\"description\": \"Phone number associated with the attribution.\", \"schema\": [\"null\", \"string\"]}",
[___type] : 'Event type',
[___source]: 'Context origin/source of the event',
[___id]: 'Event identifier',
[___time]: 'Event generation time',
[___subject]: 'Context subject of the event'
);
.create-or-alter table [Attributions] ingestion json mapping "Attributions_json_flat"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "attributionId", "path": "$.attributionId"},
{"column": "agencyId", "path": "$.agencyId"},
{"column": "routeId", "path": "$.routeId"},
{"column": "tripId", "path": "$.tripId"},
{"column": "organizationName", "path": "$.organizationName"},
{"column": "isProducer", "path": "$.isProducer"},
{"column": "isOperator", "path": "$.isOperator"},
{"column": "isAuthority", "path": "$.isAuthority"},
{"column": "attributionUrl", "path": "$.attributionUrl"},
{"column": "attributionEmail", "path": "$.attributionEmail"},
{"column": "attributionPhone", "path": "$.attributionPhone"},
]
```
.create-or-alter table [Attributions] ingestion json mapping "Attributions_json_ce_structured"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "attributionId", "path": "$.data.attributionId"},
{"column": "agencyId", "path": "$.data.agencyId"},
{"column": "routeId", "path": "$.data.routeId"},
{"column": "tripId", "path": "$.data.tripId"},
{"column": "organizationName", "path": "$.data.organizationName"},
{"column": "isProducer", "path": "$.data.isProducer"},
{"column": "isOperator", "path": "$.data.isOperator"},
{"column": "isAuthority", "path": "$.data.isAuthority"},
{"column": "attributionUrl", "path": "$.data.attributionUrl"},
{"column": "attributionEmail", "path": "$.data.attributionEmail"},
{"column": "attributionPhone", "path": "$.data.attributionPhone"},
]
```
.drop materialized-view AttributionsLatest ifexists;
.create materialized-view with (backfill=true) AttributionsLatest on table Attributions {
Attributions | summarize arg_max(___time, *) by ___type, ___source, ___subject
}
.alter table [Attributions] policy update
```
[{
"IsEnabled": true,
"Source": "_cloudevents_dispatch",
"Query": "_cloudevents_dispatch | where (specversion == '1.0' and type == 'GeneralTransitFeedStatic.Attributions') | project['attributionId'] = tostring(data.['attributionId']),['agencyId'] = tostring(data.['agencyId']),['routeId'] = tostring(data.['routeId']),['tripId'] = tostring(data.['tripId']),['organizationName'] = tostring(data.['organizationName']),['isProducer'] = toint(data.['isProducer']),['isOperator'] = toint(data.['isOperator']),['isAuthority'] = toint(data.['isAuthority']),['attributionUrl'] = tostring(data.['attributionUrl']),['attributionEmail'] = tostring(data.['attributionEmail']),['attributionPhone'] = tostring(data.['attributionPhone']),___type = type,___source = source,___id = ['id'],___time = ['time'],___subject = subject",
"IsTransactional": false,
"PropagateIngestionProperties": true,
}]
```
.create-merge table [BookingRules] (
[bookingRuleId]: string,
[bookingRuleName]: string,
[bookingRuleDesc]: string,
[bookingRuleUrl]: string,
[___type]: string,
[___source]: string,
[___id]: string,
[___time]: datetime,
[___subject]: string
);
.alter table [BookingRules] docstring "{\"description\": \"Defines booking rules.\"}";
.alter table [BookingRules] column-docstrings (
[bookingRuleId]: "{\"description\": \"Identifies a booking rule.\"}",
[bookingRuleName]: "{\"description\": \"Name of the booking rule.\"}",
[bookingRuleDesc]: "{\"description\": \"Description of the booking rule.\", \"schema\": [\"null\", \"string\"]}",
[bookingRuleUrl]: "{\"description\": \"URL of a web page about the booking rule.\", \"schema\": [\"null\", \"string\"]}",
[___type] : 'Event type',
[___source]: 'Context origin/source of the event',
[___id]: 'Event identifier',
[___time]: 'Event generation time',
[___subject]: 'Context subject of the event'
);
.create-or-alter table [BookingRules] ingestion json mapping "BookingRules_json_flat"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "bookingRuleId", "path": "$.bookingRuleId"},
{"column": "bookingRuleName", "path": "$.bookingRuleName"},
{"column": "bookingRuleDesc", "path": "$.bookingRuleDesc"},
{"column": "bookingRuleUrl", "path": "$.bookingRuleUrl"},
]
```
.create-or-alter table [BookingRules] ingestion json mapping "BookingRules_json_ce_structured"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "bookingRuleId", "path": "$.data.bookingRuleId"},
{"column": "bookingRuleName", "path": "$.data.bookingRuleName"},
{"column": "bookingRuleDesc", "path": "$.data.bookingRuleDesc"},
{"column": "bookingRuleUrl", "path": "$.data.bookingRuleUrl"},
]
```
.drop materialized-view BookingRulesLatest ifexists;
.create materialized-view with (backfill=true) BookingRulesLatest on table BookingRules {
BookingRules | summarize arg_max(___time, *) by ___type, ___source, ___subject
}
.alter table [BookingRules] policy update
```
[{
"IsEnabled": true,
"Source": "_cloudevents_dispatch",
"Query": "_cloudevents_dispatch | where (specversion == '1.0' and type == 'GeneralTransitFeedStatic.BookingRules') | project['bookingRuleId'] = tostring(data.['bookingRuleId']),['bookingRuleName'] = tostring(data.['bookingRuleName']),['bookingRuleDesc'] = tostring(data.['bookingRuleDesc']),['bookingRuleUrl'] = tostring(data.['bookingRuleUrl']),___type = type,___source = source,___id = ['id'],___time = ['time'],___subject = subject",
"IsTransactional": false,
"PropagateIngestionProperties": true,
}]
```
.create-merge table [FareAttributes] (
[fareId]: string,
[price]: real,
[currencyType]: string,
[paymentMethod]: int,
[transfers]: int,
[agencyId]: string,
[transferDuration]: long,
[___type]: string,
[___source]: string,
[___id]: string,
[___time]: datetime,
[___subject]: string
);
.alter table [FareAttributes] docstring "{\"description\": \"Defines fare attributes.\"}";
.alter table [FareAttributes] column-docstrings (
[fareId]: "{\"description\": \"Identifies a fare class.\"}",
[price]: "{\"description\": \"Fare price, in the unit specified by currency_type.\"}",
[currencyType]: "{\"description\": \"Currency type used to pay the fare.\"}",
[paymentMethod]: "{\"description\": \"When 0, fare must be paid on board. When 1, fare must be paid before boarding.\"}",
[transfers]: "{\"description\": \"Specifies the number of transfers permitted on this fare.\", \"schema\": [\"null\", \"int\"]}",
[agencyId]: "{\"description\": \"Identifies the agency for the specified fare.\", \"schema\": [\"null\", \"string\"]}",
[transferDuration]: "{\"description\": \"Length of time in seconds before a transfer expires.\", \"schema\": [\"null\", \"long\"]}",
[___type] : 'Event type',
[___source]: 'Context origin/source of the event',
[___id]: 'Event identifier',
[___time]: 'Event generation time',
[___subject]: 'Context subject of the event'
);
.create-or-alter table [FareAttributes] ingestion json mapping "FareAttributes_json_flat"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "fareId", "path": "$.fareId"},
{"column": "price", "path": "$.price"},
{"column": "currencyType", "path": "$.currencyType"},
{"column": "paymentMethod", "path": "$.paymentMethod"},
{"column": "transfers", "path": "$.transfers"},
{"column": "agencyId", "path": "$.agencyId"},
{"column": "transferDuration", "path": "$.transferDuration"},
]
```
.create-or-alter table [FareAttributes] ingestion json mapping "FareAttributes_json_ce_structured"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "fareId", "path": "$.data.fareId"},
{"column": "price", "path": "$.data.price"},
{"column": "currencyType", "path": "$.data.currencyType"},
{"column": "paymentMethod", "path": "$.data.paymentMethod"},
{"column": "transfers", "path": "$.data.transfers"},
{"column": "agencyId", "path": "$.data.agencyId"},
{"column": "transferDuration", "path": "$.data.transferDuration"},
]
```
.drop materialized-view FareAttributesLatest ifexists;
.create materialized-view with (backfill=true) FareAttributesLatest on table FareAttributes {
FareAttributes | summarize arg_max(___time, *) by ___type, ___source, ___subject
}
.alter table [FareAttributes] policy update
```
[{
"IsEnabled": true,
"Source": "_cloudevents_dispatch",
"Query": "_cloudevents_dispatch | where (specversion == '1.0' and type == 'GeneralTransitFeedStatic.FareAttributes') | project['fareId'] = tostring(data.['fareId']),['price'] = toreal(data.['price']),['currencyType'] = tostring(data.['currencyType']),['paymentMethod'] = toint(data.['paymentMethod']),['transfers'] = toint(data.['transfers']),['agencyId'] = tostring(data.['agencyId']),['transferDuration'] = tolong(data.['transferDuration']),___type = type,___source = source,___id = ['id'],___time = ['time'],___subject = subject",
"IsTransactional": false,
"PropagateIngestionProperties": true,
}]
```
.create-merge table [FareLegRules] (
[fareLegRuleId]: string,
[fareProductId]: string,
[legGroupId]: string,
[networkId]: string,
[fromAreaId]: string,
[toAreaId]: string,
[___type]: string,
[___source]: string,
[___id]: string,
[___time]: datetime,
[___subject]: string
);
.alter table [FareLegRules] docstring "{\"description\": \"Defines fare leg rules.\"}";
.alter table [FareLegRules] column-docstrings (
[fareLegRuleId]: "{\"description\": \"Identifies a fare leg rule.\"}",
[fareProductId]: "{\"description\": \"Identifies a fare product.\"}",
[legGroupId]: "{\"description\": \"Identifies a group of legs.\", \"schema\": [\"null\", \"string\"]}",
[networkId]: "{\"description\": \"Identifies a network.\", \"schema\": [\"null\", \"string\"]}",
[fromAreaId]: "{\"description\": \"Identifies the origin area.\", \"schema\": [\"null\", \"string\"]}",
[toAreaId]: "{\"description\": \"Identifies the destination area.\", \"schema\": [\"null\", \"string\"]}",
[___type] : 'Event type',
[___source]: 'Context origin/source of the event',
[___id]: 'Event identifier',
[___time]: 'Event generation time',
[___subject]: 'Context subject of the event'
);
.create-or-alter table [FareLegRules] ingestion json mapping "FareLegRules_json_flat"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "fareLegRuleId", "path": "$.fareLegRuleId"},
{"column": "fareProductId", "path": "$.fareProductId"},
{"column": "legGroupId", "path": "$.legGroupId"},
{"column": "networkId", "path": "$.networkId"},
{"column": "fromAreaId", "path": "$.fromAreaId"},
{"column": "toAreaId", "path": "$.toAreaId"},
]
```
.create-or-alter table [FareLegRules] ingestion json mapping "FareLegRules_json_ce_structured"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "fareLegRuleId", "path": "$.data.fareLegRuleId"},
{"column": "fareProductId", "path": "$.data.fareProductId"},
{"column": "legGroupId", "path": "$.data.legGroupId"},
{"column": "networkId", "path": "$.data.networkId"},
{"column": "fromAreaId", "path": "$.data.fromAreaId"},
{"column": "toAreaId", "path": "$.data.toAreaId"},
]
```
.drop materialized-view FareLegRulesLatest ifexists;
.create materialized-view with (backfill=true) FareLegRulesLatest on table FareLegRules {
FareLegRules | summarize arg_max(___time, *) by ___type, ___source, ___subject
}
.alter table [FareLegRules] policy update
```
[{
"IsEnabled": true,
"Source": "_cloudevents_dispatch",
"Query": "_cloudevents_dispatch | where (specversion == '1.0' and type == 'GeneralTransitFeedStatic.FareLegRules') | project['fareLegRuleId'] = tostring(data.['fareLegRuleId']),['fareProductId'] = tostring(data.['fareProductId']),['legGroupId'] = tostring(data.['legGroupId']),['networkId'] = tostring(data.['networkId']),['fromAreaId'] = tostring(data.['fromAreaId']),['toAreaId'] = tostring(data.['toAreaId']),___type = type,___source = source,___id = ['id'],___time = ['time'],___subject = subject",
"IsTransactional": false,
"PropagateIngestionProperties": true,
}]
```
.create-merge table [FareMedia] (
[fareMediaId]: string,
[fareMediaName]: string,
[fareMediaDesc]: string,
[fareMediaUrl]: string,
[___type]: string,
[___source]: string,
[___id]: string,
[___time]: datetime,
[___subject]: string
);
.alter table [FareMedia] docstring "{\"description\": \"Defines fare media.\"}";
.alter table [FareMedia] column-docstrings (
[fareMediaId]: "{\"description\": \"Identifies a fare media.\"}",
[fareMediaName]: "{\"description\": \"Name of the fare media.\"}",
[fareMediaDesc]: "{\"description\": \"Description of the fare media.\", \"schema\": [\"null\", \"string\"]}",
[fareMediaUrl]: "{\"description\": \"URL of a web page about the fare media.\", \"schema\": [\"null\", \"string\"]}",
[___type] : 'Event type',
[___source]: 'Context origin/source of the event',
[___id]: 'Event identifier',
[___time]: 'Event generation time',
[___subject]: 'Context subject of the event'
);
.create-or-alter table [FareMedia] ingestion json mapping "FareMedia_json_flat"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "fareMediaId", "path": "$.fareMediaId"},
{"column": "fareMediaName", "path": "$.fareMediaName"},
{"column": "fareMediaDesc", "path": "$.fareMediaDesc"},
{"column": "fareMediaUrl", "path": "$.fareMediaUrl"},
]
```
.create-or-alter table [FareMedia] ingestion json mapping "FareMedia_json_ce_structured"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "fareMediaId", "path": "$.data.fareMediaId"},
{"column": "fareMediaName", "path": "$.data.fareMediaName"},
{"column": "fareMediaDesc", "path": "$.data.fareMediaDesc"},
{"column": "fareMediaUrl", "path": "$.data.fareMediaUrl"},
]
```
.drop materialized-view FareMediaLatest ifexists;
.create materialized-view with (backfill=true) FareMediaLatest on table FareMedia {
FareMedia | summarize arg_max(___time, *) by ___type, ___source, ___subject
}
.alter table [FareMedia] policy update
```
[{
"IsEnabled": true,
"Source": "_cloudevents_dispatch",
"Query": "_cloudevents_dispatch | where (specversion == '1.0' and type == 'GeneralTransitFeedStatic.FareMedia') | project['fareMediaId'] = tostring(data.['fareMediaId']),['fareMediaName'] = tostring(data.['fareMediaName']),['fareMediaDesc'] = tostring(data.['fareMediaDesc']),['fareMediaUrl'] = tostring(data.['fareMediaUrl']),___type = type,___source = source,___id = ['id'],___time = ['time'],___subject = subject",
"IsTransactional": false,
"PropagateIngestionProperties": true,
}]
```
.create-merge table [FareProducts] (
[fareProductId]: string,
[fareProductName]: string,
[fareProductDesc]: string,
[fareProductUrl]: string,
[___type]: string,
[___source]: string,
[___id]: string,
[___time]: datetime,
[___subject]: string
);
.alter table [FareProducts] docstring "{\"description\": \"Defines fare products.\"}";
.alter table [FareProducts] column-docstrings (
[fareProductId]: "{\"description\": \"Identifies a fare product.\"}",
[fareProductName]: "{\"description\": \"Name of the fare product.\"}",
[fareProductDesc]: "{\"description\": \"Description of the fare product.\", \"schema\": [\"null\", \"string\"]}",
[fareProductUrl]: "{\"description\": \"URL of a web page about the fare product.\", \"schema\": [\"null\", \"string\"]}",
[___type] : 'Event type',
[___source]: 'Context origin/source of the event',
[___id]: 'Event identifier',
[___time]: 'Event generation time',
[___subject]: 'Context subject of the event'
);
.create-or-alter table [FareProducts] ingestion json mapping "FareProducts_json_flat"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "fareProductId", "path": "$.fareProductId"},
{"column": "fareProductName", "path": "$.fareProductName"},
{"column": "fareProductDesc", "path": "$.fareProductDesc"},
{"column": "fareProductUrl", "path": "$.fareProductUrl"},
]
```
.create-or-alter table [FareProducts] ingestion json mapping "FareProducts_json_ce_structured"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "fareProductId", "path": "$.data.fareProductId"},
{"column": "fareProductName", "path": "$.data.fareProductName"},
{"column": "fareProductDesc", "path": "$.data.fareProductDesc"},
{"column": "fareProductUrl", "path": "$.data.fareProductUrl"},
]
```
.drop materialized-view FareProductsLatest ifexists;
.create materialized-view with (backfill=true) FareProductsLatest on table FareProducts {
FareProducts | summarize arg_max(___time, *) by ___type, ___source, ___subject
}
.alter table [FareProducts] policy update
```
[{
"IsEnabled": true,
"Source": "_cloudevents_dispatch",
"Query": "_cloudevents_dispatch | where (specversion == '1.0' and type == 'GeneralTransitFeedStatic.FareProducts') | project['fareProductId'] = tostring(data.['fareProductId']),['fareProductName'] = tostring(data.['fareProductName']),['fareProductDesc'] = tostring(data.['fareProductDesc']),['fareProductUrl'] = tostring(data.['fareProductUrl']),___type = type,___source = source,___id = ['id'],___time = ['time'],___subject = subject",
"IsTransactional": false,
"PropagateIngestionProperties": true,
}]
```
.create-merge table [FareRules] (
[fareId]: string,
[routeId]: string,
[originId]: string,
[destinationId]: string,
[containsId]: string,
[___type]: string,
[___source]: string,
[___id]: string,
[___time]: datetime,
[___subject]: string
);
.alter table [FareRules] docstring "{\"description\": \"Defines fare rules.\"}";
.alter table [FareRules] column-docstrings (
[fareId]: "{\"description\": \"Identifies a fare class.\"}",
[routeId]: "{\"description\": \"Identifies a route associated with the fare.\", \"schema\": [\"null\", \"string\"]}",
[originId]: "{\"description\": \"Identifies the fare zone of the origin.\", \"schema\": [\"null\", \"string\"]}",
[destinationId]: "{\"description\": \"Identifies the fare zone of the destination.\", \"schema\": [\"null\", \"string\"]}",
[containsId]: "{\"description\": \"Identifies the fare zone that a rider will enter or leave.\", \"schema\": [\"null\", \"string\"]}",
[___type] : 'Event type',
[___source]: 'Context origin/source of the event',
[___id]: 'Event identifier',
[___time]: 'Event generation time',
[___subject]: 'Context subject of the event'
);
.create-or-alter table [FareRules] ingestion json mapping "FareRules_json_flat"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "fareId", "path": "$.fareId"},
{"column": "routeId", "path": "$.routeId"},
{"column": "originId", "path": "$.originId"},
{"column": "destinationId", "path": "$.destinationId"},
{"column": "containsId", "path": "$.containsId"},
]
```
.create-or-alter table [FareRules] ingestion json mapping "FareRules_json_ce_structured"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "fareId", "path": "$.data.fareId"},
{"column": "routeId", "path": "$.data.routeId"},
{"column": "originId", "path": "$.data.originId"},
{"column": "destinationId", "path": "$.data.destinationId"},
{"column": "containsId", "path": "$.data.containsId"},
]
```
.drop materialized-view FareRulesLatest ifexists;
.create materialized-view with (backfill=true) FareRulesLatest on table FareRules {
FareRules | summarize arg_max(___time, *) by ___type, ___source, ___subject
}
.alter table [FareRules] policy update
```
[{
"IsEnabled": true,
"Source": "_cloudevents_dispatch",
"Query": "_cloudevents_dispatch | where (specversion == '1.0' and type == 'GeneralTransitFeedStatic.FareRules') | project['fareId'] = tostring(data.['fareId']),['routeId'] = tostring(data.['routeId']),['originId'] = tostring(data.['originId']),['destinationId'] = tostring(data.['destinationId']),['containsId'] = tostring(data.['containsId']),___type = type,___source = source,___id = ['id'],___time = ['time'],___subject = subject",
"IsTransactional": false,
"PropagateIngestionProperties": true,
}]
```
.create-merge table [FareTransferRules] (
[fareTransferRuleId]: string,
[fareProductId]: string,
[transferCount]: int,
[fromLegGroupId]: string,
[toLegGroupId]: string,
[duration]: long,
[durationType]: string,
[___type]: string,
[___source]: string,
[___id]: string,
[___time]: datetime,
[___subject]: string
);
.alter table [FareTransferRules] docstring "{\"description\": \"Defines fare transfer rules.\"}";
.alter table [FareTransferRules] column-docstrings (
[fareTransferRuleId]: "{\"description\": \"Identifies a fare transfer rule.\"}",
[fareProductId]: "{\"description\": \"Identifies a fare product.\"}",
[transferCount]: "{\"description\": \"Number of transfers permitted.\", \"schema\": [\"null\", \"int\"]}",
[fromLegGroupId]: "{\"description\": \"Identifies the leg group from which the transfer starts.\", \"schema\": [\"null\", \"string\"]}",
[toLegGroupId]: "{\"description\": \"Identifies the leg group to which the transfer applies.\", \"schema\": [\"null\", \"string\"]}",
[duration]: "{\"description\": \"Length of time in seconds before a transfer expires.\", \"schema\": [\"null\", \"long\"]}",
[durationType]: "{\"description\": \"Type of duration for the transfer.\", \"schema\": [\"null\", \"string\"]}",
[___type] : 'Event type',
[___source]: 'Context origin/source of the event',
[___id]: 'Event identifier',
[___time]: 'Event generation time',
[___subject]: 'Context subject of the event'
);
.create-or-alter table [FareTransferRules] ingestion json mapping "FareTransferRules_json_flat"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "fareTransferRuleId", "path": "$.fareTransferRuleId"},
{"column": "fareProductId", "path": "$.fareProductId"},
{"column": "transferCount", "path": "$.transferCount"},
{"column": "fromLegGroupId", "path": "$.fromLegGroupId"},
{"column": "toLegGroupId", "path": "$.toLegGroupId"},
{"column": "duration", "path": "$.duration"},
{"column": "durationType", "path": "$.durationType"},
]
```
.create-or-alter table [FareTransferRules] ingestion json mapping "FareTransferRules_json_ce_structured"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "fareTransferRuleId", "path": "$.data.fareTransferRuleId"},
{"column": "fareProductId", "path": "$.data.fareProductId"},
{"column": "transferCount", "path": "$.data.transferCount"},
{"column": "fromLegGroupId", "path": "$.data.fromLegGroupId"},
{"column": "toLegGroupId", "path": "$.data.toLegGroupId"},
{"column": "duration", "path": "$.data.duration"},
{"column": "durationType", "path": "$.data.durationType"},
]
```
.drop materialized-view FareTransferRulesLatest ifexists;
.create materialized-view with (backfill=true) FareTransferRulesLatest on table FareTransferRules {
FareTransferRules | summarize arg_max(___time, *) by ___type, ___source, ___subject
}
.alter table [FareTransferRules] policy update
```
[{
"IsEnabled": true,
"Source": "_cloudevents_dispatch",
"Query": "_cloudevents_dispatch | where (specversion == '1.0' and type == 'GeneralTransitFeedStatic.FareTransferRules') | project['fareTransferRuleId'] = tostring(data.['fareTransferRuleId']),['fareProductId'] = tostring(data.['fareProductId']),['transferCount'] = toint(data.['transferCount']),['fromLegGroupId'] = tostring(data.['fromLegGroupId']),['toLegGroupId'] = tostring(data.['toLegGroupId']),['duration'] = tolong(data.['duration']),['durationType'] = tostring(data.['durationType']),___type = type,___source = source,___id = ['id'],___time = ['time'],___subject = subject",
"IsTransactional": false,
"PropagateIngestionProperties": true,
}]
```
.create-merge table [FeedInfo] (
[feedPublisherName]: string,
[feedPublisherUrl]: string,
[feedLang]: string,
[defaultLang]: string,
[feedStartDate]: string,
[feedEndDate]: string,
[feedVersion]: string,
[feedContactEmail]: string,
[feedContactUrl]: string,
[___type]: string,
[___source]: string,
[___id]: string,
[___time]: datetime,
[___subject]: string
);
.alter table [FeedInfo] docstring "{\"description\": \"Provides information about the GTFS feed itself.\"}";
.alter table [FeedInfo] column-docstrings (
[feedPublisherName]: "{\"description\": \"Full name of the organization that publishes the feed.\"}",
[feedPublisherUrl]: "{\"description\": \"URL of the feed publishing organization's website.\"}",
[feedLang]: "{\"description\": \"Default language for the text in this feed.\"}",
[defaultLang]: "{\"description\": \"Specifies the language used when the data consumer doesn\\u2019t know the language of the user.\", \"schema\": [\"null\", \"string\"]}",
[feedStartDate]: "{\"description\": \"The start date for the dataset.\", \"schema\": [\"null\", \"string\"]}",
[feedEndDate]: "{\"description\": \"The end date for the dataset.\", \"schema\": [\"null\", \"string\"]}",
[feedVersion]: "{\"description\": \"Version string that indicates the current version of their GTFS dataset.\", \"schema\": [\"null\", \"string\"]}",
[feedContactEmail]: "{\"description\": \"Email address for communication with the data publisher.\", \"schema\": [\"null\", \"string\"]}",
[feedContactUrl]: "{\"description\": \"URL for a web page that allows a feed consumer to contact the data publisher.\", \"schema\": [\"null\", \"string\"]}",
[___type] : 'Event type',
[___source]: 'Context origin/source of the event',
[___id]: 'Event identifier',
[___time]: 'Event generation time',
[___subject]: 'Context subject of the event'
);
.create-or-alter table [FeedInfo] ingestion json mapping "FeedInfo_json_flat"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "feedPublisherName", "path": "$.feedPublisherName"},
{"column": "feedPublisherUrl", "path": "$.feedPublisherUrl"},
{"column": "feedLang", "path": "$.feedLang"},
{"column": "defaultLang", "path": "$.defaultLang"},
{"column": "feedStartDate", "path": "$.feedStartDate"},
{"column": "feedEndDate", "path": "$.feedEndDate"},
{"column": "feedVersion", "path": "$.feedVersion"},
{"column": "feedContactEmail", "path": "$.feedContactEmail"},
{"column": "feedContactUrl", "path": "$.feedContactUrl"},
]
```
.create-or-alter table [FeedInfo] ingestion json mapping "FeedInfo_json_ce_structured"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "feedPublisherName", "path": "$.data.feedPublisherName"},
{"column": "feedPublisherUrl", "path": "$.data.feedPublisherUrl"},
{"column": "feedLang", "path": "$.data.feedLang"},
{"column": "defaultLang", "path": "$.data.defaultLang"},
{"column": "feedStartDate", "path": "$.data.feedStartDate"},
{"column": "feedEndDate", "path": "$.data.feedEndDate"},
{"column": "feedVersion", "path": "$.data.feedVersion"},
{"column": "feedContactEmail", "path": "$.data.feedContactEmail"},
{"column": "feedContactUrl", "path": "$.data.feedContactUrl"},
]
```
.drop materialized-view FeedInfoLatest ifexists;
.create materialized-view with (backfill=true) FeedInfoLatest on table FeedInfo {
FeedInfo | summarize arg_max(___time, *) by ___type, ___source, ___subject
}
.alter table [FeedInfo] policy update
```
[{
"IsEnabled": true,
"Source": "_cloudevents_dispatch",
"Query": "_cloudevents_dispatch | where (specversion == '1.0' and type == 'GeneralTransitFeedStatic.FeedInfo') | project['feedPublisherName'] = tostring(data.['feedPublisherName']),['feedPublisherUrl'] = tostring(data.['feedPublisherUrl']),['feedLang'] = tostring(data.['feedLang']),['defaultLang'] = tostring(data.['defaultLang']),['feedStartDate'] = tostring(data.['feedStartDate']),['feedEndDate'] = tostring(data.['feedEndDate']),['feedVersion'] = tostring(data.['feedVersion']),['feedContactEmail'] = tostring(data.['feedContactEmail']),['feedContactUrl'] = tostring(data.['feedContactUrl']),___type = type,___source = source,___id = ['id'],___time = ['time'],___subject = subject",
"IsTransactional": false,
"PropagateIngestionProperties": true,
}]
```
.create-merge table [Frequencies] (
[tripId]: string,
[startTime]: string,
[endTime]: string,
[headwaySecs]: int,
[exactTimes]: int,
[___type]: string,
[___source]: string,
[___id]: string,
[___time]: datetime,
[___subject]: string
);
.alter table [Frequencies] docstring "{\"description\": \"Defines frequencies.\"}";
.alter table [Frequencies] column-docstrings (
[tripId]: "{\"description\": \"Identifies a trip.\"}",
[startTime]: "{\"description\": \"Time at which service begins with the specified frequency.\"}",
[endTime]: "{\"description\": \"Time at which service ends with the specified frequency.\"}",
[headwaySecs]: "{\"description\": \"Time between departures from the same stop (headway) for this trip, in seconds.\"}",
[exactTimes]: "{\"description\": \"When 1, frequency-based trips should be exactly scheduled. When 0 (or empty), frequency-based trips are not exactly scheduled.\", \"schema\": [\"null\", \"int\"]}",
[___type] : 'Event type',
[___source]: 'Context origin/source of the event',
[___id]: 'Event identifier',
[___time]: 'Event generation time',
[___subject]: 'Context subject of the event'
);
.create-or-alter table [Frequencies] ingestion json mapping "Frequencies_json_flat"
```
[
{"column": "___type", "path": "$.type"},
{"column": "___source", "path": "$.source"},
{"column": "___id", "path": "$.id"},
{"column": "___time", "path": "$.time"},
{"column": "___subject", "path": "$.subject"},
{"column": "tripId", "path": "$.tripId"},
{"column": "startTime", "path": "$.startTime"},
{"column": "endTime", "path": "$.endTime"},
{"column": "headwaySecs", "path": "$.headwaySecs"},
{"column": "exactTimes", "path": "$.exactTimes"},
]
```
.create-or-alter table [Frequencies] ingestion json mapping "Frequencies_json_ce_structured"