From 140a9eb574c099f9eef8b73c63396818dd5f3a29 Mon Sep 17 00:00:00 2001 From: Alexander Munch-Hansen Date: Sat, 6 Apr 2019 13:38:39 +0200 Subject: [PATCH 1/2] More shit --- server/nightr/scrape.py | 78 +++++++++++++++++++++++++-- server/nightr/traffic_data_13_23.json | 1 + 2 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 server/nightr/traffic_data_13_23.json diff --git a/server/nightr/scrape.py b/server/nightr/scrape.py index 559bcce..092c613 100644 --- a/server/nightr/scrape.py +++ b/server/nightr/scrape.py @@ -1,6 +1,71 @@ import requests +from bs4 import BeautifulSoup +import pandas as pd +import urllib.request +from datetime import datetime, timedelta import json -import os + +def determine_month(): + ds = pd.read_excel(urllib.request.urlopen('https://sundogbaelt.dk/wp-content/uploads/2019/04/trafiktal-maaned.xls')) + + cur_year = 2019 + amount_of_cur_year = sum([x == cur_year for x in ds['År']]) + + cur_year_total = sum(ds['Total'][1:amount_of_cur_year+1]) + last_year_total = sum(ds['Total'][amount_of_cur_year+1:amount_of_cur_year+13]) + + return (12/(last_year_total//cur_year_total))+1 + +def is_tide(): + month = determine_month() + tide_data = requests.get('https://www.dmi.dk/fileadmin/user_upload/Bruger_upload/Tidevand/2019/Aarhus.t.txt') + lines = tide_data.text[570:].split('\n') + tuples = [x.split('\t') for x in lines] + lel = [[datetime.strptime(x[0], '%Y%m%d%H%M'), x[1]] for x in tuples[:-1]] + + matches = [[x[0], int(x[1])] for x in lel if x[0].month == month] + + all_the_data = requests.get('https://www.dmi.dk/NinJo2DmiDk/ninjo2dmidk?cmd=odj&stations=22331&datatype=obs') + current_water_level = json.loads(all_the_data.content)[0]['values'][-1]['value'] + + # Generate average of when the water is high + last_match = matches[0] + moments = [] + for idx, water_level in enumerate(matches[1:]): + #print(last_match[1], water_level[1]) + diff = abs(last_match[1]) + abs(water_level[1]) + time_diff = (water_level[0] - last_match[0]).seconds + + average_inc = time_diff/diff + average_delta = timedelta(seconds=average_inc) + + if last_match[1] < 0: # Increasing + time = last_match + while time[1] != current_water_level: + time[0] += average_delta + time[1] += 1 + + + elif last_match[1] > 0: # Decreasing + time = last_match + while time[1] != current_water_level: + time[0] += average_delta + time[1] -= 1 + + last_match = water_level + moments.append(time[0]) + + night = sum([1 for x in moments if 6 >= x.hour or x.hour >= 22]) + + return night / len(moments) + + +def tmp(): + r = requests.get('https://portal.opendata.dk/api/3/action/datastore_search?resource_id=b3eeb0ff-c8a8-4824-99d6-e0a3747c8b0d') + with open('traffic_data_13_23.json', 'w') as f: + json.dump(r.json(), f) + + def scrape_traffic(): @@ -23,10 +88,17 @@ def scrape_traffic(): 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 +def scrape_weather(): + r = requests.get('https://weather.com/weather/hourbyhour/l/99546:4:US') + soup = BeautifulSoup(r.content) + print(soup.find_all('td', {'class': 'temp'})[0]) + + + + diff --git a/server/nightr/traffic_data_13_23.json b/server/nightr/traffic_data_13_23.json new file mode 100644 index 0000000..341e118 --- /dev/null +++ b/server/nightr/traffic_data_13_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": 300, "REPORT_ID": 187695, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 117, "medianMeasuredTime": 117, "vehicleCount": 3, "avgSpeed": 22}, {"_id": 266, "REPORT_ID": 184839, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 76, "medianMeasuredTime": 76, "vehicleCount": 13, "avgSpeed": 23}, {"_id": 290, "REPORT_ID": 158595, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 110, "medianMeasuredTime": 110, "vehicleCount": 17, "avgSpeed": 93}, {"_id": 281, "REPORT_ID": 195923, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 80, "medianMeasuredTime": 80, "vehicleCount": 4, "avgSpeed": 67}, {"_id": 372, "REPORT_ID": 203689, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 124, "medianMeasuredTime": 124, "vehicleCount": 2, "avgSpeed": 45}, {"_id": 15, "REPORT_ID": 158324, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 59, "medianMeasuredTime": 59, "vehicleCount": 3, "avgSpeed": 62}, {"_id": 291, "REPORT_ID": 187854, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 132, "medianMeasuredTime": 132, "vehicleCount": 0, "avgSpeed": 24}, {"_id": 380, "REPORT_ID": 201319, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 49, "medianMeasuredTime": 49, "vehicleCount": 10, "avgSpeed": 39}, {"_id": 410, "REPORT_ID": 197814, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 117, "medianMeasuredTime": 117, "vehicleCount": 5, "avgSpeed": 40}, {"_id": 278, "REPORT_ID": 195365, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 48, "medianMeasuredTime": 48, "vehicleCount": 0, "avgSpeed": 57}, {"_id": 302, "REPORT_ID": 209854, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 79, "medianMeasuredTime": 79, "vehicleCount": 7, "avgSpeed": 61}, {"_id": 44, "REPORT_ID": 195178, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 93, "medianMeasuredTime": 93, "vehicleCount": 7, "avgSpeed": 31}, {"_id": 97, "REPORT_ID": 190529, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 31, "medianMeasuredTime": 31, "vehicleCount": 27, "avgSpeed": 61}, {"_id": 48, "REPORT_ID": 201507, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 97, "medianMeasuredTime": 97, "vehicleCount": 8, "avgSpeed": 39}, {"_id": 350, "REPORT_ID": 197328, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 74, "medianMeasuredTime": 74, "vehicleCount": 0, "avgSpeed": 49}, {"_id": 161, "REPORT_ID": 172602, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 0, "medianMeasuredTime": 0, "vehicleCount": 0, "avgSpeed": 0}, {"_id": 429, "REPORT_ID": 193430, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 0, "medianMeasuredTime": 0, "vehicleCount": 0, "avgSpeed": 0}, {"_id": 172, "REPORT_ID": 195817, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 91, "medianMeasuredTime": 91, "vehicleCount": 3, "avgSpeed": 31}, {"_id": 115, "REPORT_ID": 190934, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 101, "medianMeasuredTime": 101, "vehicleCount": 8, "avgSpeed": 49}, {"_id": 270, "REPORT_ID": 201589, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 640, "medianMeasuredTime": 640, "vehicleCount": 5, "avgSpeed": 73}, {"_id": 321, "REPORT_ID": 206237, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 66, "medianMeasuredTime": 66, "vehicleCount": 0, "avgSpeed": 25}, {"_id": 165, "REPORT_ID": 201615, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 630, "medianMeasuredTime": 630, "vehicleCount": 5, "avgSpeed": 74}, {"_id": 378, "REPORT_ID": 184675, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 83, "medianMeasuredTime": 83, "vehicleCount": 5, "avgSpeed": 50}, {"_id": 207, "REPORT_ID": 171572, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 165, "medianMeasuredTime": 165, "vehicleCount": 5, "avgSpeed": 26}, {"_id": 156, "REPORT_ID": 198275, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 53, "medianMeasuredTime": 53, "vehicleCount": 12, "avgSpeed": 34}, {"_id": 296, "REPORT_ID": 179038, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 27, "medianMeasuredTime": 27, "vehicleCount": 11, "avgSpeed": 48}, {"_id": 297, "REPORT_ID": 185237, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 60, "medianMeasuredTime": 60, "vehicleCount": 8, "avgSpeed": 50}, {"_id": 276, "REPORT_ID": 182766, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 106, "medianMeasuredTime": 106, "vehicleCount": 6, "avgSpeed": 46}, {"_id": 361, "REPORT_ID": 195764, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 112, "medianMeasuredTime": 112, "vehicleCount": 4, "avgSpeed": 30}, {"_id": 353, "REPORT_ID": 206290, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 51, "medianMeasuredTime": 51, "vehicleCount": 3, "avgSpeed": 38}, {"_id": 14, "REPORT_ID": 182901, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 43, "medianMeasuredTime": 43, "vehicleCount": 10, "avgSpeed": 58}, {"_id": 42, "REPORT_ID": 187483, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 238, "medianMeasuredTime": 238, "vehicleCount": 2, "avgSpeed": 12}, {"_id": 445, "REPORT_ID": 198330, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 125, "medianMeasuredTime": 125, "vehicleCount": 3, "avgSpeed": 35}, {"_id": 331, "REPORT_ID": 179202, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 74, "medianMeasuredTime": 74, "vehicleCount": 6, "avgSpeed": 25}, {"_id": 212, "REPORT_ID": 190232, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 69, "medianMeasuredTime": 69, "vehicleCount": 2, "avgSpeed": 25}, {"_id": 132, "REPORT_ID": 179418, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 55, "medianMeasuredTime": 55, "vehicleCount": 5, "avgSpeed": 57}, {"_id": 322, "REPORT_ID": 158954, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 0, "medianMeasuredTime": 0, "vehicleCount": 0, "avgSpeed": 0}, {"_id": 443, "REPORT_ID": 181168, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 32, "medianMeasuredTime": 32, "vehicleCount": 5, "avgSpeed": 57}, {"_id": 241, "REPORT_ID": 192627, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 82, "medianMeasuredTime": 82, "vehicleCount": 26, "avgSpeed": 27}, {"_id": 210, "REPORT_ID": 181277, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 52, "medianMeasuredTime": 52, "vehicleCount": 9, "avgSpeed": 35}, {"_id": 50, "REPORT_ID": 206131, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 45, "medianMeasuredTime": 45, "vehicleCount": 5, "avgSpeed": 40}, {"_id": 90, "REPORT_ID": 198167, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 88, "medianMeasuredTime": 88, "vehicleCount": 5, "avgSpeed": 38}, {"_id": 446, "REPORT_ID": 193000, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 113, "medianMeasuredTime": 113, "vehicleCount": 1, "avgSpeed": 27}, {"_id": 133, "REPORT_ID": 203557, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 153, "medianMeasuredTime": 153, "vehicleCount": 0, "avgSpeed": 45}, {"_id": 397, "REPORT_ID": 204300, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 46, "medianMeasuredTime": 46, "vehicleCount": 0, "avgSpeed": 41}, {"_id": 288, "REPORT_ID": 192520, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 168, "medianMeasuredTime": 168, "vehicleCount": 3, "avgSpeed": 48}, {"_id": 423, "REPORT_ID": 178739, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 25, "medianMeasuredTime": 25, "vehicleCount": 29, "avgSpeed": 52}, {"_id": 401, "REPORT_ID": 203848, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 125, "medianMeasuredTime": 125, "vehicleCount": 0, "avgSpeed": 37}, {"_id": 96, "REPORT_ID": 182875, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 41, "medianMeasuredTime": 41, "vehicleCount": 10, "avgSpeed": 61}, {"_id": 202, "REPORT_ID": 180818, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 69, "medianMeasuredTime": 69, "vehicleCount": 7, "avgSpeed": 26}, {"_id": 415, "REPORT_ID": 190367, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 199, "medianMeasuredTime": 199, "vehicleCount": 1, "avgSpeed": 55}, {"_id": 355, "REPORT_ID": 195525, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 54, "medianMeasuredTime": 54, "vehicleCount": 3, "avgSpeed": 35}, {"_id": 144, "REPORT_ID": 190879, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 83, "medianMeasuredTime": 83, "vehicleCount": 6, "avgSpeed": 48}, {"_id": 250, "REPORT_ID": 179390, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 38, "medianMeasuredTime": 38, "vehicleCount": 18, "avgSpeed": 61}, {"_id": 425, "REPORT_ID": 178821, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 78, "medianMeasuredTime": 78, "vehicleCount": 9, "avgSpeed": 48}, {"_id": 46, "REPORT_ID": 186979, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 148, "medianMeasuredTime": 148, "vehicleCount": 0, "avgSpeed": 20}, {"_id": 330, "REPORT_ID": 203530, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 381, "medianMeasuredTime": 381, "vehicleCount": 1, "avgSpeed": 10}, {"_id": 43, "REPORT_ID": 210040, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 480, "medianMeasuredTime": 480, "vehicleCount": 1, "avgSpeed": 18}, {"_id": 31, "REPORT_ID": 190259, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 69, "medianMeasuredTime": 69, "vehicleCount": 5, "avgSpeed": 38}, {"_id": 23, "REPORT_ID": 180627, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 85, "medianMeasuredTime": 85, "vehicleCount": 10, "avgSpeed": 61}, {"_id": 332, "REPORT_ID": 187244, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 140, "medianMeasuredTime": 140, "vehicleCount": 3, "avgSpeed": 16}, {"_id": 78, "REPORT_ID": 158983, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 0, "medianMeasuredTime": 0, "vehicleCount": 0, "avgSpeed": 0}, {"_id": 170, "REPORT_ID": 158715, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 0, "medianMeasuredTime": 0, "vehicleCount": 0, "avgSpeed": 0}, {"_id": 35, "REPORT_ID": 189967, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 185, "medianMeasuredTime": 185, "vehicleCount": 1, "avgSpeed": 16}, {"_id": 179, "REPORT_ID": 190609, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 36, "medianMeasuredTime": 36, "vehicleCount": 23, "avgSpeed": 60}, {"_id": 180, "REPORT_ID": 201643, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 147, "medianMeasuredTime": 147, "vehicleCount": 1, "avgSpeed": 71}, {"_id": 139, "REPORT_ID": 193322, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 95, "medianMeasuredTime": 95, "vehicleCount": 9, "avgSpeed": 42}, {"_id": 240, "REPORT_ID": 180872, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 56, "medianMeasuredTime": 56, "vehicleCount": 13, "avgSpeed": 31}, {"_id": 235, "REPORT_ID": 181197, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 79, "medianMeasuredTime": 79, "vehicleCount": 18, "avgSpeed": 23}, {"_id": 224, "REPORT_ID": 192653, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 40, "medianMeasuredTime": 40, "vehicleCount": 19, "avgSpeed": 55}, {"_id": 309, "REPORT_ID": 192972, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 118, "medianMeasuredTime": 118, "vehicleCount": 9, "avgSpeed": 37}, {"_id": 131, "REPORT_ID": 181006, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 52, "medianMeasuredTime": 52, "vehicleCount": 9, "avgSpeed": 41}, {"_id": 101, "REPORT_ID": 193402, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 78, "medianMeasuredTime": 78, "vehicleCount": 7, "avgSpeed": 50}, {"_id": 225, "REPORT_ID": 178548, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 77, "medianMeasuredTime": 77, "vehicleCount": 20, "avgSpeed": 37}, {"_id": 150, "REPORT_ID": 181251, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 52, "medianMeasuredTime": 52, "vehicleCount": 12, "avgSpeed": 35}, {"_id": 277, "REPORT_ID": 184972, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 40, "medianMeasuredTime": 40, "vehicleCount": 0, "avgSpeed": 41}, {"_id": 67, "REPORT_ID": 179364, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 47, "medianMeasuredTime": 47, "vehicleCount": 9, "avgSpeed": 49}, {"_id": 102, "REPORT_ID": 181142, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 82, "medianMeasuredTime": 82, "vehicleCount": 2, "avgSpeed": 22}, {"_id": 391, "REPORT_ID": 182792, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 111, "medianMeasuredTime": 111, "vehicleCount": 8, "avgSpeed": 44}, {"_id": 37, "REPORT_ID": 209880, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 82, "medianMeasuredTime": 82, "vehicleCount": 1, "avgSpeed": 70}, {"_id": 205, "REPORT_ID": 181223, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 44, "medianMeasuredTime": 44, "vehicleCount": 15, "avgSpeed": 42}, {"_id": 100, "REPORT_ID": 178847, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 80, "medianMeasuredTime": 80, "vehicleCount": 16, "avgSpeed": 47}, {"_id": 77, "REPORT_ID": 185104, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 79, "medianMeasuredTime": 79, "vehicleCount": 2, "avgSpeed": 24}, {"_id": 91, "REPORT_ID": 183037, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 123, "medianMeasuredTime": 123, "vehicleCount": 11, "avgSpeed": 33}, {"_id": 438, "REPORT_ID": 180709, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 67, "medianMeasuredTime": 67, "vehicleCount": 15, "avgSpeed": 52}, {"_id": 326, "REPORT_ID": 190908, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 98, "medianMeasuredTime": 98, "vehicleCount": 7, "avgSpeed": 50}, {"_id": 79, "REPORT_ID": 187880, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 98, "medianMeasuredTime": 98, "vehicleCount": 3, "avgSpeed": 31}, {"_id": 418, "REPORT_ID": 206051, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 80, "medianMeasuredTime": 80, "vehicleCount": 1, "avgSpeed": 25}, {"_id": 421, "REPORT_ID": 181088, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 66, "medianMeasuredTime": 66, "vehicleCount": 21, "avgSpeed": 31}, {"_id": 246, "REPORT_ID": 187642, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 146, "medianMeasuredTime": 146, "vehicleCount": 0, "avgSpeed": 17}, {"_id": 140, "REPORT_ID": 209986, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 132, "medianMeasuredTime": 132, "vehicleCount": 3, "avgSpeed": 71}, {"_id": 143, "REPORT_ID": 197626, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 127, "medianMeasuredTime": 127, "vehicleCount": 11, "avgSpeed": 45}, {"_id": 317, "REPORT_ID": 182738, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 57, "medianMeasuredTime": 57, "vehicleCount": 12, "avgSpeed": 38}, {"_id": 145, "REPORT_ID": 180735, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 76, "medianMeasuredTime": 76, "vehicleCount": 21, "avgSpeed": 45}, {"_id": 310, "REPORT_ID": 204247, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 66, "medianMeasuredTime": 66, "vehicleCount": 3, "avgSpeed": 32}, {"_id": 315, "REPORT_ID": 190126, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 270, "medianMeasuredTime": 270, "vehicleCount": 1, "avgSpeed": 19}, {"_id": 214, "REPORT_ID": 185369, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 118, "medianMeasuredTime": 118, "vehicleCount": 0, "avgSpeed": 22}, {"_id": 318, "REPORT_ID": 195711, "TIMESTAMP": "2019-04-06T11:20:00", "status": "OK", "avgMeasuredTime": 63, "medianMeasuredTime": 63, "vehicleCount": 4, "avgSpeed": 48}, {"_id": 386, "REPORT_ID": 178875, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 64, "medianMeasuredTime": 64, "vehicleCount": 6, "avgSpeed": 31}, {"_id": 230, "REPORT_ID": 180655, "TIMESTAMP": "2019-04-06T11:22:00", "status": "OK", "avgMeasuredTime": 57, "medianMeasuredTime": 57, "vehicleCount": 18, "avgSpeed": 57}], "_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 b6c361de973d87aec751d3ab7939dcd674d9b049 Mon Sep 17 00:00:00 2001 From: Alexander Munch-Hansen Date: Sat, 6 Apr 2019 13:41:05 +0200 Subject: [PATCH 2/2] Moved scraper --- server/nightr/{ => strategies}/scrape.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename server/nightr/{ => strategies}/scrape.py (100%) diff --git a/server/nightr/scrape.py b/server/nightr/strategies/scrape.py similarity index 100% rename from server/nightr/scrape.py rename to server/nightr/strategies/scrape.py