mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
Merge pull request #544 from Hestia-Homes/eco-eligiblity-bug
Adding template for new routes
This commit is contained in:
commit
a3573e4b6e
4 changed files with 577 additions and 531 deletions
0
backend/app/whlg/__init__.py
Normal file
0
backend/app/whlg/__init__.py
Normal file
47
backend/app/whlg/route.py
Normal file
47
backend/app/whlg/route.py
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
import boto3
|
||||||
|
import json
|
||||||
|
import math
|
||||||
|
import asyncio
|
||||||
|
import random
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
from backend.app.dependencies import validate_token
|
||||||
|
from backend.app.plan.schemas import PlanTriggerRequest
|
||||||
|
from backend.app.config import get_settings
|
||||||
|
from sqlalchemy.orm import sessionmaker
|
||||||
|
from utils.logger import setup_logger
|
||||||
|
from backend.app.db.connection import db_engine
|
||||||
|
|
||||||
|
from backend.app.db.functions.recommendations_functions import create_scenario
|
||||||
|
|
||||||
|
logger = setup_logger()
|
||||||
|
|
||||||
|
router = APIRouter(
|
||||||
|
prefix="/whlg",
|
||||||
|
tags=["whlg"],
|
||||||
|
dependencies=[Depends(validate_token)],
|
||||||
|
responses={404: {"description": "Not found"}}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/")
|
||||||
|
async def whlg_entrypoint(body):
|
||||||
|
# body needs to include postcode, UPRN [task ID?]
|
||||||
|
#
|
||||||
|
# Refer to the plan trigger route for code
|
||||||
|
# 1) Create an event schema and store it in the schemas file
|
||||||
|
# 2) Build the tasks functions
|
||||||
|
# 3) Read in the funding csx. This can be found as such:
|
||||||
|
# whlg_eligible_postcodes = read_csv_from_s3(
|
||||||
|
# bucket_name=get_settings().DATA_BUCKET,
|
||||||
|
# filepath="funding/whlg eligible postcodes.csv",
|
||||||
|
# )
|
||||||
|
# whlg_eligible_postcodes = pd.DataFrame(whlg_eligible_postcodes)
|
||||||
|
# Check the postcode against this file
|
||||||
|
# We need to store this somewhere????!!!??!??!?!?!?!??!??!??!??!??!??!??!??!??!??! Create a new table!
|
||||||
|
# Update subtask to be complete
|
||||||
|
# Once this is complete, build the logs stuff, add the cloudwatch logs ID to the database
|
||||||
|
|
||||||
|
print("We're gonna do stuff!")
|
||||||
0
backend/app/whlg/schema.py
Normal file
0
backend/app/whlg/schema.py
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue