tgd1115 commited on
Commit
c31d853
·
verified ·
1 Parent(s): 86e38cb

Upload app.py

Browse files
Files changed (1) hide show
  1. src/app.py +92 -29
src/app.py CHANGED
@@ -146,67 +146,130 @@ class NYCTaxiAnomalyDetector:
146
  @dataclass()
147
  class AIContextGenerator:
148
  predefined_anomalies = {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  datetime(2014, 11, 2).date(): [
150
  {
151
- "type": "NYC Marathon",
152
- "description": "No significant anomalies detected with current settings. No significant anomalies detected with current settings. No significant anomalies detected with current settings.",
153
- "reference": None,
 
 
 
154
  }
155
  ],
156
  datetime(2014, 11, 27).date(): [
157
  {
158
  "type": "Thanksgiving Day",
159
- "description": "Thanksgiving Day",
160
- "reference": None,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  }
162
  ],
163
  datetime(2014, 12, 25).date(): [
164
  {
165
- "type": "Christmas",
166
- "description": "Christmas",
167
  "reference": {
168
- "text": "NYC Marathon 2014",
169
- "url": "https://en.wikipedia.org/wiki/2014_New_York_City_Marathon",
170
  },
171
  }
172
  ],
173
- datetime(2015, 1, 1).date(): [
 
 
 
 
 
 
 
174
  {
175
- "type": "Event",
176
- "description": "New Year's Day",
177
  "reference": {
178
- "text": "NYC Marathon 2014",
179
- "url": "https://en.wikipedia.org/wiki/2014_New_York_City_Marathon",
180
  },
181
  }
182
  ],
183
- datetime(2015, 1, 26).date(): [
184
  {
185
- "type": "Event",
186
- "description": "Snowstorm",
187
  "reference": {
188
- "text": "NYC Marathon 2014",
189
- "url": "https://en.wikipedia.org/wiki/2014_New_York_City_Marathon",
190
  },
191
  }
192
  ],
193
- datetime(2015, 1, 27).date(): [
194
  {
195
- "type": "Event",
196
- "description": "Snowstorm",
197
  "reference": {
198
- "text": "NYC Marathon 2014",
199
- "url": "https://en.wikipedia.org/wiki/2014_New_York_City_Marathon",
200
  },
201
  }
202
  ],
203
- datetime(2014, 7, 1).date(): [
204
  {
205
- "type": "Event",
206
- "description": "Testing",
207
  "reference": {
208
- "text": "NYC Marathon 2014",
209
- "url": "https://en.wikipedia.org/wiki/2014_New_York_City_Marathon",
210
  },
211
  }
212
  ],
 
146
  @dataclass()
147
  class AIContextGenerator:
148
  predefined_anomalies = {
149
+ datetime(2014, 7, 4).date(): [
150
+ {
151
+ "type": "USA's 238th Independence Day",
152
+ "description": "The Fourth of July in 2014 marked the USA's 238th Independence Day, celebrated with widespread fireworks as The Macy's 4th of July Fireworks returned to the East River, attracting thousands of locals and tourists to the waterfront for one of the city's largest annual displays. The surge in activity led to increased taxi ridership as residents and tourists traveled to and from celebrations.",
153
+ "reference": {
154
+ "text": "USA's 238th Independence Day 2014",
155
+ "url": "https://www.theguardian.com/world/2014/jul/05/fourth-july-independence-day-america-pictures",
156
+ },
157
+ }
158
+ ],
159
+ datetime(2014, 7, 6).date(): [
160
+ {
161
+ "type": "Long Holiday for USA's 238th Independence Day",
162
+ "description": "There was a long holiday this weekend due to the Independence Day celebrations, which explains why taxi ridership saw a sustained increase as the people took the holiday to their advantage.",
163
+ "reference": {
164
+ "text": "Long Holiday for USA's 238th Independence Day",
165
+ "url": "https://www.cbsnews.com/pictures/independence-day-2014/2/",
166
+ },
167
+ }
168
+ ],
169
+ datetime(2014, 9, 1).date(): [
170
+ {
171
+ "type": "Labor Day",
172
+ "description": "Labor Day 2014 marked the unofficial end of summer, with many New Yorkers and tourists enjoying the long weekend by doing outdoor activities, shopping and even traveling. This holiday lead to increased taxi ridership as people attended parades, visited parks and took advantage of end-of-summer sales across the city.",
173
+ "reference": {
174
+ "text": "Labor Day 2014",
175
+ "url": "https://www.nycclc.org/gallery/2014-nyc-labor-day-parade-video",
176
+ },
177
+ }
178
+ ],
179
  datetime(2014, 11, 2).date(): [
180
  {
181
+ "type": "New York City (NYC) Marathon 2014",
182
+ "description": "The 2014 NYC Marathon, the largest in history with 50,869 starters and 50,564 finishers, significantly increased taxi ridership due to the influx of participants and spectators.",
183
+ "reference": {
184
+ "text": "NYC Marathon 2014",
185
+ "url": "https://en.wikipedia.org/wiki/2014_New_York_City_Marathon",
186
+ },
187
  }
188
  ],
189
  datetime(2014, 11, 27).date(): [
190
  {
191
  "type": "Thanksgiving Day",
192
+ "description": "Thanksgiving Day 2014 featured the iconic Macys Thanksgiving Day Parade, with giant balloons, floats, and performances drawing millions of spectators to the streets of New York City. The event, along with holiday travel and family gatherings, led to a significant increase in taxi ridership throughout the day.",
193
+ "reference": {
194
+ "text": "Thanksgiving Day 2014",
195
+ "url": "https://www.cbsnews.com/pictures/macys-thanksgiving-day-parade-2014/",
196
+ },
197
+ }
198
+ ],
199
+ datetime(2014, 11, 28).date(): [
200
+ {
201
+ "type": "Post-Thanksgiving Day",
202
+ "description": "The day after Thanksgiving in 2014 saw a surge in activity across New York City as residents and tourists participated in Black Friday shopping, visited family, and enjoyed extended holiday festivities. This led to increased taxi ridership as people traveled to retail hubs, restaurants, and other destinations throughout the city.",
203
+ "reference": {
204
+ "text": "Thanksgiving Day 2014",
205
+ "url": "https://www.cbsnews.com/pictures/macys-thanksgiving-day-parade-2014/#:~:text=Macy's%20Parade&text=The%20Wicked%20Witch%20of%20the,million%20people%20were%20in%20attendance.",
206
+ },
207
+ }
208
+ ],
209
+ datetime(2014, 12, 24).date(): [
210
+ {
211
+ "type": "Christmas Eve",
212
+ "description": "Christmas Eve 2014 in New York City was marked by festive celebrations, last-minute shopping, and gatherings with family and friends. The holiday spirit led to increased taxi ridership as people traveled to stores, restaurants, and holiday events across the city.",
213
+ "reference": {
214
+ "text": "Christmas Eve 2014",
215
+ "url": "https://archive.nytimes.com/cityroom.blogs.nytimes.com/2014/12/31/live-video-new-years-eve-in-times-square/",
216
+ },
217
  }
218
  ],
219
  datetime(2014, 12, 25).date(): [
220
  {
221
+ "type": "Christmas Day",
222
+ "description": "Christmas Day 2014 in New York City was a time of festive gatherings, family celebrations, and holiday cheer. With many restaurants, attractions, and public spaces open, taxi ridership saw an increase as residents and tourists traveled to visit loved ones, attend holiday events, and enjoy the city's festive atmosphere.",
223
  "reference": {
224
+ "text": "Christmas Day 2014",
225
+ "url": "https://storiesmysuitcasecouldtell.com/2014/12/24/a-merry-christmas-in-new-york-city/",
226
  },
227
  }
228
  ],
229
+ datetime(2014, 12, 26).date(): [
230
+ {
231
+ "type": "Boxing Day",
232
+ "description": "The day after Christmas in 2014 which is the Boxing Day saw continued holiday activity in New York City, with residents and tourists taking advantage of post-holiday sales, returning gifts, and enjoying extended celebrations. This led to increased taxi ridership as people traveled to shopping centers, restaurants, and entertainment venues across the city.",
233
+ "reference": None,
234
+ }
235
+ ],
236
+ datetime(2014, 12, 31).date(): [
237
  {
238
+ "type": "New Year's Eve",
239
+ "description": "New Years Eve 2014 in New York City was marked by the iconic Times Square Ball Drop, drawing over a million spectators to the area and millions more watching worldwide. The celebrations, along with parties and events across the city, led to a significant increase in taxi ridership as residents and tourists traveled to and from festivities.",
240
  "reference": {
241
+ "text": "New Year's Eve",
242
+ "url": "https://abcnews.go.com/US/2014-years-eve-times-square-numbers/story?id=27929342",
243
  },
244
  }
245
  ],
246
+ datetime(2015, 1, 1).date(): [
247
  {
248
+ "type": "New Year's Day",
249
+ "description": "New Year’s Day 2015 in New York City saw a continuation of celebrations from the previous night, with many residents and tourists recovering from festivities or attending brunches, parades, and family gatherings. The increased activity led to higher taxi ridership as people traveled across the city to celebrate the start of the new year.",
250
  "reference": {
251
+ "text": "New Year's Day 2015",
252
+ "url": "https://www.cbsnews.com/newyork/pictures/new-years-2015-in-times-square/",
253
  },
254
  }
255
  ],
256
+ datetime(2015, 1, 26).date(): [
257
  {
258
+ "type": "Winter Snow Juno",
259
+ "description": "Winter Storm Juno, a historic blizzard, hit New York City on January 26-27, 2015, bringing heavy snowfall, strong winds, and widespread disruptions. The storm led to a sharp decline in taxi ridership as travel became hazardous, with many roads closed and public transportation services suspended.",
260
  "reference": {
261
+ "text": "Winter Snow Juno 2015",
262
+ "url": "https://www.rms.com/blog/2015/01/27/winter-storm-juno-three-facts-about-snowmageddon-2015#:~:text=There%20were%20predictions%20that%20Winter,hunkered%20down%20in%20their%20homes.",
263
  },
264
  }
265
  ],
266
+ datetime(2015, 1, 27).date(): [
267
  {
268
+ "type": "2nd Day of Winter Snow Juno",
269
+ "description": "2nd day of Winter Storm Juno, a historic blizzard, hit New York City on January 26-27, 2015, bringing heavy snowfall, strong winds, and widespread disruptions. The storm led to a sharp decline in taxi ridership as travel became hazardous, with many roads closed and public transportation services suspended.",
270
  "reference": {
271
+ "text": "Winter Snow Juno 2015",
272
+ "url": "https://www.rms.com/blog/2015/01/27/winter-storm-juno-three-facts-about-snowmageddon-2015#:~:text=There%20were%20predictions%20that%20Winter,hunkered%20down%20in%20their%20homes.",
273
  },
274
  }
275
  ],