From a305c99de83e9664f8c89bbe5b04eda1a28126bf Mon Sep 17 00:00:00 2001 From: sosokker Date: Tue, 14 May 2024 01:03:43 +0700 Subject: [PATCH] Update docstring --- StreamServer/src/main.py | 4 ++-- StreamServer/src/routers/prediction.py | 1 + StreamServer/src/routers/recommend.py | 1 + StreamServer/src/routers/weather.py | 6 ++++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/StreamServer/src/main.py b/StreamServer/src/main.py index 06c8059..7acfbc6 100644 --- a/StreamServer/src/main.py +++ b/StreamServer/src/main.py @@ -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", diff --git a/StreamServer/src/routers/prediction.py b/StreamServer/src/routers/prediction.py index 01b6df9..5e7c803 100644 --- a/StreamServer/src/routers/prediction.py +++ b/StreamServer/src/routers/prediction.py @@ -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) diff --git a/StreamServer/src/routers/recommend.py b/StreamServer/src/routers/recommend.py index cd2dc02..f970d0a 100644 --- a/StreamServer/src/routers/recommend.py +++ b/StreamServer/src/routers/recommend.py @@ -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() diff --git a/StreamServer/src/routers/weather.py b/StreamServer/src/routers/weather.py index 42842bb..26fff91 100644 --- a/StreamServer/src/routers/weather.py +++ b/StreamServer/src/routers/weather.py @@ -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")