Skip to content

Commit 7296bda

Browse files
committed
hid region schema
1 parent 6737b1a commit 7296bda

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
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(

0 commit comments

Comments
 (0)