Update docstring

This commit is contained in:
sosokker 2024-05-14 01:03:43 +07:00
parent 7c8029635a
commit a305c99de8
4 changed files with 10 additions and 2 deletions

View File

@ -6,8 +6,8 @@ from routers import video, weather, prediction, camera, recommend, action
app = FastAPI(
title="Healthcare-System",
description="Hello Stranger.",
title="HomieCare",
description="API documentation for HomieCare, monitoring systems.",
root_path="/api/v1",
docs_url="/docs/swagger",
openapi_url="/docs/openapi.json",

View File

@ -40,6 +40,7 @@ def _fetch_data_from_api() -> dict:
@router.get("/indoor/predict/", response_model=list[PredictonTemperature])
async def get_tomorrow_indoor_temp(db: Session = Depends(get_db)):
"""Get tomorrow indoor temperature prediction data."""
result = get_temp_prediction_data(db)
if not result:
features = get_feature_prediction_data(db)

View File

@ -7,6 +7,7 @@ router = APIRouter()
@router.post("/recommendation/", response_model=list[RecommendationData])
async def get_health_recommendation(data: HealthData):
"""Provide health recommendations based on the provided health data."""
recommendation = []
current_time = datetime.now()

View File

@ -23,6 +23,7 @@ def get_db():
@router.get("/", response_model=list[WeatherDataBase])
async def get_latest_weather_data(db: Session = Depends(get_db)):
"""Get the latest weather data."""
weather_data = get_weather_data(db)
if not weather_data:
raise HTTPException(status_code=404, detail="Weather data not found")
@ -31,6 +32,7 @@ async def get_latest_weather_data(db: Session = Depends(get_db)):
@router.get("/{days}", response_model=list[WeatherDataBase])
async def get_weather_data_last_n_days(days: int, db: Session = Depends(get_db)):
"""Get the weather data for the last n days."""
weather_data = get_last_n_day_data(db, days)
if not weather_data:
raise HTTPException(status_code=404, detail=f"Weather data for the last {days} days not found")
@ -39,6 +41,7 @@ async def get_weather_data_last_n_days(days: int, db: Session = Depends(get_db))
@router.get("/indoor/{days}", response_model=list[IndoorDataBase])
async def get_indoor_data_last_n_days(days: int, db: Session = Depends(get_db)):
"""Get the indoor data for the last n days."""
indoor_data = get_indoor_data(db, days)
if not indoor_data:
raise HTTPException(status_code=404, detail=f"Indoor data for the last {days} days not found")
@ -46,6 +49,7 @@ async def get_indoor_data_last_n_days(days: int, db: Session = Depends(get_db)):
@router.get("/outdoor/{days}", response_model=list[OutdoorDataBase])
async def get_outdoor_data_last_n_days(days: int, db: Session = Depends(get_db)):
"""Get the outdoor data for the last n days."""
outdoor_data = get_outdoor_data(db, days)
if not outdoor_data:
raise HTTPException(status_code=404, detail="Outdoor data not found")
@ -54,6 +58,7 @@ async def get_outdoor_data_last_n_days(days: int, db: Session = Depends(get_db))
@router.get("/average/outdoor/{days}", response_model=AverageOutdoorData)
async def get_average_outdoor_data(days: int, db: Session = Depends(get_db)):
"""Get the average outdoor data for the last n days."""
average_outdoor_data = get_average_outdoor_data_last_n_day(db, days)
if not average_outdoor_data:
raise HTTPException(status_code=404, detail=f"Average outdoor data for the last {days} days not found")
@ -72,6 +77,7 @@ async def get_average_outdoor_data(days: int, db: Session = Depends(get_db)):
@router.get("/average/indoor/{days}", response_model=AverageIndoorData)
async def get_average_indoor_data(days: int, db: Session = Depends(get_db)):
"""Get the average indoor data for the last n days."""
average_indoor_data = get_average_indoor_data_last_n_day(db, days)
if not average_indoor_data:
raise HTTPException(status_code=404, detail=f"Average indoor data for the last {days} days not found")