From db65daa161044438406c860fd189d312e28695d5 Mon Sep 17 00:00:00 2001 From: Alexander Munch-Hansen Date: Fri, 5 Apr 2019 22:24:09 +0200 Subject: [PATCH 1/2] Traffic data --- server/nightr/traffic_data_22_23.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 server/nightr/traffic_data_22_23.json diff --git a/server/nightr/traffic_data_22_23.json b/server/nightr/traffic_data_22_23.json new file mode 100644 index 0000000..cbfbac4 --- /dev/null +++ b/server/nightr/traffic_data_22_23.json @@ -0,0 +1 @@ +{"help": "https://portal.opendata.dk/api/3/action/help_show?name=datastore_search", "success": true, "result": {"include_total": true, "resource_id": "b3eeb0ff-c8a8-4824-99d6-e0a3747c8b0d", "fields": [{"type": "int", "id": "_id"}, {"type": "int4", "id": "REPORT_ID"}, {"type": "timestamp", "id": "TIMESTAMP"}, {"type": "text", "id": "status"}, {"type": "int4", "id": "avgMeasuredTime"}, {"type": "int4", "id": "medianMeasuredTime"}, {"type": "int4", "id": "vehicleCount"}, {"type": "int4", "id": "avgSpeed"}], "records_format": "objects", "records": [{"_id": 296, "REPORT_ID": 179038, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 38, "medianMeasuredTime": 38, "vehicleCount": 4, "avgSpeed": 34}, {"_id": 424, "REPORT_ID": 179282, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 34, "medianMeasuredTime": 34, "vehicleCount": 8, "avgSpeed": 64}, {"_id": 77, "REPORT_ID": 185104, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 104, "medianMeasuredTime": 104, "vehicleCount": 1, "avgSpeed": 18}, {"_id": 52, "REPORT_ID": 187721, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 111, "medianMeasuredTime": 111, "vehicleCount": 2, "avgSpeed": 22}, {"_id": 63, "REPORT_ID": 187774, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 119, "medianMeasuredTime": 119, "vehicleCount": 3, "avgSpeed": 18}, {"_id": 258, "REPORT_ID": 181034, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 48, "medianMeasuredTime": 48, "vehicleCount": 4, "avgSpeed": 33}, {"_id": 131, "REPORT_ID": 181006, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 48, "medianMeasuredTime": 48, "vehicleCount": 2, "avgSpeed": 45}, {"_id": 49, "REPORT_ID": 180844, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 88, "medianMeasuredTime": 88, "vehicleCount": 9, "avgSpeed": 20}, {"_id": 222, "REPORT_ID": 188198, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 41, "medianMeasuredTime": 41, "vehicleCount": 2, "avgSpeed": 46}, {"_id": 331, "REPORT_ID": 179202, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 71, "medianMeasuredTime": 71, "vehicleCount": 3, "avgSpeed": 26}, {"_id": 403, "REPORT_ID": 181060, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 43, "medianMeasuredTime": 43, "vehicleCount": 2, "avgSpeed": 37}, {"_id": 418, "REPORT_ID": 206051, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 142, "medianMeasuredTime": 142, "vehicleCount": 0, "avgSpeed": 14}, {"_id": 211, "REPORT_ID": 210120, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 299, "medianMeasuredTime": 299, "vehicleCount": 0, "avgSpeed": 25}, {"_id": 340, "REPORT_ID": 185210, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 41, "medianMeasuredTime": 41, "vehicleCount": 0, "avgSpeed": 65}, {"_id": 376, "REPORT_ID": 192681, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 65, "medianMeasuredTime": 65, "vehicleCount": 0, "avgSpeed": 44}, {"_id": 223, "REPORT_ID": 190475, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 46, "medianMeasuredTime": 46, "vehicleCount": 3, "avgSpeed": 65}, {"_id": 420, "REPORT_ID": 158655, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 204, "medianMeasuredTime": 204, "vehicleCount": 2, "avgSpeed": 118}, {"_id": 87, "REPORT_ID": 190338, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 38, "medianMeasuredTime": 38, "vehicleCount": 1, "avgSpeed": 42}, {"_id": 295, "REPORT_ID": 197734, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 48, "medianMeasuredTime": 48, "vehicleCount": 1, "avgSpeed": 61}, {"_id": 100, "REPORT_ID": 178847, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 82, "medianMeasuredTime": 82, "vehicleCount": 7, "avgSpeed": 46}, {"_id": 322, "REPORT_ID": 158954, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 0, "medianMeasuredTime": 0, "vehicleCount": 0, "avgSpeed": 0}, {"_id": 29, "REPORT_ID": 201802, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 140, "medianMeasuredTime": 140, "vehicleCount": 0, "avgSpeed": 37}, {"_id": 53, "REPORT_ID": 180547, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 56, "medianMeasuredTime": 56, "vehicleCount": 5, "avgSpeed": 65}, {"_id": 198, "REPORT_ID": 192600, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 72, "medianMeasuredTime": 72, "vehicleCount": 17, "avgSpeed": 60}, {"_id": 408, "REPORT_ID": 181114, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 39, "medianMeasuredTime": 39, "vehicleCount": 3, "avgSpeed": 53}, {"_id": 171, "REPORT_ID": 190100, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 171, "medianMeasuredTime": 171, "vehicleCount": 2, "avgSpeed": 31}, {"_id": 183, "REPORT_ID": 181305, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 129, "medianMeasuredTime": 129, "vehicleCount": 1, "avgSpeed": 26}, {"_id": 143, "REPORT_ID": 197626, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 99, "medianMeasuredTime": 99, "vehicleCount": 4, "avgSpeed": 58}, {"_id": 4, "REPORT_ID": 197463, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 45, "medianMeasuredTime": 45, "vehicleCount": 2, "avgSpeed": 89}, {"_id": 417, "REPORT_ID": 206157, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 72, "medianMeasuredTime": 72, "vehicleCount": 2, "avgSpeed": 23}, {"_id": 337, "REPORT_ID": 206316, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 44, "medianMeasuredTime": 44, "vehicleCount": 1, "avgSpeed": 44}, {"_id": 255, "REPORT_ID": 192813, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 59, "medianMeasuredTime": 59, "vehicleCount": 1, "avgSpeed": 35}, {"_id": 263, "REPORT_ID": 185078, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 128, "medianMeasuredTime": 128, "vehicleCount": 2, "avgSpeed": 15}, {"_id": 8, "REPORT_ID": 181331, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 118, "medianMeasuredTime": 118, "vehicleCount": 7, "avgSpeed": 28}, {"_id": 82, "REPORT_ID": 187403, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 122, "medianMeasuredTime": 122, "vehicleCount": 0, "avgSpeed": 56}, {"_id": 164, "REPORT_ID": 195070, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 132, "medianMeasuredTime": 132, "vehicleCount": 2, "avgSpeed": 59}, {"_id": 173, "REPORT_ID": 197381, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 74, "medianMeasuredTime": 74, "vehicleCount": 0, "avgSpeed": 48}, {"_id": 190, "REPORT_ID": 186953, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 94, "medianMeasuredTime": 94, "vehicleCount": 2, "avgSpeed": 30}, {"_id": 438, "REPORT_ID": 180709, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 56, "medianMeasuredTime": 56, "vehicleCount": 8, "avgSpeed": 62}, {"_id": 278, "REPORT_ID": 195365, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 55, "medianMeasuredTime": 55, "vehicleCount": 0, "avgSpeed": 49}, {"_id": 155, "REPORT_ID": 194905, "TIMESTAMP": "2019-04-05T20:23:00", "status": "OK", "avgMeasuredTime": 0, "medianMeasuredTime": 0, "vehicleCount": 0, "avgSpeed": 0}, {"_id": 19, "REPORT_ID": 190770, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 65, "medianMeasuredTime": 65, "vehicleCount": 11, "avgSpeed": 44}, {"_id": 406, "REPORT_ID": 180681, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 49, "medianMeasuredTime": 49, "vehicleCount": 18, "avgSpeed": 67}, {"_id": 228, "REPORT_ID": 209774, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 236, "medianMeasuredTime": 236, "vehicleCount": 0, "avgSpeed": 16}, {"_id": 169, "REPORT_ID": 193294, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 63, "medianMeasuredTime": 63, "vehicleCount": 6, "avgSpeed": 75}, {"_id": 441, "REPORT_ID": 201399, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 127, "medianMeasuredTime": 127, "vehicleCount": 1, "avgSpeed": 48}, {"_id": 360, "REPORT_ID": 190853, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 94, "medianMeasuredTime": 94, "vehicleCount": 1, "avgSpeed": 42}, {"_id": 306, "REPORT_ID": 195312, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 98, "medianMeasuredTime": 98, "vehicleCount": 13, "avgSpeed": 54}, {"_id": 299, "REPORT_ID": 195286, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 94, "medianMeasuredTime": 94, "vehicleCount": 3, "avgSpeed": 57}, {"_id": 138, "REPORT_ID": 197572, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 37, "medianMeasuredTime": 37, "vehicleCount": 3, "avgSpeed": 53}, {"_id": 271, "REPORT_ID": 195684, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 36, "medianMeasuredTime": 36, "vehicleCount": 1, "avgSpeed": 63}, {"_id": 111, "REPORT_ID": 185343, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 137, "medianMeasuredTime": 137, "vehicleCount": 1, "avgSpeed": 19}, {"_id": 33, "REPORT_ID": 158776, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 0, "medianMeasuredTime": 0, "vehicleCount": 0, "avgSpeed": 0}, {"_id": 239, "REPORT_ID": 195870, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 77, "medianMeasuredTime": 77, "vehicleCount": 0, "avgSpeed": 58}, {"_id": 209, "REPORT_ID": 184813, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 43, "medianMeasuredTime": 43, "vehicleCount": 2, "avgSpeed": 42}, {"_id": 355, "REPORT_ID": 195525, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 87, "medianMeasuredTime": 87, "vehicleCount": 0, "avgSpeed": 22}, {"_id": 224, "REPORT_ID": 192653, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 38, "medianMeasuredTime": 38, "vehicleCount": 12, "avgSpeed": 58}, {"_id": 199, "REPORT_ID": 180573, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 53, "medianMeasuredTime": 53, "vehicleCount": 7, "avgSpeed": 68}, {"_id": 245, "REPORT_ID": 187536, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 86, "medianMeasuredTime": 86, "vehicleCount": 6, "avgSpeed": 48}, {"_id": 210, "REPORT_ID": 181277, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 60, "medianMeasuredTime": 60, "vehicleCount": 10, "avgSpeed": 30}, {"_id": 371, "REPORT_ID": 180601, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 81, "medianMeasuredTime": 81, "vehicleCount": 5, "avgSpeed": 65}, {"_id": 188, "REPORT_ID": 180952, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 52, "medianMeasuredTime": 52, "vehicleCount": 4, "avgSpeed": 56}, {"_id": 12, "REPORT_ID": 190206, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 61, "medianMeasuredTime": 61, "vehicleCount": 1, "avgSpeed": 29}, {"_id": 425, "REPORT_ID": 178821, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 88, "medianMeasuredTime": 88, "vehicleCount": 6, "avgSpeed": 43}, {"_id": 270, "REPORT_ID": 201589, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 634, "medianMeasuredTime": 634, "vehicleCount": 4, "avgSpeed": 74}, {"_id": 411, "REPORT_ID": 184784, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 118, "medianMeasuredTime": 118, "vehicleCount": 7, "avgSpeed": 37}, {"_id": 38, "REPORT_ID": 187907, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 49, "medianMeasuredTime": 49, "vehicleCount": 0, "avgSpeed": 48}, {"_id": 244, "REPORT_ID": 209960, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 98, "medianMeasuredTime": 98, "vehicleCount": 1, "avgSpeed": 91}, {"_id": 316, "REPORT_ID": 192893, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 103, "medianMeasuredTime": 103, "vehicleCount": 1, "avgSpeed": 32}, {"_id": 305, "REPORT_ID": 173225, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 0, "medianMeasuredTime": 0, "vehicleCount": 0, "avgSpeed": 0}, {"_id": 238, "REPORT_ID": 195472, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 94, "medianMeasuredTime": 94, "vehicleCount": 1, "avgSpeed": 36}, {"_id": 288, "REPORT_ID": 192520, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 135, "medianMeasuredTime": 135, "vehicleCount": 0, "avgSpeed": 60}, {"_id": 28, "REPORT_ID": 193106, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 153, "medianMeasuredTime": 153, "vehicleCount": 0, "avgSpeed": 19}, {"_id": 218, "REPORT_ID": 182846, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 63, "medianMeasuredTime": 63, "vehicleCount": 4, "avgSpeed": 37}, {"_id": 273, "REPORT_ID": 201291, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 71, "medianMeasuredTime": 71, "vehicleCount": 3, "avgSpeed": 46}, {"_id": 241, "REPORT_ID": 192627, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 40, "medianMeasuredTime": 40, "vehicleCount": 9, "avgSpeed": 55}, {"_id": 419, "REPORT_ID": 159043, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 33, "medianMeasuredTime": 33, "vehicleCount": 19, "avgSpeed": 77}, {"_id": 80, "REPORT_ID": 190691, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 45, "medianMeasuredTime": 45, "vehicleCount": 6, "avgSpeed": 70}, {"_id": 356, "REPORT_ID": 187430, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 123, "medianMeasuredTime": 123, "vehicleCount": 1, "avgSpeed": 26}, {"_id": 365, "REPORT_ID": 180764, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 19, "medianMeasuredTime": 19, "vehicleCount": 4, "avgSpeed": 54}, {"_id": 432, "REPORT_ID": 190583, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 30, "medianMeasuredTime": 30, "vehicleCount": 7, "avgSpeed": 73}, {"_id": 125, "REPORT_ID": 194931, "TIMESTAMP": "2019-04-05T20:23:00", "status": "OK", "avgMeasuredTime": 0, "medianMeasuredTime": 0, "vehicleCount": 0, "avgSpeed": 0}, {"_id": 45, "REPORT_ID": 194878, "TIMESTAMP": "2019-04-05T20:23:00", "status": "OK", "avgMeasuredTime": 0, "medianMeasuredTime": 0, "vehicleCount": 0, "avgSpeed": 0}, {"_id": 70, "REPORT_ID": 158836, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 0, "medianMeasuredTime": 0, "vehicleCount": 0, "avgSpeed": 0}, {"_id": 262, "REPORT_ID": 192734, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 109, "medianMeasuredTime": 109, "vehicleCount": 2, "avgSpeed": 29}, {"_id": 364, "REPORT_ID": 188039, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 51, "medianMeasuredTime": 51, "vehicleCount": 2, "avgSpeed": 35}, {"_id": 252, "REPORT_ID": 197922, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 68, "medianMeasuredTime": 68, "vehicleCount": 4, "avgSpeed": 59}, {"_id": 202, "REPORT_ID": 180818, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 91, "medianMeasuredTime": 91, "vehicleCount": 2, "avgSpeed": 19}, {"_id": 401, "REPORT_ID": 203848, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 142, "medianMeasuredTime": 142, "vehicleCount": 0, "avgSpeed": 33}, {"_id": 156, "REPORT_ID": 198275, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 38, "medianMeasuredTime": 38, "vehicleCount": 5, "avgSpeed": 47}, {"_id": 257, "REPORT_ID": 201775, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 103, "medianMeasuredTime": 103, "vehicleCount": 0, "avgSpeed": 27}, {"_id": 197, "REPORT_ID": 188172, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 55, "medianMeasuredTime": 55, "vehicleCount": 0, "avgSpeed": 36}, {"_id": 442, "REPORT_ID": 195896, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 82, "medianMeasuredTime": 82, "vehicleCount": 0, "avgSpeed": 53}, {"_id": 330, "REPORT_ID": 203530, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 89, "medianMeasuredTime": 89, "vehicleCount": 1, "avgSpeed": 45}, {"_id": 225, "REPORT_ID": 178548, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 82, "medianMeasuredTime": 82, "vehicleCount": 9, "avgSpeed": 35}, {"_id": 286, "REPORT_ID": 193185, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 62, "medianMeasuredTime": 62, "vehicleCount": 0, "avgSpeed": 33}, {"_id": 274, "REPORT_ID": 178713, "TIMESTAMP": "2019-04-05T20:22:00", "status": "OK", "avgMeasuredTime": 21, "medianMeasuredTime": 21, "vehicleCount": 11, "avgSpeed": 62}, {"_id": 9, "REPORT_ID": 183009, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 29, "medianMeasuredTime": 29, "vehicleCount": 10, "avgSpeed": 59}, {"_id": 42, "REPORT_ID": 187483, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 127, "medianMeasuredTime": 127, "vehicleCount": 1, "avgSpeed": 24}, {"_id": 439, "REPORT_ID": 194986, "TIMESTAMP": "2019-04-05T20:20:00", "status": "OK", "avgMeasuredTime": 114, "medianMeasuredTime": 114, "vehicleCount": 0, "avgSpeed": 58}], "_links": {"start": "/api/3/action/datastore_search?resource_id=b3eeb0ff-c8a8-4824-99d6-e0a3747c8b0d", "next": "/api/3/action/datastore_search?offset=100&resource_id=b3eeb0ff-c8a8-4824-99d6-e0a3747c8b0d"}, "total": 449}} \ No newline at end of file From 0a1708d7aaeb3239202336af7e9fb86425e28099 Mon Sep 17 00:00:00 2001 From: Alexander Munch-Hansen Date: Fri, 5 Apr 2019 22:36:11 +0200 Subject: [PATCH 2/2] traffic scraper mostly done --- server/nightr/scrape.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/server/nightr/scrape.py b/server/nightr/scrape.py index f985acb..559bcce 100644 --- a/server/nightr/scrape.py +++ b/server/nightr/scrape.py @@ -1,8 +1,32 @@ import requests +import json +import os + def scrape_traffic(): r = requests.get('https://portal.opendata.dk/api/3/action/datastore_search?resource_id=b3eeb0ff-c8a8-4824-99d6-e0a3747c8b0d') + night_avr = 3.38 + day_avr = None + data = r.json() - print(data) + sum = 0 + len = 0 + for lel in data['result']['records']: + sum += lel['vehicleCount'] + len += 1 + curr_avg = len / sum + + diff= day_avr - night_avr + + if curr_avg >= day_avr: + return 0.0 + elif curr_avg <= night_avr: + return 1.0 + res = 1 - curr_avg / diff + + assert(res < 1 and res > 0) + + return res + scrape_traffic() \ No newline at end of file