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 , 2024. # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" @@ -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 "" @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 "" @@ -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 diff --git a/amt/locale/en_US/LC_MESSAGES/messages.mo b/amt/locale/en_US/LC_MESSAGES/messages.mo index cffc12f4..83f4ad01 100644 Binary files a/amt/locale/en_US/LC_MESSAGES/messages.mo and b/amt/locale/en_US/LC_MESSAGES/messages.mo differ diff --git a/amt/locale/en_US/LC_MESSAGES/messages.po b/amt/locale/en_US/LC_MESSAGES/messages.po index 82c01db5..a4557055 100644 --- a/amt/locale/en_US/LC_MESSAGES/messages.po +++ b/amt/locale/en_US/LC_MESSAGES/messages.po @@ -45,7 +45,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 "" @@ -91,7 +91,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 @@ -251,7 +251,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 @@ -363,7 +363,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 @@ -437,19 +437,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 @@ -488,7 +490,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 @@ -656,38 +658,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 "" @@ -710,15 +712,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 diff --git a/amt/locale/nl_NL/LC_MESSAGES/messages.mo b/amt/locale/nl_NL/LC_MESSAGES/messages.mo index b7198fa6..e389e672 100644 Binary files a/amt/locale/nl_NL/LC_MESSAGES/messages.mo and b/amt/locale/nl_NL/LC_MESSAGES/messages.mo differ diff --git a/amt/locale/nl_NL/LC_MESSAGES/messages.po b/amt/locale/nl_NL/LC_MESSAGES/messages.po index a21b711f..b1807299 100644 --- a/amt/locale/nl_NL/LC_MESSAGES/messages.po +++ b/amt/locale/nl_NL/LC_MESSAGES/messages.po @@ -45,7 +45,7 @@ msgstr "Rol" #: 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 "Levenscyclus" @@ -91,8 +91,8 @@ msgid "Home" msgstr "Start" #: amt/api/navigation.py:46 -msgid "Algorithm systems" -msgstr "Algoritmesystemen" +msgid "Algorithms" +msgstr "Algoritmes" #: amt/api/navigation.py:47 amt/site/templates/auth/profile.html.j2:10 msgid "Overview" @@ -236,7 +236,7 @@ msgstr "" #: amt/site/templates/algorithms/details_base.html.j2:19 msgid "Delete algoritmic system" -msgstr "Verwijder Algoritmesysteem" +msgstr "Verwijder algoritme" #: amt/site/templates/algorithms/details_base.html.j2:26 msgid "Are you sure you want to delete your algoritmic system " @@ -261,8 +261,8 @@ msgid "No" msgstr "Nee" #: amt/site/templates/algorithms/details_base.html.j2:57 -msgid "Delete algorithm system" -msgstr "Verwijder Algoritmesysteem" +msgid "Delete algorithm" +msgstr "Verwijder algoritme" #: amt/site/templates/algorithms/details_base.html.j2:71 msgid "Does the algorithm meet the requirements?" @@ -373,8 +373,8 @@ msgid "Repository" msgstr "Repository" #: amt/site/templates/algorithms/details_info.html.j2:20 -msgid "Algorithm system code" -msgstr "Algoritmesysteem code" +msgid "Algorithm code" +msgstr "algoritme code" #: amt/site/templates/algorithms/details_info.html.j2:28 #: amt/site/templates/pages/assessment_card.html.j2:7 @@ -449,22 +449,22 @@ msgid "Edit" msgstr "Bewerk" #: amt/site/templates/algorithms/new.html.j2:7 -msgid "Create a Algorithm System" -msgstr "Creëer een Algoritmesysteem" +msgid "Create a Algorithm" +msgstr "Creëer een algoritme" #: amt/site/templates/algorithms/new.html.j2:25 -msgid "Algorithm System name" -msgstr "Algoritmesysteem naam" +#: amt/site/templates/parts/filter_list.html.j2:90 +#: amt/site/templates/parts/filter_list.html.j2:116 +msgid "Algorithm name" +msgstr "algoritme naam" #: amt/site/templates/algorithms/new.html.j2:29 -msgid "Name of the algorithm system" -msgstr "Nieuw algoritmesysteem" +msgid "Name of the algorithm" +msgstr "Nieuw algoritme" #: amt/site/templates/algorithms/new.html.j2:43 -msgid "Select the lifecycle your algorithm system is currently in." -msgstr "" -"Selecteer de levenscyclus waarin uw algoritmesysteem zich momenteel " -"bevindt." +msgid "Select the lifecycle your algorithm is currently in." +msgstr "Selecteer de levenscyclus waarin uw algoritme zich momenteel bevindt." #: amt/site/templates/algorithms/new.html.j2:44 msgid "For more information on lifecycle, read the" @@ -507,8 +507,8 @@ msgid "Choose one or more instruments" msgstr "Kies één of meerdere instrumenten" #: amt/site/templates/algorithms/new.html.j2:183 -msgid "Create Algorithm System" -msgstr "Creëer Algoritmesysteem" +msgid "Create Algorithm" +msgstr "Creëer algoritme" #: amt/site/templates/algorithms/new.html.j2:200 msgid "Copy results and close" @@ -682,38 +682,38 @@ msgid "Model cards" msgstr "Modelkaart" #: amt/site/templates/parts/algorithm_search.html.j2:9 -msgid "Algorithm Systems" +msgid "algorithms" msgstr "Algoritmesystemen" -#: amt/site/templates/parts/algorithm_search.html.j2:15 -msgid "New algorithm system" -msgstr "Nieuw algoritmesysteem" +#: amt/site/templates/parts/algorithm_search.html.j2:14 +msgid "New algorithm" +msgstr "Nieuw algoritme" -#: amt/site/templates/parts/algorithm_search.html.j2:25 +#: amt/site/templates/parts/algorithm_search.html.j2:24 msgid "Search" msgstr "Zoek" -#: amt/site/templates/parts/algorithm_search.html.j2:32 -msgid "Find algorithm system..." -msgstr "Vind algoritmesysteem..." +#: amt/site/templates/parts/algorithm_search.html.j2:31 +msgid "Find algorithm..." +msgstr "Vind algoritme..." -#: amt/site/templates/parts/algorithm_search.html.j2:54 +#: amt/site/templates/parts/algorithm_search.html.j2:53 msgid "Select lifecycle" msgstr "Selecteer levenscyclus" -#: amt/site/templates/parts/algorithm_search.html.j2:63 +#: amt/site/templates/parts/algorithm_search.html.j2:62 msgid "Category" msgstr "Categorie" -#: amt/site/templates/parts/algorithm_search.html.j2:68 +#: amt/site/templates/parts/algorithm_search.html.j2:67 msgid "Select publication category" msgstr "Selecteer publicatiecategorie" -#: amt/site/templates/parts/algorithm_search.html.j2:86 +#: amt/site/templates/parts/algorithm_search.html.j2:85 msgid "Group by" msgstr "Groeperen op" -#: amt/site/templates/parts/algorithm_search.html.j2:96 +#: amt/site/templates/parts/algorithm_search.html.j2:95 msgid "Select group by" msgstr "Selecteer groepering" @@ -742,19 +742,13 @@ msgstr "voor" #: 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." +" algorithms." msgstr "" -"Er zijn geen Algoritmesystemen die overeen komen met de geselecteerde " -"filters. Pas de filters aan of verwijder ze om meer algoritmesystemen te " -"zien." - -#: amt/site/templates/parts/filter_list.html.j2:90 -#: amt/site/templates/parts/filter_list.html.j2:116 -msgid "Algorithm system name" -msgstr "Algoritmesysteem naam" +"Er zijn geen Algoritmes die overeen komen met de geselecteerde filters. " +"Pas de filters aan of verwijder ze om meer algoritmes te zien." #: amt/site/templates/parts/header.html.j2:7 msgid "Beta Version" diff --git a/amt/migrations/versions/f6da4d6dd867_remove_project_table.py b/amt/migrations/versions/f6da4d6dd867_remove_project_table.py new file mode 100644 index 00000000..a285c095 --- /dev/null +++ b/amt/migrations/versions/f6da4d6dd867_remove_project_table.py @@ -0,0 +1,37 @@ +"""remove project table + +Revision ID: f6da4d6dd867 +Revises: ff46b7ecc348 +Create Date: 2024-11-15 11:30:25.352543 + +""" + +from collections.abc import Sequence + +import sqlalchemy as sa +from alembic import op +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision: str = "f6da4d6dd867" +down_revision: str | None = "ff46b7ecc348" +branch_labels: str | Sequence[str] | None = None +depends_on: str | Sequence[str] | None = None + + +def upgrade() -> None: + op.drop_table("project") + +def downgrade() -> None: + lifecycle_enum = postgresql.ENUM(name='lifecycle', create_type=False) + + op.create_table( + "project", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("name", sa.String(length=255), nullable=False), + sa.Column("lifecycle", lifecycle_enum, nullable=True), + sa.Column("last_edited", sa.DateTime(), server_default=sa.text("(CURRENT_TIMESTAMP)"), nullable=False), + sa.Column("system_card_json", sa.JSON(), nullable=False), + sa.Column("deleted_at", sa.DateTime(), nullable=True), + sa.PrimaryKeyConstraint("id", name="pk_project"), + ) diff --git a/amt/models/__init__.py b/amt/models/__init__.py index 6491ac32..9a921ea7 100644 --- a/amt/models/__init__.py +++ b/amt/models/__init__.py @@ -1,6 +1,5 @@ from .algorithm import Algorithm -from .project import Project from .task import Task from .user import User -__all__ = ["Task", "User", "Algorithm", "Project"] +__all__ = ["Task", "User", "Algorithm"] diff --git a/amt/models/project.py b/amt/models/project.py deleted file mode 100644 index fe5cf22b..00000000 --- a/amt/models/project.py +++ /dev/null @@ -1,97 +0,0 @@ -import json -from datetime import datetime -from enum import Enum -from typing import Any, TypeVar - -from sqlalchemy import String, func -from sqlalchemy.dialects.postgresql import ENUM -from sqlalchemy.orm import Mapped, mapped_column -from sqlalchemy.types import JSON - -from amt.api.lifecycles import Lifecycles -from amt.models.base import Base -from amt.schema.system_card import SystemCard - -T = TypeVar("T", bound="Project") - - -class CustomJSONEncoder(json.JSONEncoder): - def default(self, o: Any) -> Any: # noqa: ANN401 - if isinstance(o, datetime): - return o.isoformat() - if isinstance(o, Enum): - return o.name - return super().default(o) - - -class ProjectSystemCard(SystemCard): - def __init__(self, parent: "Project", **data: Any) -> None: # noqa: ANN401 - super().__init__(**data) - self._parent = parent - - def __setattr__(self, name: str, value: Any) -> None: # noqa: ANN401 - super().__setattr__(name, value) - if name != "_parent" and hasattr(self, "_parent"): - self._parent.sync_system_card() - - def __eq__(self, other: Any) -> bool: # noqa: ANN401 - if isinstance(other, ProjectSystemCard | SystemCard): - return self.model_dump(exclude={"_parent"}) == other.model_dump() - return False - - def model_dump(self, *args: Any, **kwargs: Any) -> dict[str, Any]: # noqa: ANN401 - exclude_unset = kwargs.pop("exclude_unset", False) - by_alias = kwargs.pop("by_alias", False) - exclude_none = kwargs.pop("exclude_none", False) - - dumped = super().model_dump( - *args, exclude_unset=exclude_unset, by_alias=by_alias, exclude_none=exclude_none, **kwargs - ) - - return json.loads(json.dumps(dumped, cls=CustomJSONEncoder)) - - -class Project(Base): - __tablename__ = "project" - - id: Mapped[int] = mapped_column(primary_key=True) - name: Mapped[str] = mapped_column(String(255)) - lifecycle: Mapped[Lifecycles | None] = mapped_column(ENUM(Lifecycles, name="lifecycle"), nullable=True) - system_card_json: Mapped[dict[str, Any]] = mapped_column(JSON, default=dict) - last_edited: Mapped[datetime] = mapped_column(server_default=func.now(), onupdate=func.now(), nullable=False) - deleted_at: Mapped[datetime | None] = mapped_column(server_default=None, nullable=True) - - def __init__(self, *args: Any, **kwargs: Any) -> None: # noqa: ANN401 - system_card: SystemCard | None = kwargs.pop("system_card", None) - super().__init__(*args, **kwargs) - self._system_card: ProjectSystemCard | None = None - if system_card is not None: - self.system_card = system_card - - @property - def system_card(self) -> ProjectSystemCard: - if not hasattr(self, "_system_card"): - self._system_card: ProjectSystemCard | None = None - - if self._system_card is None: - if self.system_card_json: - self._system_card = ProjectSystemCard(self, **self.system_card_json) - else: - self._system_card = ProjectSystemCard(self) - self.sync_system_card() - return self._system_card - - @system_card.setter - def system_card(self, value: SystemCard | None) -> None: - if value is None: - self._system_card = ProjectSystemCard(self) - else: - self._system_card = ProjectSystemCard(self, **value.model_dump(exclude_unset=True, by_alias=True)) - self.sync_system_card() - - def sync_system_card(self) -> None: - if self._system_card is not None: - self.system_card_json = self._system_card.model_dump(exclude_unset=True, by_alias=True) - - -Project.__mapper_args__ = {"exclude_properties": ["_system_card"]} diff --git a/amt/site/templates/algorithms/details_base.html.j2 b/amt/site/templates/algorithms/details_base.html.j2 index ded6d297..0fde8c53 100644 --- a/amt/site/templates/algorithms/details_base.html.j2 +++ b/amt/site/templates/algorithms/details_base.html.j2 @@ -33,7 +33,7 @@

diff --git a/amt/site/templates/algorithms/tasks.html.j2 b/amt/site/templates/algorithms/tasks.html.j2 index f29e9f6f..6e248c05 100644 --- a/amt/site/templates/algorithms/tasks.html.j2 +++ b/amt/site/templates/algorithms/tasks.html.j2 @@ -4,7 +4,7 @@ {% block detail_content %}
+ {% if loop.last and algorithms|length == limit %} data-marker="last-element" hx-get="/algorithms/?skip={{ next }}" hx-swap="beforeend" hx-trigger="revealed" {% endif %}> {% if show_lifecycles %} {% else %} {% endif %} {{ algorithm.name }} + href="/algorithm/{{ algorithm.id }}/details/">{{ algorithm.name }} {% if show_lifecycles %} diff --git a/amt/site/templates/pages/system_card.html.j2 b/amt/site/templates/pages/system_card.html.j2 index 39e1d4e2..12344ace 100644 --- a/amt/site/templates/pages/system_card.html.j2 +++ b/amt/site/templates/pages/system_card.html.j2 @@ -11,7 +11,7 @@ {% for assessment in system_card.assessments %}
  • + href="/algorithm/{{ algorithm_id }}/details/system_card/assessments/{{ assessment["name"].lower() }}"> @@ -29,7 +29,7 @@ {% for model in system_card.models %}
  • + href="/algorithm/{{ algorithm_id }}/details/system_card/models/{{ model["name"].lower() }}"> diff --git a/amt/site/templates/parts/algorithm_search.html.j2 b/amt/site/templates/parts/algorithm_search.html.j2 index fd9489fc..90252ece 100644 --- a/amt/site/templates/parts/algorithm_search.html.j2 +++ b/amt/site/templates/parts/algorithm_search.html.j2 @@ -1,18 +1,17 @@ @@ -29,9 +28,9 @@ class="utrecht-textbox utrecht-textbox--html-input" dir="auto" value="{{ search }}" - placeholder="{% trans %}Find algorithm system...{% endtrans %}" + placeholder="{% trans %}Find algorithm...{% endtrans %}" name="search" - hx-get="/algorithm-systems/?skip=0" + hx-get="/algorithms/?skip=0" hx-trigger="input changed delay:500ms, search" autocomplete="off" onfocus="this.value=''" /> @@ -39,7 +38,7 @@ role="img" aria-label="Kruis" hx-trigger="click" - hx-get="/algorithm-systems/?skip=0" + hx-get="/algorithms/?skip=0" hx-indicator=".htmx-indicator" hx-swap="innerHTML" onclick="document.getElementById('algorithm-search-input').value = ''"> @@ -88,7 +87,7 @@