From 46caa77047566dc0e34a8febb7a843859fb594b6 Mon Sep 17 00:00:00 2001
From: Berry den Hartog <38954346+berrydenhartog@users.noreply.github.com>
Date: Fri, 15 Nov 2024 11:54:57 +0000
Subject: [PATCH] Rename algorithm-system to algorithm
---
amt/api/main.py | 4 +-
amt/api/navigation.py | 40 ++++-----
amt/api/routes/algorithm.py | 44 +++-------
amt/api/routes/algorithms.py | 4 +-
amt/api/routes/auth.py | 2 +-
amt/locale/base.pot | 54 ++++++------
amt/locale/en_US/LC_MESSAGES/messages.mo | Bin 733 -> 733 bytes
amt/locale/en_US/LC_MESSAGES/messages.po | 53 ++++++-----
amt/locale/nl_NL/LC_MESSAGES/messages.mo | Bin 11958 -> 11716 bytes
amt/locale/nl_NL/LC_MESSAGES/messages.po | 82 ++++++++----------
.../f6da4d6dd867_remove_project_table.py | 21 ++---
.../templates/algorithms/details_base.html.j2 | 8 +-
.../templates/algorithms/details_info.html.j2 | 2 +-
.../algorithms/details_measure_modal.html.j2 | 2 +-
.../algorithms/details_requirements.html.j2 | 2 +-
amt/site/templates/algorithms/new.html.j2 | 12 +--
amt/site/templates/algorithms/tasks.html.j2 | 2 +-
amt/site/templates/macros/table_row.html.j2 | 4 +-
amt/site/templates/pages/system_card.html.j2 | 4 +-
.../templates/parts/algorithm_search.html.j2 | 17 ++--
amt/site/templates/parts/filter_list.html.j2 | 14 +--
tests/api/routes/test_algorithm.py | 60 +++++++------
tests/api/routes/test_algorithms.py | 24 +++--
tests/api/test_navigation.py | 6 +-
tests/core/test_exception_handlers.py | 12 +--
tests/e2e/test_create_algorithm.py | 6 +-
tests/e2e/test_move_task.py | 4 +-
tests/e2e/test_scroll_algorithm.py | 4 +-
tests/e2e/test_search_algorithm.py | 16 ++--
.../regression/e2e/test_duplicate_task_bug.py | 2 +-
.../templates/test_template_new_algorithm.py | 2 +-
31 files changed, 232 insertions(+), 275 deletions(-)
diff --git a/amt/api/main.py b/amt/api/main.py
index ec4321ec..f381b234 100644
--- a/amt/api/main.py
+++ b/amt/api/main.py
@@ -6,6 +6,6 @@
api_router.include_router(root.router)
api_router.include_router(health.router, prefix="/health", tags=["health"])
api_router.include_router(pages.router, prefix="/pages", tags=["pages"])
-api_router.include_router(algorithms.router, prefix="/algorithm-systems", tags=["algorithm-systems"])
-api_router.include_router(algorithm.router, prefix="/algorithm-system", tags=["algorithm-system"])
+api_router.include_router(algorithms.router, prefix="/algorithms", tags=["algorithms"])
+api_router.include_router(algorithm.router, prefix="/algorithm", tags=["algorithm"])
api_router.include_router(auth.router, prefix="/auth", tags=["auth"])
diff --git a/amt/api/navigation.py b/amt/api/navigation.py
index 088f6c0f..d1516168 100644
--- a/amt/api/navigation.py
+++ b/amt/api/navigation.py
@@ -22,7 +22,7 @@ class DisplayText(Enum):
ALGORITHM_DETAILS = "algorithm_details"
INFO = "info"
HOME = "home"
- ALGORITHMS = "algorithm systems"
+ ALGORITHMS = "algorithms"
OVERVIEW = "overview"
TASKS = "tasks"
NEW = "new"
@@ -43,7 +43,7 @@ def get_translation(key: DisplayText, translations: NullTranslations) -> str:
# translations are determined at runtime, which is why we use the dictionary below
keys = {
DisplayText.HOME: _("Home"),
- DisplayText.ALGORITHMS: _("Algorithm systems"),
+ DisplayText.ALGORITHMS: _("Algorithms"),
DisplayText.OVERVIEW: _("Overview"),
DisplayText.TASKS: _("Tasks"),
DisplayText.NEW: _("New"),
@@ -92,45 +92,41 @@ def get_display_text(self, translations: NullTranslations | None = None) -> str:
class Navigation:
ALGORITHMS_ROOT = BaseNavigationItem(
display_text=DisplayText.ALGORITHMS,
- url=["/algorithm-systems/", "/algorithm-system/"],
+ url=["/algorithms/", "/algorithm/"],
icon="rvo-icon-publicatie",
)
- ALGORITHMS_OVERVIEW = BaseNavigationItem(display_text=DisplayText.OVERVIEW, url="/algorithm-systems/")
- ALGORITHM_TASKS = BaseNavigationItem(
- display_text=DisplayText.TASKS, url="/algorithm-system/{algorithm_id}/details/tasks"
- )
+ ALGORITHMS_OVERVIEW = BaseNavigationItem(display_text=DisplayText.OVERVIEW, url="/algorithms/")
+ ALGORITHM_TASKS = BaseNavigationItem(display_text=DisplayText.TASKS, url="/algorithm/{algorithm_id}/details/tasks")
ALGORITHM_DETAILS = BaseNavigationItem(
- display_text=DisplayText.DETAILS, url="/algorithm-system/{algorithm_id}/details/system_card"
+ display_text=DisplayText.DETAILS, url="/algorithm/{algorithm_id}/details/system_card"
)
ALGORITHM_MODEL = BaseNavigationItem(
- display_text=DisplayText.MODEL, url="/algorithm-system/{algorithm_id}/details/model/inference"
- )
- ALGORITHM_NEW = BaseNavigationItem(display_text=DisplayText.NEW, url="/algorithm-systems/new")
- ALGORITHM_SYSTEM_INFO = BaseNavigationItem(
- display_text=DisplayText.INFO, url="/algorithm-system/{algorithm_id}/details"
+ display_text=DisplayText.MODEL, url="/algorithm/{algorithm_id}/details/model/inference"
)
- ALGORITHM_SYSTEM_ALGORITHM_DETAILS = BaseNavigationItem(
- display_text=DisplayText.ALGORITHM_DETAILS, url="/algorithm-system/{algorithm_id}/details/system_card"
+ ALGORITHM_NEW = BaseNavigationItem(display_text=DisplayText.NEW, url="/algorithms/new")
+ ALGORITHM_INFO = BaseNavigationItem(display_text=DisplayText.INFO, url="/algorithm/{algorithm_id}/details")
+ ALGORITHM_ALGORITHM_DETAILS = BaseNavigationItem(
+ display_text=DisplayText.ALGORITHM_DETAILS, url="/algorithm/{algorithm_id}/details/system_card"
)
ALGORITHM_SYSTEM_CARD = BaseNavigationItem(
- display_text=DisplayText.SYSTEMCARD, url="/algorithm-system/{algorithm_id}/details/system_card"
+ display_text=DisplayText.SYSTEMCARD, url="/algorithm/{algorithm_id}/details/system_card"
)
ALGORITHM_DATA_CARD = BaseNavigationItem(
- display_text=DisplayText.DATA, url="/algorithm-system/{algorithm_id}/details/system_card/data"
+ display_text=DisplayText.DATA, url="/algorithm/{algorithm_id}/details/system_card/data"
)
ALGORITHM_MODEL_CARD = BaseNavigationItem(
display_text=DisplayText.MODELCARD,
- url="/algorithm-system/{algorithm_id}/details/system_card/models/{model_card}",
+ url="/algorithm/{algorithm_id}/details/system_card/models/{model_card}",
)
ALGORITHM_ASSESSMENT_CARD = BaseNavigationItem(
display_text=DisplayText.ASSESSMENTCARD,
- url="/algorithm-system/{algorithm_id}/details/system_card/assessment/{assessment_card}",
+ url="/algorithm/{algorithm_id}/details/system_card/assessment/{assessment_card}",
)
ALGORITHM_REQUIREMENTS = BaseNavigationItem(
- display_text=DisplayText.REQUIREMENTS, url="/algorithm-system/{algorithm_id}/details/system_card/requirements"
+ display_text=DisplayText.REQUIREMENTS, url="/algorithm/{algorithm_id}/details/system_card/requirements"
)
- ALGORITHM_SYSTEM_INSTRUMENTS = BaseNavigationItem(
- display_text=DisplayText.INSTRUMENTS, url="/algorithm-system/{algorithm_id}/details/system_card/instruments"
+ ALGORITHM_INSTRUMENTS = BaseNavigationItem(
+ display_text=DisplayText.INSTRUMENTS, url="/algorithm/{algorithm_id}/details/system_card/instruments"
)
diff --git a/amt/api/routes/algorithm.py b/amt/api/routes/algorithm.py
index 8f79914f..423e453f 100644
--- a/amt/api/routes/algorithm.py
+++ b/amt/api/routes/algorithm.py
@@ -70,13 +70,13 @@ async def get_algorithm_or_error(
def get_algorithm_details_tabs(request: Request) -> list[NavigationItem]:
return resolve_navigation_items(
[
- Navigation.ALGORITHM_SYSTEM_INFO,
- Navigation.ALGORITHM_SYSTEM_ALGORITHM_DETAILS,
+ Navigation.ALGORITHM_INFO,
+ Navigation.ALGORITHM_ALGORITHM_DETAILS,
Navigation.ALGORITHM_MODEL,
Navigation.ALGORITHM_REQUIREMENTS,
Navigation.ALGORITHM_DATA_CARD,
Navigation.ALGORITHM_TASKS,
- Navigation.ALGORITHM_SYSTEM_INSTRUMENTS,
+ Navigation.ALGORITHM_INSTRUMENTS,
],
request,
)
@@ -114,9 +114,7 @@ async def get_tasks(
breadcrumbs = resolve_base_navigation_items(
[
Navigation.ALGORITHMS_ROOT,
- BaseNavigationItem(
- custom_display_text=algorithm.name, url="/algorithm-system/{algorithm_id}/details/system_card"
- ),
+ BaseNavigationItem(custom_display_text=algorithm.name, url="/algorithm/{algorithm_id}/details/system_card"),
Navigation.ALGORITHM_TASKS,
],
request,
@@ -193,9 +191,7 @@ async def get_algorithm_details(
breadcrumbs = resolve_base_navigation_items(
[
Navigation.ALGORITHMS_ROOT,
- BaseNavigationItem(
- custom_display_text=algorithm.name, url="/algorithm-system/{algorithm_id}/details/system_card"
- ),
+ BaseNavigationItem(custom_display_text=algorithm.name, url="/algorithm/{algorithm_id}/details/system_card"),
Navigation.ALGORITHM_DETAILS,
],
request,
@@ -287,9 +283,7 @@ async def get_system_card(
breadcrumbs = resolve_base_navigation_items(
[
Navigation.ALGORITHMS_ROOT,
- BaseNavigationItem(
- custom_display_text=algorithm.name, url="/algorithm-system/{algorithm_id}/details/system_card"
- ),
+ BaseNavigationItem(custom_display_text=algorithm.name, url="/algorithm/{algorithm_id}/details/system_card"),
Navigation.ALGORITHM_SYSTEM_CARD,
],
request,
@@ -319,7 +313,7 @@ async def get_algorithm_inference(
[
Navigation.ALGORITHMS_ROOT,
BaseNavigationItem(
- custom_display_text=algorithm.name, url="/algorithm-system/{algorithm_id}/details/model/inference"
+ custom_display_text=algorithm.name, url="/algorithm/{algorithm_id}/details/model/inference"
),
Navigation.ALGORITHM_MODEL,
],
@@ -359,9 +353,7 @@ async def get_system_card_requirements(
breadcrumbs = resolve_base_navigation_items(
[
Navigation.ALGORITHMS_ROOT,
- BaseNavigationItem(
- custom_display_text=algorithm.name, url="/algorithm-system/{algorithm_id}/details/system_card"
- ),
+ BaseNavigationItem(custom_display_text=algorithm.name, url="/algorithm/{algorithm_id}/details/system_card"),
Navigation.ALGORITHM_SYSTEM_CARD,
],
request,
@@ -440,7 +432,7 @@ async def delete_algorithm(
algorithms_service: Annotated[AlgorithmsService, Depends(AlgorithmsService)],
) -> HTMLResponse:
await algorithms_service.delete(algorithm_id)
- return templates.Redirect(request, "/algorithm-systems/")
+ return templates.Redirect(request, "/algorithms/")
@router.get("/{algorithm_id}/measure/{measure_urn}")
@@ -505,7 +497,7 @@ async def update_measure_value(
await algorithms_service.update(algorithm)
# TODO: FIX THIS!! The page now reloads at the top, which is annoying
- return templates.Redirect(request, f"/algorithm-system/{algorithm_id}/details/system_card/requirements")
+ return templates.Redirect(request, f"/algorithm/{algorithm_id}/details/system_card/requirements")
# !!!
@@ -528,9 +520,7 @@ async def get_system_card_data_page(
breadcrumbs = resolve_base_navigation_items(
[
Navigation.ALGORITHMS_ROOT,
- BaseNavigationItem(
- custom_display_text=algorithm.name, url="/algorithm-system/{algorithm_id}/details/system_card"
- ),
+ BaseNavigationItem(custom_display_text=algorithm.name, url="/algorithm/{algorithm_id}/details/system_card"),
Navigation.ALGORITHM_SYSTEM_CARD,
],
request,
@@ -568,9 +558,7 @@ async def get_system_card_instruments(
breadcrumbs = resolve_base_navigation_items(
[
Navigation.ALGORITHMS_ROOT,
- BaseNavigationItem(
- custom_display_text=algorithm.name, url="/algorithm-system/{algorithm_id}/details/system_card"
- ),
+ BaseNavigationItem(custom_display_text=algorithm.name, url="/algorithm/{algorithm_id}/details/system_card"),
Navigation.ALGORITHM_SYSTEM_CARD,
],
request,
@@ -606,9 +594,7 @@ async def get_assessment_card(
breadcrumbs = resolve_base_navigation_items(
[
Navigation.ALGORITHMS_ROOT,
- BaseNavigationItem(
- custom_display_text=algorithm.name, url="/algorithm-system/{algorithm_id}/details/system_card"
- ),
+ BaseNavigationItem(custom_display_text=algorithm.name, url="/algorithm/{algorithm_id}/details/system_card"),
Navigation.ALGORITHM_ASSESSMENT_CARD,
],
request,
@@ -657,9 +643,7 @@ async def get_model_card(
breadcrumbs = resolve_base_navigation_items(
[
Navigation.ALGORITHMS_ROOT,
- BaseNavigationItem(
- custom_display_text=algorithm.name, url="/algorithm-system/{algorithm_id}/details/system_card"
- ),
+ BaseNavigationItem(custom_display_text=algorithm.name, url="/algorithm/{algorithm_id}/details/system_card"),
Navigation.ALGORITHM_MODEL_CARD,
],
request,
diff --git a/amt/api/routes/algorithms.py b/amt/api/routes/algorithms.py
index c8920b28..3191d78f 100644
--- a/amt/api/routes/algorithms.py
+++ b/amt/api/routes/algorithms.py
@@ -69,7 +69,7 @@ async def get_root(
if display_type == "LIFECYCLE":
algorithms: dict[str, list[Algorithm]] = {}
- # When the lifecycle filter is active, only show these algorithm systems
+ # When the lifecycle filter is active, only show these algorithms
if "lifecycle" in filters:
for lifecycle in Lifecycles:
algorithms[lifecycle.name] = []
@@ -154,5 +154,5 @@ async def post_new(
algorithms_service: Annotated[AlgorithmsService, Depends(AlgorithmsService)],
) -> HTMLResponse:
algorithm = await algorithms_service.create(algorithm_new)
- response = templates.Redirect(request, f"/algorithm-system/{algorithm.id}/details/tasks")
+ response = templates.Redirect(request, f"/algorithm/{algorithm.id}/details/tasks")
return response
diff --git a/amt/api/routes/auth.py b/amt/api/routes/auth.py
index d8b71908..9e7d4ee5 100644
--- a/amt/api/routes/auth.py
+++ b/amt/api/routes/auth.py
@@ -72,7 +72,7 @@ async def auth_callback(
if user:
request.session["user"] = dict(user) # type: ignore
request.session["id_token"] = token["id_token"] # type: ignore
- return RedirectResponse(url="/algorithm-systems/")
+ return RedirectResponse(url="/algorithms/")
@router.get("/profile", response_class=Response)
diff --git a/amt/locale/base.pot b/amt/locale/base.pot
index 5b8f1a86..e23d34b6 100644
--- a/amt/locale/base.pot
+++ b/amt/locale/base.pot
@@ -3,7 +3,6 @@
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR