feat(ml,backend): implemente le service de scoring et GET /predictions (#37)
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
from fastapi import APIRouter
|
||||
|
||||
from app.api.deps import LecteurDep, PredictionServiceDep
|
||||
from app.schemas.prediction import PredictionSummaryResponse
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get(
|
||||
"",
|
||||
response_model=PredictionSummaryResponse,
|
||||
summary="Dernière prédiction de consommation par site",
|
||||
)
|
||||
async def get_predictions(
|
||||
_: LecteurDep, service: PredictionServiceDep
|
||||
) -> PredictionSummaryResponse:
|
||||
resume = await service.summary()
|
||||
return PredictionSummaryResponse.model_validate(resume)
|
||||
@@ -5,6 +5,7 @@ from app.api.v1.endpoints import (
|
||||
alerts,
|
||||
auth,
|
||||
health,
|
||||
predictions,
|
||||
readings,
|
||||
recommendations,
|
||||
sensors,
|
||||
@@ -34,3 +35,6 @@ api_router.include_router(
|
||||
api_router.include_router(
|
||||
sensors.router, prefix="/sensors", tags=["sensors"], responses=REPONSES_ADMIN
|
||||
)
|
||||
api_router.include_router(
|
||||
predictions.router, prefix="/predictions", tags=["predictions"], responses=REPONSES_LECTEUR
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user