Merge branch 'main' of https://gitea.fhgr.ch/stoffelmauro/ConsultancyProject_2_ETL
commit
a571c8c40f
|
@ -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_movAverage as etl_rmA
|
||||||
from data import etl_region_properties_capacities as etl_rpc
|
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_capacities_comparison as etl_rcc
|
||||||
|
from data import etl_region_properties_capacities as etl_rpc
|
||||||
from fastapi import FastAPI, Response
|
from fastapi import FastAPI, Response
|
||||||
|
|
||||||
d = data.load()
|
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)
|
capacities = etl_rcc.region_capacities_comparison(id_1, id_2)
|
||||||
return capacities
|
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
|
|
||||||
|
|
|
@ -410,6 +410,20 @@ class Database:
|
||||||
p.id = {id}
|
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):
|
def properties_geo(self):
|
||||||
return self.connection.sql("""
|
return self.connection.sql("""
|
||||||
SELECT
|
SELECT
|
||||||
|
|
Loading…
Reference in New Issue