Skip to content

Commit d90a3b3

Browse files
Issue/hid swagger docs (#91)
* hid region schema * comment out regions section
1 parent 6737b1a commit d90a3b3

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

src/india_api/internal/service/regions.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class GetSourcesResponse(BaseModel):
3131
@router.get(
3232
"/sources",
3333
status_code=status.HTTP_200_OK,
34+
include_in_schema=False,
3435
)
3536
def get_sources_route(auth: dict = Depends(auth)) -> GetSourcesResponse:
3637
"""Function for the sources route."""
@@ -60,6 +61,7 @@ def validate_source(source: str) -> str:
6061
@router.get(
6162
"/{source}/regions",
6263
status_code=status.HTTP_200_OK,
64+
include_in_schema=False,
6365
)
6466
def get_regions_route(
6567
source: ValidSourceDependency,
@@ -85,6 +87,7 @@ class GetHistoricGenerationResponse(BaseModel):
8587
@router.get(
8688
"/{source}/{region}/generation",
8789
status_code=status.HTTP_200_OK,
90+
include_in_schema=False,
8891
)
8992
def get_historic_timeseries_route(
9093
source: ValidSourceDependency,
@@ -126,6 +129,7 @@ class GetForecastGenerationResponse(BaseModel):
126129
@router.get(
127130
"/{source}/{region}/forecast",
128131
status_code=status.HTTP_200_OK,
132+
include_in_schema=False,
129133
)
130134
def get_forecast_timeseries_route(
131135
source: ValidSourceDependency,
@@ -178,7 +182,9 @@ def get_forecast_timeseries_route(
178182

179183

180184
@router.get(
181-
"/{source}/{region}/forecast/csv", response_class=FileResponse
185+
"/{source}/{region}/forecast/csv",
186+
response_class=FileResponse,
187+
include_in_schema=False,
182188
)
183189
def get_forecast_da_csv(
184190
source: ValidSourceDependency,
@@ -191,7 +197,12 @@ def get_forecast_da_csv(
191197
"""
192198

193199
forcasts: GetForecastGenerationResponse = get_forecast_timeseries_route(
194-
source=source, region=region, db=db, auth=auth, forecast_horizon=ForecastHorizon.day_ahead, smooth_flag=False
200+
source=source,
201+
region=region,
202+
db=db,
203+
auth=auth,
204+
forecast_horizon=ForecastHorizon.day_ahead,
205+
smooth_flag=False,
195206
)
196207

197208
# format to dataframe
@@ -202,8 +213,10 @@ def get_forecast_da_csv(
202213
tomorrow_ist = df["Date [IST]"].iloc[0]
203214
csv_file_path = f"{region}_{source}_da_{tomorrow_ist}.csv"
204215

205-
description = f"Forecast for {region} for {source} for {tomorrow_ist}. " \
206-
f"The Forecast was created at {created_time} and downloaded at {now_ist}"
216+
description = (
217+
f"Forecast for {region} for {source} for {tomorrow_ist}. "
218+
f"The Forecast was created at {created_time} and downloaded at {now_ist}"
219+
)
207220

208221
output = df.to_csv(index=False)
209222
return StreamingResponse(

src/india_api/internal/service/server.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@
2828
"Each site will have one source of energy "
2929
"and there is forecast and generation data for each site. ",
3030
},
31-
{
32-
"name": "Regions",
33-
"description": "A region is an area of land e.g. Alaska in the USA. "
34-
"There is forecast and generation data for each region "
35-
"and there may be different sources of energy in one region.",
36-
},
31+
# I want to keep this here, as we might add this back in the future
32+
# {
33+
# "name": "Regions",
34+
# "description": "A region is an area of land e.g. Alaska in the USA. "
35+
# "There is forecast and generation data for each region "
36+
# "and there may be different sources of energy in one region.",
37+
# },
3738
]
3839

3940
title = "India API"

0 commit comments

Comments
 (0)