Skip to content

Commit

Permalink
Rename algorithm-system to algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
berrydenhartog committed Nov 15, 2024
1 parent 83511cb commit 8b1c139
Show file tree
Hide file tree
Showing 30 changed files with 223 additions and 263 deletions.
4 changes: 2 additions & 2 deletions amt/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
40 changes: 18 additions & 22 deletions amt/api/navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"),
Expand Down Expand Up @@ -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"
)


Expand Down
44 changes: 14 additions & 30 deletions amt/api/routes/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
],
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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}")
Expand Down Expand Up @@ -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")


# !!!
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions amt/api/routes/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] = []
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion amt/api/routes/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
54 changes: 25 additions & 29 deletions amt/locale/base.pot
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
Expand Down Expand Up @@ -44,7 +43,7 @@ msgstr ""
#: amt/api/group_by_category.py:15
#: amt/site/templates/algorithms/details_info.html.j2:24
#: amt/site/templates/algorithms/new.html.j2:40
#: amt/site/templates/parts/algorithm_search.html.j2:49
#: amt/site/templates/parts/algorithm_search.html.j2:48
#: amt/site/templates/parts/filter_list.html.j2:94
msgid "Lifecycle"
msgstr ""
Expand Down Expand Up @@ -90,7 +89,7 @@ msgid "Home"
msgstr ""

#: amt/api/navigation.py:46
msgid "Algorithm systems"
msgid "Algorithms"
msgstr ""

#: amt/api/navigation.py:47 amt/site/templates/auth/profile.html.j2:10
Expand Down Expand Up @@ -250,7 +249,7 @@ msgid "No"
msgstr ""

#: amt/site/templates/algorithms/details_base.html.j2:57
msgid "Delete algorithm system"
msgid "Delete algorithm"
msgstr ""

#: amt/site/templates/algorithms/details_base.html.j2:71
Expand Down Expand Up @@ -362,7 +361,7 @@ msgid "Repository"
msgstr ""

#: amt/site/templates/algorithms/details_info.html.j2:20
msgid "Algorithm system code"
msgid "Algorithm code"
msgstr ""

#: amt/site/templates/algorithms/details_info.html.j2:28
Expand Down Expand Up @@ -436,19 +435,21 @@ msgid "Edit"
msgstr ""

#: amt/site/templates/algorithms/new.html.j2:7
msgid "Create a Algorithm System"
msgid "Create a Algorithm"
msgstr ""

#: amt/site/templates/algorithms/new.html.j2:25
msgid "Algorithm System name"
#: amt/site/templates/parts/filter_list.html.j2:90
#: amt/site/templates/parts/filter_list.html.j2:116
msgid "Algorithm name"
msgstr ""

#: amt/site/templates/algorithms/new.html.j2:29
msgid "Name of the algorithm system"
msgid "Name of the algorithm"
msgstr ""

#: amt/site/templates/algorithms/new.html.j2:43
msgid "Select the lifecycle your algorithm system is currently in."
msgid "Select the lifecycle your algorithm is currently in."
msgstr ""

#: amt/site/templates/algorithms/new.html.j2:44
Expand Down Expand Up @@ -487,7 +488,7 @@ msgid "Choose one or more instruments"
msgstr ""

#: amt/site/templates/algorithms/new.html.j2:183
msgid "Create Algorithm System"
msgid "Create Algorithm"
msgstr ""

#: amt/site/templates/algorithms/new.html.j2:200
Expand Down Expand Up @@ -655,38 +656,38 @@ msgid "Model cards"
msgstr ""

#: amt/site/templates/parts/algorithm_search.html.j2:9
msgid "Algorithm Systems"
msgid "algorithms"
msgstr ""

#: amt/site/templates/parts/algorithm_search.html.j2:15
msgid "New algorithm system"
#: amt/site/templates/parts/algorithm_search.html.j2:14
msgid "New algorithm"
msgstr ""

#: amt/site/templates/parts/algorithm_search.html.j2:25
#: amt/site/templates/parts/algorithm_search.html.j2:24
msgid "Search"
msgstr ""

#: amt/site/templates/parts/algorithm_search.html.j2:32
msgid "Find algorithm system..."
#: amt/site/templates/parts/algorithm_search.html.j2:31
msgid "Find algorithm..."
msgstr ""

#: amt/site/templates/parts/algorithm_search.html.j2:54
#: amt/site/templates/parts/algorithm_search.html.j2:53
msgid "Select lifecycle"
msgstr ""

#: amt/site/templates/parts/algorithm_search.html.j2:63
#: amt/site/templates/parts/algorithm_search.html.j2:62
msgid "Category"
msgstr ""

#: amt/site/templates/parts/algorithm_search.html.j2:68
#: amt/site/templates/parts/algorithm_search.html.j2:67
msgid "Select publication category"
msgstr ""

#: amt/site/templates/parts/algorithm_search.html.j2:86
#: amt/site/templates/parts/algorithm_search.html.j2:85
msgid "Group by"
msgstr ""

#: amt/site/templates/parts/algorithm_search.html.j2:96
#: amt/site/templates/parts/algorithm_search.html.j2:95
msgid "Select group by"
msgstr ""

Expand All @@ -709,15 +710,10 @@ msgstr ""

#: amt/site/templates/parts/filter_list.html.j2:70
msgid ""
"No Algorithm system match your selected filters. Try adjusting your "
"filters or clearing them to\n"
"No Algorithm match your selected filters. Try adjusting your filters or "
"clearing them to\n"
" see more\n"
" algorithm systems."
msgstr ""

#: amt/site/templates/parts/filter_list.html.j2:90
#: amt/site/templates/parts/filter_list.html.j2:116
msgid "Algorithm system name"
" algorithms."
msgstr ""

#: amt/site/templates/parts/header.html.j2:7
Expand Down
Binary file modified amt/locale/en_US/LC_MESSAGES/messages.mo
Binary file not shown.
Loading

0 comments on commit 8b1c139

Please sign in to comment.