Skip to content

Commit 128650b

Browse files
committed
style: update route labels to be more descriptive
1 parent d9c1ec3 commit 128650b

File tree

2 files changed

+36
-22
lines changed

2 files changed

+36
-22
lines changed

backend/src/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
allow_headers=["*"],
1818
)
1919

20+
2021
@app.get("/")
2122
def read_root():
2223
return {"Hello": "World"}
2324

2425

2526
app.include_router(weather_router, prefix="/weather", tags=["Weather Data"])
26-
app.include_router(sat_index_router, prefix="/index", tags=["NDVI Data"])
27+
app.include_router(sat_index_router, prefix="/index", tags=["Vegetation Indices"])

backend/src/routes/sat_index_router.py

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
LocationName,
88
TemporalResolution,
99
Unit,
10-
IndexType
10+
IndexType,
1111
)
1212
from src.service import sat_index_service
1313
from src.utils.temporal import get_optimistic_rounding
@@ -22,18 +22,24 @@
2222

2323
@sat_index_router.get("/ndvi", response_model=NDVIResponse)
2424
async def get_ndvi_data(
25-
startDate: int = Query(...,
26-
description="Start date as UNIX timestamp in seconds"),
27-
endDate: int = Query(...,
28-
description="End date as UNIX timestamp in seconds"),
29-
location: LocationName = Query(..., description="Location name"),
25+
startDate: int = Query(
26+
...,
27+
description="First date of requested date range in UNIX timestamp as seconds",
28+
),
29+
endDate: int = Query(
30+
...,
31+
description="Last date of requested date range in UNIX timestamp as seconds",
32+
),
33+
location: LocationName = Query(..., description="Name of the requested location"),
3034
temporalResolution: TemporalResolution = Query(
31-
..., description="Temporal resolution"
35+
...,
36+
description="Time interval that a single data point should represent e.g. one month",
37+
),
38+
aggregation: AggregationMethod = Query(
39+
...,
40+
description="Method of aggregating available data into a single datapoint to represent the selected time interval e.g. mean average",
3241
),
33-
aggregation: AggregationMethod = Query(...,
34-
description="Aggregation method"),
3542
):
36-
3743
validate_timestamp_start_date_before_end_date(startDate, endDate)
3844
validate_timestamp_in_range_of_S2_imagery(startDate, endDate)
3945
start_date_dt = datetime.fromtimestamp(startDate, tz=timezone.utc)
@@ -49,7 +55,7 @@ async def get_ndvi_data(
4955
aggregation_method=aggregation,
5056
start_date=rounded_start_date,
5157
end_date=rounded_end_date,
52-
index_type=IndexType.NDVI
58+
index_type=IndexType.NDVI,
5359
)
5460

5561
response = {
@@ -66,20 +72,27 @@ async def get_ndvi_data(
6672

6773
return JSONResponse(content=response)
6874

75+
6976
@sat_index_router.get("/msavi", response_model=MSAVIResponse)
7077
async def get_msavi_data(
71-
startDate: int = Query(...,
72-
description="Start date as UNIX timestamp in seconds"),
73-
endDate: int = Query(...,
74-
description="End date as UNIX timestamp in seconds"),
75-
location: LocationName = Query(..., description="Location name"),
78+
startDate: int = Query(
79+
...,
80+
description="First date of requested date range in UNIX timestamp as seconds",
81+
),
82+
endDate: int = Query(
83+
...,
84+
description="Last date of requested date range in UNIX timestamp as seconds",
85+
),
86+
location: LocationName = Query(..., description="Name of the requested location"),
7687
temporalResolution: TemporalResolution = Query(
77-
..., description="Temporal resolution"
88+
...,
89+
description="Time interval that a single data point should represent e.g. one month",
90+
),
91+
aggregation: AggregationMethod = Query(
92+
...,
93+
description="Method of aggregating available data into a single datapoint to represent the selected time interval e.g. mean average",
7894
),
79-
aggregation: AggregationMethod = Query(...,
80-
description="Aggregation method"),
8195
):
82-
8396
validate_timestamp_start_date_before_end_date(startDate, endDate)
8497
validate_timestamp_in_range_of_S2_imagery(startDate, endDate)
8598
start_date_dt = datetime.fromtimestamp(startDate, tz=timezone.utc)
@@ -95,7 +108,7 @@ async def get_msavi_data(
95108
aggregation_method=aggregation,
96109
start_date=rounded_start_date,
97110
end_date=rounded_end_date,
98-
index_type=IndexType.MSAVI
111+
index_type=IndexType.MSAVI,
99112
)
100113

101114
response = {

0 commit comments

Comments
 (0)