Merge pull request #544 from Hestia-Homes/eco-eligiblity-bug

Adding template for new routes
This commit is contained in:
KhalimCK 2025-11-13 13:51:26 +00:00 committed by GitHub
commit a3573e4b6e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 577 additions and 531 deletions

View file

47
backend/app/whlg/route.py Normal file
View 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!")

View file

File diff suppressed because it is too large Load diff