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 33cb365
Show file tree
Hide file tree
Showing 31 changed files with 231 additions and 281 deletions.
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"DEBUG": "True",
"AUTO_CREATE_SCHEMA": "True",
"ENVIRONMENT": "local",
"LOGGING_LEVEL": "DEBUG"
"LOGGING_LEVEL": "DEBUG",
"DISABLE_AUTH": "True"
}
},
{
Expand Down
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
Loading

0 comments on commit 33cb365

Please sign in to comment.