From 65a49dfb95fa3c57e22c9a2fa349cf0b29c39487 Mon Sep 17 00:00:00 2001 From: Alexander Munch-Hansen Date: Sun, 7 Apr 2019 00:01:06 +0200 Subject: [PATCH] pls --- server/nightr/app.py | 3 ++- server/nightr/strategies/parking_aarhus_2235.json | 1 + server/nightr/strategies/svm_strat.py | 2 -- 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 server/nightr/strategies/parking_aarhus_2235.json diff --git a/server/nightr/app.py b/server/nightr/app.py index ad3ce8f..e0f5d75 100644 --- a/server/nightr/app.py +++ b/server/nightr/app.py @@ -10,7 +10,7 @@ from typing import List import requests_cache from flask import Flask, jsonify, logging, request -from .strategies import miloStrats, iss, cars_in_traffic, tide_strat, upstairs_neighbour, bing, battery +from .strategies import miloStrats, iss, cars_in_traffic, tide_strat, upstairs_neighbour, bing, svm_strat, battery from .util import Context app = Flask(__name__) @@ -30,6 +30,7 @@ strategies = { "tide": tide_strat.is_tide, "upstairs_neighbour": upstairs_neighbour.check_games, "bing": bing.clock, + "svm_parking": svm_strat.perform_svm_pred, "battery_level": battery.battery_level, } diff --git a/server/nightr/strategies/parking_aarhus_2235.json b/server/nightr/strategies/parking_aarhus_2235.json new file mode 100644 index 0000000..00162db --- /dev/null +++ b/server/nightr/strategies/parking_aarhus_2235.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": "2a82a145-0195-4081-a13c-b0e587e9b89c", "fields": [{"type": "int", "id": "_id"}, {"type": "text", "id": "date"}, {"type": "text", "id": "garageCode"}, {"type": "int4", "id": "totalSpaces"}, {"type": "int4", "id": "vehicleCount"}], "records_format": "objects", "records": [{"_id": 1, "date": "2019/04/06 22:30:01", "garageCode": "NORREPORT", "totalSpaces": 80, "vehicleCount": 61}, {"_id": 2, "date": "2019/04/06 22:30:01", "garageCode": "SCANDCENTER", "totalSpaces": 1240, "vehicleCount": 442}, {"_id": 6, "date": "2019/04/06 22:30:01", "garageCode": "SALLING", "totalSpaces": 700, "vehicleCount": 290}, {"_id": 7, "date": "2019/04/06 22:30:01", "garageCode": "DOKK1", "totalSpaces": 1000, "vehicleCount": 0}, {"_id": 8, "date": "2019/04/06 22:30:01", "garageCode": "Navitas", "totalSpaces": 449, "vehicleCount": 161}, {"_id": 9, "date": "2019/04/06 22:30:01", "garageCode": "NewBusgadehuset", "totalSpaces": 105, "vehicleCount": 99}, {"_id": 3, "date": "2019/04/06 22:30:01", "garageCode": "BRUUNS", "totalSpaces": 953, "vehicleCount": 598}, {"_id": 4, "date": "2019/04/06 22:30:01", "garageCode": "MAGASIN", "totalSpaces": 378, "vehicleCount": 65}, {"_id": 5, "date": "2019/04/06 22:30:01", "garageCode": "KALKVAERKSVEJ", "totalSpaces": 210, "vehicleCount": 278}, {"_id": 10, "date": "2019/04/06 22:30:01", "garageCode": "Urban Level 1", "totalSpaces": 319, "vehicleCount": 32}, {"_id": 11, "date": "2019/04/06 22:30:01", "garageCode": "Urban Level 2+3", "totalSpaces": 654, "vehicleCount": 66}], "_links": {"start": "/api/3/action/datastore_search?resource_id=2a82a145-0195-4081-a13c-b0e587e9b89c", "next": "/api/3/action/datastore_search?offset=100&resource_id=2a82a145-0195-4081-a13c-b0e587e9b89c"}, "total": 11}} \ No newline at end of file diff --git a/server/nightr/strategies/svm_strat.py b/server/nightr/strategies/svm_strat.py index 0af7835..81d1569 100644 --- a/server/nightr/strategies/svm_strat.py +++ b/server/nightr/strategies/svm_strat.py @@ -5,11 +5,9 @@ import glob import json import numpy as np - from .strat_utils import write_json from ..util import Context, Prediction - def write_data(time): write_json("https://portal.opendata.dk/api/3/action/datastore_search?resource_id=2a82a145-0195-4081-a13c-b0e587e9b89c", "parking_aarhus", time)