Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,7 @@ cython_debug/
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
# refer to https://docs.cursor.com/context/ignore-files
.cursorignore
.cursorindexingignore
.cursorindexingignore


.vscode/settings.json
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python-envs.pythonProjects": []
"python-envs.defaultEnvManager": "ms-python.python:conda",
"python-envs.defaultPackageManager": "ms-python.python:conda"
}
6 changes: 6 additions & 0 deletions app/platforms/implementations/openeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,18 @@ def _get_type_from_schemas(self, schemas: List[dict]) -> ParamTypeEnum:
subtype = schema.get("subtype")
if type == "array" and subtype == "temporal-interval":
return ParamTypeEnum.DATE_INTERVAL
elif type == "array" and schema.get("items", {}).get("type") == "string":
return ParamTypeEnum.ARRAY_STRING
elif subtype == "bounding-box":
return ParamTypeEnum.BOUNDING_BOX
elif subtype == "geojson":
return ParamTypeEnum.POLYGON
elif type == "boolean":
return ParamTypeEnum.BOOLEAN
elif type == "string":
return ParamTypeEnum.STRING
elif type == "integer" or type == "number":
return ParamTypeEnum.INTEGER

# If no matching schema found, raise an error
raise ValueError(f"Unsupported parameter schemas: {schemas}")
4 changes: 2 additions & 2 deletions app/routers/tiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def split_in_tiles(
raise de
except Exception as e:
logger.error(
f"An error occurred while calculating tiles for {payload.grid}: {e}"
f"An error occurred while calculating tiles for {payload.grid.value}: {e}"
)
raise InternalException(
message=f"An error occurred while calculating tiles for {payload.grid}"
message=f"An error occurred while calculating tiles for {payload.grid.value}"
)
3 changes: 3 additions & 0 deletions app/schemas/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
class ParamTypeEnum(str, Enum):
DATE_INTERVAL = "date-interval"
BOUNDING_BOX = "bounding-box"
POLYGON = "polygon"
BOOLEAN = "boolean"
INTEGER = "integer"
STRING = "string"
ARRAY_STRING = "array-string"


class ParamRequest(BaseModel):
Expand Down
52 changes: 48 additions & 4 deletions tests/platforms/test_openeo_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,11 @@ async def test_get_parameters_success(mock_udp_request, platform):
"description": "Test for a boolean flag parameter",
"schema": {"type": "boolean"},
},
{
"name": "polygon_test",
"description": "Test for a polygon parameter",
"schema": {"type": "object", "subtype": "geojson"},
},
{
"name": "bbox_test",
"description": "Test for a bbox parameter",
Expand All @@ -540,6 +545,21 @@ async def test_get_parameters_success(mock_udp_request, platform):
"description": "Test for a string parameter",
"schema": {"type": "string"},
},
{
"name": "int_test",
"description": "Test for a integer parameter",
"schema": {"type": "integer"},
},
{
"name": "array_string_test",
"description": "Test for an array of strings parameter",
"schema": {"type": "array", "items": {"type": "string"}},
},
{
"name": "number_test",
"description": "Test for a number parameter",
"schema": {"type": "number"},
},
]
mock_udp_request.return_value.json.return_value = {
"id": "process123",
Expand All @@ -563,22 +583,46 @@ async def test_get_parameters_success(mock_udp_request, platform):
Parameter(
name=udp_params[1]["name"],
description=udp_params[1]["description"],
type=ParamTypeEnum.BOUNDING_BOX,
type=ParamTypeEnum.POLYGON,
optional=False,
),
Parameter(
name=udp_params[2]["name"],
description=udp_params[2]["description"],
type=ParamTypeEnum.DATE_INTERVAL,
optional=True,
default=udp_params[2]["default"],
type=ParamTypeEnum.BOUNDING_BOX,
optional=False,
),
Parameter(
name=udp_params[3]["name"],
description=udp_params[3]["description"],
type=ParamTypeEnum.DATE_INTERVAL,
optional=True,
default=udp_params[3]["default"],
),
Parameter(
name=udp_params[4]["name"],
description=udp_params[4]["description"],
type=ParamTypeEnum.STRING,
optional=False,
),
Parameter(
name=udp_params[5]["name"],
description=udp_params[5]["description"],
type=ParamTypeEnum.INTEGER,
optional=False,
),
Parameter(
name=udp_params[6]["name"],
description=udp_params[6]["description"],
type=ParamTypeEnum.ARRAY_STRING,
optional=False,
),
Parameter(
name=udp_params[7]["name"],
description=udp_params[7]["description"],
type=ParamTypeEnum.INTEGER,
optional=False,
),
]
assert result == parameters

Expand Down
2 changes: 1 addition & 1 deletion tests/routers/test_upscale_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_upscaling_task_create_201(
r = client.post("/upscale_tasks", json=fake_upscaling_task_request.model_dump())
assert r.status_code == status.HTTP_201_CREATED
assert r.json() == fake_upscaling_task_summary.model_dump()
assert mock_create_processing_jobs.called_once()
mock_create_processing_jobs.assert_called_once()


@patch("app.routers.upscale_tasks.create_upscaling_task")
Expand Down
Loading