diff --git a/etl/src/api/main.py b/etl/src/api/main.py index 6a68865..5f737a0 100644 --- a/etl/src/api/main.py +++ b/etl/src/api/main.py @@ -8,6 +8,7 @@ from data import etl_region_capacities as etl_rc from data import etl_region_movAverage as etl_rmA from data import etl_region_properties_capacities as etl_rpc from data import etl_region_capacities_comparison as etl_rcc +from data import etl_region_properties_capacities as etl_rpc from fastapi import FastAPI, Response d = data.load() @@ -81,7 +82,3 @@ def region_capacities_data(id_1: int, id_2: int): capacities = etl_rcc.region_capacities_comparison(id_1, id_2) return capacities -@app.get("/region/{id}/movingAverage/{startDate}") -def region_capacities_data(id: int, startDate: str): - result = etl_rmA.region_movingAverage(id, startDate) - return result diff --git a/etl/src/data/database.py b/etl/src/data/database.py index b8f322f..2d937b2 100644 --- a/etl/src/data/database.py +++ b/etl/src/data/database.py @@ -410,6 +410,20 @@ class Database: p.id = {id} """) + def region_base_data(self, id): + if id == -1: + where = '' + else: + where = f"WHERE r.id = {id}" + return self.connection.sql(f""" + SELECT + r.id as region_id, + r.name as region_name + FROM + consultancy_d.regions r + {where} + """) + def properties_geo(self): return self.connection.sql(""" SELECT