BinghamtonBetterBus-v2/src/server/GET_routes.json
Levi Lesches d0387c7aa2
Working "find a path" code (#13)
The client first requests stops from the TS server (`0.0.0.0:80`), then the path from the Dart server (`localhost:8001`). It will be trivial to move the TS logic to the Dart server since the Dart server is the one that parsed all that data, and it's anyway in a `JSON` file. 

There is a `server/GET_ROUTES.json` file, but it's not needed. I just included it for easier debugging. `server/GET_STOPS.json` includes both the stops and the routes, and the client does some (inefficient) work to re-organize it.

The Dart server uses a basic A* implementation to sort find direct routes and routes with transfers. The A* logic is in `src/shared/lib/src/graph/graph.dart`. This file defines the state itself, and `package:a_star` on Pub.dev (mine) defines the algorithm. `src/shared/bin/path.dart` is the whole of the Dart server. 

TODO: 
- add unit tests
- this PR breaks almost nothing, so there is duplicate work being done on the client and some unused logic
- return a structured path object for the client to use as it wants. This PR just sends a well-formatted string
2025-05-02 19:55:59 -04:00

1454 lines
No EOL
20 KiB
JSON

[
{
"id": "BCT_3",
"provider": "BCT",
"full_name": "3) Park Ave",
"short_name": "3",
"stops": [
"302",
"304",
"306",
"504",
"506",
"508",
"510",
"512",
"514",
"516",
"308",
"310",
"312",
"314",
"316",
"318",
"320",
"322",
"324",
"326",
"328",
"301",
"303",
"305",
"307",
"309",
"311",
"313",
"315",
"317",
"319",
"321",
"323",
"535",
"325.1",
"325.2",
"329",
"331",
"553",
"1.1",
"22",
"1"
]
},
{
"id": "BCT_5",
"provider": "BCT",
"full_name": "5) Vestal Ave",
"short_name": "5",
"stops": [
"500",
"502",
"504",
"506",
"508",
"510",
"512",
"514",
"516",
"518",
"520",
"522",
"524",
"526",
"528",
"530",
"532",
"534",
"536",
"538",
"540",
"542",
"544",
"546",
"548",
"550",
"552",
"554",
"556",
"558",
"560",
"562",
"6000"
]
},
{
"id": "BCT_7",
"provider": "BCT",
"full_name": "7) Clinton St",
"short_name": "7",
"stops": [
"702",
"3502",
"806",
"808",
"704",
"706",
"708",
"710",
"712",
"714",
"716",
"718",
"720",
"722",
"724",
"726",
"728",
"730",
"732",
"734",
"736",
"738",
"740",
"742",
"744",
"746",
"748",
"750",
"752",
"754",
"756",
"758",
"760",
"762",
"764",
"766",
"768",
"770",
"772",
"774",
"776",
"778",
"780",
"782",
"784",
"786",
"788",
"790",
"792",
"794",
"3562.2"
]
},
{
"id": "BCT_8",
"provider": "BCT",
"full_name": "8) Front St",
"short_name": "8",
"stops": [
"802",
"3502",
"806",
"808",
"810",
"812",
"814",
"818",
"8001",
"822",
"824",
"826",
"826.1",
"828",
"830",
"832",
"834",
"836",
"838",
"838.1",
"840",
"842",
"844",
"846",
"848",
"850",
"852",
"854",
"4064",
"4066",
"4068",
"4070",
"4072",
"4074",
"4076",
"4078",
"4080",
"4082",
"4084",
"4086",
"801"
]
},
{
"id": "BCT_12",
"provider": "BCT",
"full_name": "12) Conkin Av",
"short_name": "12",
"stops": [
"1201",
"1203",
"1205",
"1207",
"1209",
"1211",
"1213",
"1215",
"1217",
"1219",
"1221",
"1223",
"1225",
"1227",
"1229",
"1231",
"1233",
"22",
"1"
]
},
{
"id": "BCT_15",
"provider": "BCT",
"full_name": "15) Leroy St",
"short_name": "15",
"stops": [
"1500",
"1502",
"3504",
"1508",
"1510",
"1512",
"1514",
"1516",
"1518",
"1520",
"1522",
"1524",
"1526",
"1528",
"1530",
"1532",
"1534",
"1536",
"1538",
"1540",
"1542",
"1544",
"1546",
"1548",
"1550",
"1552",
"1554",
"1554a",
"1554b",
"1554c",
"1556",
"1558",
"1560",
"1562",
"1564",
"1566",
"6003",
"6002",
"6000"
]
},
{
"id": "BCT_16",
"provider": "BCT",
"full_name": "16) BU Express",
"short_name": "16",
"stops": [
"3504",
"3508",
"3510",
"3512",
"3514",
"3516",
"3518",
"3520",
"3522",
"3524",
"3526",
"1711",
"1713",
"1715",
"1717",
"1552",
"1554",
"1556",
"1558",
"1560",
"6011",
"3502",
"3504"
]
},
{
"id": "BCT_17",
"provider": "BCT",
"full_name": "17) Johnson City",
"short_name": "17",
"stops": [
"748",
"750",
"752",
"754",
"756",
"758",
"760",
"762",
"764",
"766",
"768",
"772",
"776",
"1701",
"1703",
"1705",
"1707",
"3619",
"3621",
"1711",
"1713",
"1715",
"1717",
"1552",
"1554",
"1556",
"1558",
"1560",
"1562",
"4706",
"4708",
"4710",
"4712",
"4714",
"4716",
"1566",
"6003",
"6011"
]
},
{
"id": "BCT_28",
"provider": "BCT",
"full_name": "28) Robinson St",
"short_name": "28",
"stops": [
"2802",
"2804",
"2806",
"2808",
"2810",
"2812",
"2814",
"2816",
"2818",
"2820",
"2822",
"2824",
"2826",
"2828",
"2830",
"2832",
"2834",
"2836",
"2838",
"2844",
"2846",
"2848",
"2850",
"2852",
"2854",
"2856",
"2858",
"2860",
"2862",
"2864",
"2866",
"2868",
"2801",
"2803",
"2805",
"2807",
"2809",
"2811",
"2813",
"2815",
"2817",
"2819",
"2821",
"2823",
"2825",
"2827",
"2829",
"2831",
"2833",
"1"
]
},
{
"id": "BCT_35",
"provider": "BCT",
"full_name": "35) Endicott-Binghamton",
"short_name": "35",
"stops": [
"3500",
"3502",
"3504",
"3508",
"3510",
"3512",
"3514",
"3516",
"3518",
"3520",
"3522",
"3524",
"3526",
"3528",
"3530",
"3534",
"3536",
"3538",
"3540",
"3544",
"3546",
"3550",
"3552",
"3554",
"3556",
"3558",
"3560",
"3562.2",
"3562.1",
"3562",
"3564",
"3566",
"3568",
"3570",
"3572",
"3574",
"3576",
"3602",
"3604",
"3606",
"3608",
"3610",
"3612",
"3614",
"3616",
"3618",
"3620",
"3622",
"3624",
"3626",
"3628",
"3630",
"3630.1",
"3632.1",
"5583",
"5583.1",
"3636",
"3638",
"3642",
"3644",
"3646",
"3648",
"3650",
"3652",
"3654",
"3656",
"3658",
"3501"
]
},
{
"id": "BCT_40",
"provider": "BCT",
"full_name": "40) Chenango St",
"short_name": "40",
"stops": [
"4076",
"4078",
"4080",
"4082",
"4084",
"4086",
"801",
"4003",
"4005",
"4007",
"4009",
"4011",
"4013",
"4015",
"4017",
"4019",
"4021",
"4023",
"4025",
"4027",
"4029",
"4031",
"4033",
"4035",
"4037",
"4039",
"4041",
"4043",
"4045",
"4047",
"4053",
"2831",
"2833",
"1"
]
},
{
"id": "BCT_40.8",
"provider": "BCT",
"full_name": ") 40/8 Combo",
"short_name": "",
"stops": [
"4002",
"2804",
"2806",
"4096",
"4098",
"4010",
"4012",
"4014",
"4016",
"4018",
"4020",
"4022",
"4024",
"818",
"822",
"824",
"826",
"826.1",
"828",
"830",
"832",
"834",
"836",
"838",
"838.1",
"840",
"842",
"844",
"846",
"848",
"850",
"852",
"854",
"801"
]
},
{
"id": "BCT_47",
"provider": "BCT",
"full_name": "47) Vestal",
"short_name": "47",
"stops": [
"5551",
"5553",
"5555",
"5557",
"5559",
"3606",
"3608",
"3610",
"3612",
"5561",
"5563",
"95565",
"95567",
"95569",
"95571",
"5573",
"5575",
"5577",
"5579",
"5581",
"5583",
"3636",
"3638",
"3642",
"3644",
"5585",
"5587",
"5589",
"95591",
"5593",
"4736",
"4701",
"4703",
"4709.1",
"4707.1",
"4705.1",
"4711",
"4713",
"4715",
"4717",
"4719",
"4721",
"4723",
"4725",
"4727",
"4729",
"4731",
"4733",
"4735",
"4737",
"1566",
"6003",
"6002",
"6000"
]
},
{
"id": "BCT_48",
"provider": "BCT",
"full_name": "48) Shoppers Express Oakdale Mall",
"short_name": "48",
"stops": [
"3562.2",
"3562.1",
"3562",
"5714",
"6000"
]
},
{
"id": "BCT_51",
"provider": "BCT",
"full_name": "51) K Commuter",
"short_name": "51",
"stops": [
"5200",
"1204",
"1206",
"1208",
"95114",
"95101",
"95102",
"95103",
"95104",
"95105",
"95106",
"95107",
"95108",
"95109",
"95110"
]
},
{
"id": "BCT_53",
"provider": "BCT",
"full_name": "53) Corporate Park",
"short_name": "53",
"stops": [
"95309",
"95310",
"95310.1",
"95311",
"95311.1",
"95312",
"95312.1",
"95312.2",
"95313",
"95314",
"95314.1",
"95314.2",
"95314.3",
"95315",
"95316",
"95317",
"95318",
"95319",
"95320",
"95103",
"95321",
"95322",
"95323",
"1209",
"1211",
"1213",
"1215",
"1217",
"1219",
"549",
"1"
]
},
{
"id": "BCT_57",
"provider": "BCT",
"full_name": "57) Shoppers Special",
"short_name": "57",
"stops": [
"8802",
"4702",
"5706",
"95799",
"5710",
"4730",
"4734",
"4736",
"5712",
"3562.2",
"3562.1",
"3562",
"5714",
"2301",
"2303",
"2305",
"2307",
"2309",
"2311",
"2313",
"2315",
"2317",
"2319",
"2321",
"2323",
"2325",
"2325.1",
"2327",
"2329",
"5716",
"5718",
"3645",
"1"
]
},
{
"id": "BCT_91",
"provider": "BCT",
"full_name": "91) Shoppers Special Express",
"short_name": "91",
"stops": [
"6000",
"6004",
"5704",
"4702",
"5706",
"95799",
"5710",
"4730",
"4734",
"4736"
]
},
{
"id": "BCT_2840",
"provider": "BCT",
"full_name": ") 28/40 Combo",
"short_name": "",
"stops": [
"2802",
"2804",
"2806",
"2808",
"2810",
"2812",
"2814",
"2816",
"2818",
"2820",
"2822",
"2824",
"2826",
"2828",
"2830",
"2832",
"2834",
"2836",
"2838",
"2844",
"2846",
"2848",
"2850",
"2852",
"2854",
"2856",
"2858",
"2860",
"2862",
"2864",
"2866",
"2868",
"2801",
"2803",
"2805",
"2807",
"2809",
"2811",
"2813",
"2815",
"2817",
"2819",
"2821",
"2823",
"2825",
"2827",
"2829",
"4096",
"4098",
"4010",
"4012",
"4014",
"4016",
"4018",
"4020",
"4022",
"4024",
"4026",
"4028",
"4030",
"4032",
"4034",
"1"
]
},
{
"id": "BCT_122840",
"provider": "BCT",
"full_name": ") 12/28/40 Combo",
"short_name": "",
"stops": [
"1202",
"1204",
"1206",
"1208",
"1210",
"1212",
"1214",
"1216",
"1218",
"1220",
"1222",
"1224",
"1226",
"1228",
"1230",
"1201",
"1203",
"1205",
"1207",
"1209",
"1211",
"1213",
"1215",
"1217",
"1219",
"1221",
"1223",
"1225",
"2812",
"2814",
"2816",
"2818",
"2820",
"2822",
"2824",
"2826",
"2828",
"2830",
"2832",
"2834",
"2836",
"2838",
"2844",
"2846",
"2848",
"2850",
"2852",
"2854",
"2856",
"2858",
"2860",
"2862",
"2864",
"2866",
"2868",
"2801",
"2803",
"2805",
"2807",
"2809",
"2811",
"2813",
"2815",
"2817",
"2819",
"2821",
"2823",
"2825",
"2827",
"2829",
"4096",
"4098",
"4010",
"4012",
"4014",
"4016",
"4018",
"4020",
"4022",
"4024",
"4026",
"4028",
"4030",
"4032",
"4034",
"1"
]
},
{
"id": "BCT_1228405",
"provider": "BCT",
"full_name": ") 12/28/40/5 Combo",
"short_name": "",
"stops": [
"1202",
"2804",
"2806",
"4096",
"4098",
"4010",
"4012",
"4014",
"4016",
"4018",
"4020",
"4022",
"4024",
"4026",
"4028",
"4030",
"4032",
"4034",
"2826",
"2828",
"2830",
"2832",
"2834",
"2836",
"2838",
"2844",
"2846",
"2848",
"2850",
"2852",
"2854",
"2856",
"2858",
"2860",
"2862",
"2864",
"2866",
"2868",
"2801",
"2803",
"2805",
"2807",
"2809",
"2811",
"2813",
"2815",
"2817",
"2819",
"2821",
"2823",
"2825",
"1210",
"1212",
"1214",
"1216",
"1218",
"1220",
"1222",
"1224",
"1226",
"1228",
"1230",
"1201",
"1203",
"1205",
"1207",
"1209",
"1211",
"1213",
"1215",
"1217",
"1219",
"510",
"512",
"514",
"516",
"518",
"520",
"522",
"524",
"526",
"528",
"530",
"532",
"534",
"536",
"538",
"540",
"542",
"544",
"546",
"548",
"550",
"552",
"554",
"556",
"558",
"560",
"562",
"6000"
]
},
{
"id": "BCT_12.53",
"provider": "BCT",
"full_name": ") 12/53 Combo",
"short_name": "",
"stops": [
"1202",
"1204",
"1206",
"1208",
"1210",
"1212",
"1214",
"1216",
"1218",
"1220",
"1222",
"1224",
"1226",
"1228",
"1230",
"1201",
"95301",
"95302",
"95303",
"95304",
"95103",
"95305",
"95306",
"95307",
"95308",
"95309"
]
},
{
"id": "BCT_12.3",
"provider": "BCT",
"full_name": ") 12/3 Combo",
"short_name": "",
"stops": [
"1202",
"1204",
"1206",
"1208",
"1210",
"1212",
"1214",
"1216",
"1218",
"1220",
"1222",
"1224",
"1226",
"1228",
"1230",
"1201",
"1203",
"1205",
"1207",
"1209",
"1211",
"1213",
"1215",
"1217",
"1219",
"510",
"512",
"514",
"516",
"308",
"310",
"312",
"314",
"316",
"318",
"320",
"322",
"324",
"326",
"328",
"301",
"303",
"305",
"307",
"309",
"311",
"313",
"315",
"317",
"319",
"321",
"323",
"535",
"325.1",
"325.2",
"329",
"331",
"553",
"1"
]
},
{
"id": "OCCT_1",
"provider": "OCCT",
"full_name": "Westside Outbound",
"short_name": "WS O",
"stops": [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"132",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21"
]
},
{
"id": "OCCT_2",
"provider": "OCCT",
"full_name": "Westside Inbound",
"short_name": "WS I",
"stops": [
"42",
"43",
"44",
"45",
"46",
"47",
"48",
"49",
"50",
"51",
"52",
"53",
"54",
"55",
"56",
"57",
"58",
"59",
"60",
"32",
"118",
"1",
"61"
]
},
{
"id": "OCCT_3",
"provider": "OCCT",
"full_name": "Downtown Center Leroy Outbound",
"short_name": "DCL O",
"stops": [
"1",
"2",
"3",
"33",
"34",
"35",
"36",
"37",
"38",
"39",
"40",
"41",
"42"
]
},
{
"id": "OCCT_4",
"provider": "OCCT",
"full_name": "Downtown Center Leroy Inbound",
"short_name": "DCL I",
"stops": [
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"30",
"31",
"32",
"118",
"61",
"1"
]
},
{
"id": "OCCT_5",
"provider": "OCCT",
"full_name": "UCLUB",
"short_name": "UC",
"stops": [
"61",
"63",
"64",
"65",
"66",
"67",
"68",
"69",
"134",
"1"
]
},
{
"id": "OCCT_8",
"provider": "OCCT",
"full_name": "Campus Shuttle",
"short_name": "CS",
"stops": [
"61",
"117",
"62",
"63",
"64",
"65",
"110",
"111",
"112",
"113",
"114",
"115",
"116",
"1"
]
},
{
"id": "OCCT_9",
"provider": "OCCT",
"full_name": "Riviera Ridge - Town Square Mall",
"short_name": "RRT",
"stops": [
"118",
"2",
"3",
"119",
"120",
"121",
"122",
"123",
"124",
"125",
"126",
"127",
"128",
"32",
"61",
"1"
]
},
{
"id": "OCCT_10",
"provider": "OCCT",
"full_name": "Oakdale Commons",
"short_name": "OC",
"stops": [
"118",
"2",
"3",
"129",
"130",
"32",
"61",
"1"
]
},
{
"id": "OCCT_12",
"provider": "OCCT",
"full_name": "University Downtown Center Outbound",
"short_name": "UDC O",
"stops": [
"1",
"21",
"42"
]
},
{
"id": "OCCT_13",
"provider": "OCCT",
"full_name": "University Downtown Center Inbound",
"short_name": "UDC I",
"stops": [
"21",
"32",
"118",
"1",
"61"
]
},
{
"id": "OCCT_14",
"provider": "OCCT",
"full_name": "Main Street Outbound",
"short_name": "MS O",
"stops": [
"1",
"2",
"3",
"70",
"71",
"72",
"73",
"74",
"75",
"76",
"77",
"155",
"78",
"12",
"132",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"21"
]
},
{
"id": "OCCT_15",
"provider": "OCCT",
"full_name": "Main Street Inbound",
"short_name": "MS I",
"stops": [
"42",
"43",
"44",
"45",
"46",
"47",
"48",
"49",
"50",
"51",
"79",
"155",
"80",
"81",
"82",
"83",
"84",
"85",
"32",
"61",
"1"
]
},
{
"id": "OCCT_16",
"provider": "OCCT",
"full_name": "ITC - UCLUB",
"short_name": "IU",
"stops": [
"61",
"63",
"64",
"65",
"109",
"66",
"67",
"68",
"134",
"69"
]
},
{
"id": "OCCT_17",
"provider": "OCCT",
"full_name": "Downtown Southside Outbound",
"short_name": "DSO",
"stops": [
"136",
"137",
"1",
"138",
"139",
"140",
"141",
"142",
"143",
"144",
"145",
"146",
"147",
"148",
"154",
"150",
"151",
"153",
"21"
]
}
]