smomtaz commited on
Commit
e876ecf
·
verified ·
1 Parent(s): 2184754

Update server.py

Browse files
Files changed (1) hide show
  1. server.py +79 -74
server.py CHANGED
@@ -20,6 +20,7 @@ zones, trips = load_data()
20
  # Path to Excel file
21
  EXCEL_FILE = "data/trips_data.xlsx" # Update with your file path
22
  Json_title_FILE = "data/old_table_title.json"
 
23
 
24
  # Question-to-Sheet Mapping
25
  QUESTION_TO_SHEET = {
@@ -29,79 +30,79 @@ QUESTION_TO_SHEET = {
29
  "Where are trips starting and ending within Napa County?": "OD1",
30
  }
31
 
32
- tables_json = {
33
- "TTyp1": {
34
- "Trip Type": [
35
- "Intra-Napa County Trips",
36
- "Trips into Napa County",
37
- "Trips out of Napa County",
38
- "Napa County Pass-Through Trips",
39
- "Total Trips Interacting with Napa County"
40
- ],
41
- "Trips": [238000, 52000, 51000, 12000, 353000],
42
- "Previous TBS Trips": [238000, 48000, 47000, 12000, 345000],
43
- "Percent": ["67%", "15%", "15%", "3%", "100%"],
44
- "Previous TBS Percentage": ["68%", "14%", "14%", "3%", "100%"]
45
- },
46
- "GWTTyp1": {
47
- "Napa County Gateway": [
48
- "SR 29 at Napa/Solano County Line - Northbound",
49
- "SR 29 at Napa/Solano County Line - Southbound",
50
- "SR 12 at Napa/Solano County Line - Westbound",
51
- "SR 12 at Napa/Solano County Line - Eastbound",
52
- "SR 29 at Napa/Lake County Line - Southbound",
53
- "SR 29 at Napa/Lake County Line - Northbound",
54
- "SR 128 at Napa/Sonoma County Line - Eastbound",
55
- "SR 128 at Napa/Sonoma County Line - Westbound",
56
- "SR 12 at Napa/Sonoma County Line - Eastbound",
57
- "SR 12 at Napa/Sonoma County Line - Westbound",
58
- "SR 128 at Napa/Solano County Line - Westbound",
59
- "SR 128 at Napa/Solano County Line - Eastbound",
60
- "SMR at Napa/Sonoma County Line - Westbound",
61
- "SMR at Napa/Sonoma County Line - Eastbound",
62
- "All Napa County Gateway Trips"
63
- ],
64
- "Total Trips": [
65
- 23000, 24000, 24000, 22000, 4000, 4000, 1000, 1000, 16000, 15000,
66
- 600, 600, 400, 300, 124000
67
- ],
68
- "Napa County Pass-Through Trips": [
69
- "4%", "6%", "16%", "16%", "56%", "48%", "22%", "26%", "29%", "29%",
70
- "17%", "11%", "3%", "7%", "10%"
71
- ],
72
- "Trips into Napa County": [
73
- "82%", "2%", "83%", "0%", "27%", "0%", "70%", "0%", "70%", "70%",
74
- "69%", "69%", "33%", "50%", "42%"
75
- ],
76
- "Trips out of Napa County": [
77
- "1%", "76%", "0%", "84%", "6%", "27%", "0%", "70%", "0%", "0%",
78
- "6%", "6%", "60%", "0%", "41%"
79
- ]
80
- },
81
- "TT1": {
82
- "Location": [
83
- "Vallejo", "Fairfield", "Santa Rosa", "Vacaville", "City of Sonoma", "Total"
84
- ],
85
- "Calistoga": [16, 35, 149, 9, 4, 213],
86
- "Angwin": [48, 0, 7, 0, 4, 59],
87
- "Saint Helena": [67, 207, 189, 126, 66, 655],
88
- "Yountville": [69, 75, 26, 107, 105, 382],
89
- "Napa": [5125, 4384, 3131, 2005, 1290, 15935],
90
- "American Canyon": [6534, 1449, 326, 412, 154, 8875],
91
- "Unincorporated": [1374, 1271, 1350, 762, 303, 5060],
92
- "Total": [13233, 7421, 5178, 3421, 1926, 31179]
93
- },
94
- "OD1": {
95
- "City": [
96
- "Calistoga", "Angwin", "Saint Helena", "Yountville",
97
- "Napa", "American Canyon", "Unincorporated", "Total"
98
- ],
99
- "Trip Origins - Trips": [6600, 3600, 11800, 5200, 187600, 33100, 41000, 289100],
100
- "Trip Origins - Percent": ["2%", "1%", "4%", "2%", "65%", "11%", "14%", "100%"],
101
- "Trip Destinations - Trips": [6600, 3600, 11900, 5400, 186500, 33400, 43000, 290300],
102
- "Trip Destinations - Percent": ["2%", "1%", "4%", "2%", "64%", "12%", "15%", "100%"]
103
- }
104
- }
105
 
106
  #tables_title_json = {
107
  # "TTyp1": ["Table 4.1: Weekday All-Day Trip Types"],
@@ -109,7 +110,11 @@ tables_json = {
109
  # "TT1": ["Table 4.3: Weekday All-Day Top Five Generators of Inbound Trips"],
110
  # "OD1": ["Table 4.4: Weekday All-Day Origins and Destinations by City"]
111
  #}
112
-
 
 
 
 
113
  # Load the JSON file into a Python dictionary
114
  with open(Json_title_FILE, "r") as file:
115
  tables_title_json = json.load(file)
 
20
  # Path to Excel file
21
  EXCEL_FILE = "data/trips_data.xlsx" # Update with your file path
22
  Json_title_FILE = "data/old_table_title.json"
23
+ Json_table_FILE = "data/old_table.json"
24
 
25
  # Question-to-Sheet Mapping
26
  QUESTION_TO_SHEET = {
 
30
  "Where are trips starting and ending within Napa County?": "OD1",
31
  }
32
 
33
+ #tables_json = {
34
+ # "TTyp1": {
35
+ # "Trip Type": [
36
+ # "Intra-Napa County Trips",
37
+ # "Trips into Napa County",
38
+ # "Trips out of Napa County",
39
+ # "Napa County Pass-Through Trips",
40
+ # "Total Trips Interacting with Napa County"
41
+ # ],
42
+ # "Trips": [238000, 52000, 51000, 12000, 353000],
43
+ # "Previous TBS Trips": [238000, 48000, 47000, 12000, 345000],
44
+ # "Percent": ["67%", "15%", "15%", "3%", "100%"],
45
+ # "Previous TBS Percentage": ["68%", "14%", "14%", "3%", "100%"]
46
+ # },
47
+ # "GWTTyp1": {
48
+ # "Napa County Gateway": [
49
+ # "SR 29 at Napa/Solano County Line - Northbound",
50
+ # "SR 29 at Napa/Solano County Line - Southbound",
51
+ # "SR 12 at Napa/Solano County Line - Westbound",
52
+ # "SR 12 at Napa/Solano County Line - Eastbound",
53
+ # "SR 29 at Napa/Lake County Line - Southbound",
54
+ # "SR 29 at Napa/Lake County Line - Northbound",
55
+ # "SR 128 at Napa/Sonoma County Line - Eastbound",
56
+ # "SR 128 at Napa/Sonoma County Line - Westbound",
57
+ # "SR 12 at Napa/Sonoma County Line - Eastbound",
58
+ # "SR 12 at Napa/Sonoma County Line - Westbound",
59
+ # "SR 128 at Napa/Solano County Line - Westbound",
60
+ # "SR 128 at Napa/Solano County Line - Eastbound",
61
+ # "SMR at Napa/Sonoma County Line - Westbound",
62
+ # "SMR at Napa/Sonoma County Line - Eastbound",
63
+ # "All Napa County Gateway Trips"
64
+ # ],
65
+ # "Total Trips": [
66
+ # 23000, 24000, 24000, 22000, 4000, 4000, 1000, 1000, 16000, 15000,
67
+ # 600, 600, 400, 300, 124000
68
+ # ],
69
+ # "Napa County Pass-Through Trips": [
70
+ # "4%", "6%", "16%", "16%", "56%", "48%", "22%", "26%", "29%", "29%",
71
+ # "17%", "11%", "3%", "7%", "10%"
72
+ # ],
73
+ # "Trips into Napa County": [
74
+ # "82%", "2%", "83%", "0%", "27%", "0%", "70%", "0%", "70%", "70%",
75
+ # "69%", "69%", "33%", "50%", "42%"
76
+ # ],
77
+ # "Trips out of Napa County": [
78
+ # "1%", "76%", "0%", "84%", "6%", "27%", "0%", "70%", "0%", "0%",
79
+ # "6%", "6%", "60%", "0%", "41%"
80
+ # ]
81
+ # },
82
+ # "TT1": {
83
+ # "Location": [
84
+ # "Vallejo", "Fairfield", "Santa Rosa", "Vacaville", "City of Sonoma", "Total"
85
+ # ],
86
+ # "Calistoga": [16, 35, 149, 9, 4, 213],
87
+ # "Angwin": [48, 0, 7, 0, 4, 59],
88
+ # "Saint Helena": [67, 207, 189, 126, 66, 655],
89
+ # "Yountville": [69, 75, 26, 107, 105, 382],
90
+ # "Napa": [5125, 4384, 3131, 2005, 1290, 15935],
91
+ # "American Canyon": [6534, 1449, 326, 412, 154, 8875],
92
+ # "Unincorporated": [1374, 1271, 1350, 762, 303, 5060],
93
+ # "Total": [13233, 7421, 5178, 3421, 1926, 31179]
94
+ # },
95
+ # "OD1": {
96
+ # "City": [
97
+ # "Calistoga", "Angwin", "Saint Helena", "Yountville",
98
+ # "Napa", "American Canyon", "Unincorporated", "Total"
99
+ # ],
100
+ # "Trip Origins - Trips": [6600, 3600, 11800, 5200, 187600, 33100, 41000, 289100],
101
+ # "Trip Origins - Percent": ["2%", "1%", "4%", "2%", "65%", "11%", "14%", "100%"],
102
+ # "Trip Destinations - Trips": [6600, 3600, 11900, 5400, 186500, 33400, 43000, 290300],
103
+ # "Trip Destinations - Percent": ["2%", "1%", "4%", "2%", "64%", "12%", "15%", "100%"]
104
+ # }
105
+ #}
106
 
107
  #tables_title_json = {
108
  # "TTyp1": ["Table 4.1: Weekday All-Day Trip Types"],
 
110
  # "TT1": ["Table 4.3: Weekday All-Day Top Five Generators of Inbound Trips"],
111
  # "OD1": ["Table 4.4: Weekday All-Day Origins and Destinations by City"]
112
  #}
113
+
114
+ # Load the JSON file into a Python dictionary
115
+ with open(Json_table_FILE, "r") as file:
116
+ tables_json = json.load(file)
117
+
118
  # Load the JSON file into a Python dictionary
119
  with open(Json_title_FILE, "r") as file:
120
  tables_title_json = json.load(file)