generated from MinBZK/python-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
362 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import logging | ||
from enum import Enum | ||
|
||
from fastapi import Request | ||
|
||
from amt.core.internationalization import get_current_translation | ||
from amt.schema.lifecycle import Lifecycle | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class Lifecycles(Enum): | ||
ORGANIZATIONAL_RESPONSIBILITIES = "ORGANIZATIONAL_RESPONSIBILITIES" | ||
PROBLEM_ANALYSIS = "PROBLEM_ANALYSIS" | ||
DESIGN = "DESIGN" | ||
DATA_EXPLORATION_AND_PREPARATION = "DATA_EXPLORATION_AND_PREPARATION" | ||
DEVELOPMENT = "DEVELOPMENT" | ||
VERIFICATION_AND_VALIDATION = "VERIFICATION_AND_VALIDATION" | ||
IMPLEMENTATION = "IMPLEMENTATION" | ||
MONITORING_AND_MANAGEMENT = "MONITORING_AND_MANAGEMENT" | ||
PHASING_OUT = "PHASING_OUT" | ||
|
||
|
||
def get_lifecycle(key: Lifecycles | None, request: Request) -> Lifecycle | None: | ||
""" | ||
Given the key and translation, returns the translated text. | ||
:param key: the key | ||
:param request: request to get the current language | ||
:return: a Lifecycle model with the correct translation | ||
""" | ||
|
||
if key is None: | ||
return None | ||
|
||
translations = get_current_translation(request) | ||
_ = translations.gettext | ||
# translations are determined at runtime, which is why we use the dictionary below | ||
keys = { | ||
Lifecycles.ORGANIZATIONAL_RESPONSIBILITIES: _("Organizational Responsibilities"), | ||
Lifecycles.PROBLEM_ANALYSIS: _("Problem Analysis"), | ||
Lifecycles.DESIGN: _("Design"), | ||
Lifecycles.DATA_EXPLORATION_AND_PREPARATION: _("Data Exploration and Preparation"), | ||
Lifecycles.DEVELOPMENT: _("Development"), | ||
Lifecycles.VERIFICATION_AND_VALIDATION: _("Verification and Validation"), | ||
Lifecycles.IMPLEMENTATION: _("Implementation"), | ||
Lifecycles.MONITORING_AND_MANAGEMENT: _("Monitoring and Management"), | ||
Lifecycles.PHASING_OUT: _("Phasing Out"), | ||
} | ||
return Lifecycle(id=key.value, name=keys[key]) | ||
|
||
|
||
def get_lifecycles(request: Request) -> list[Lifecycle | None]: | ||
lifecycles: list[Lifecycle | None] = [get_lifecycle(lifecycle, request) for lifecycle in Lifecycles] | ||
return lifecycles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: PROJECT VERSION\n" | ||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" | ||
"POT-Creation-Date: 2024-10-10 11:00+0200\n" | ||
"POT-Creation-Date: 2024-10-10 21:27+0200\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <[email protected]>\n" | ||
|
@@ -41,6 +41,42 @@ msgstr "" | |
msgid "Role" | ||
msgstr "" | ||
|
||
#: amt/api/lifecycles.py:39 | ||
msgid "Organizational Responsibilities" | ||
msgstr "" | ||
|
||
#: amt/api/lifecycles.py:40 | ||
msgid "Problem Analysis" | ||
msgstr "" | ||
|
||
#: amt/api/lifecycles.py:41 | ||
msgid "Design" | ||
msgstr "" | ||
|
||
#: amt/api/lifecycles.py:42 | ||
msgid "Data Exploration and Preparation" | ||
msgstr "" | ||
|
||
#: amt/api/lifecycles.py:43 | ||
msgid "Development" | ||
msgstr "" | ||
|
||
#: amt/api/lifecycles.py:44 | ||
msgid "Verification and Validation" | ||
msgstr "" | ||
|
||
#: amt/api/lifecycles.py:45 | ||
msgid "Implementation" | ||
msgstr "" | ||
|
||
#: amt/api/lifecycles.py:46 | ||
msgid "Monitoring and Management" | ||
msgstr "" | ||
|
||
#: amt/api/lifecycles.py:47 | ||
msgid "Phasing Out" | ||
msgstr "" | ||
|
||
#: amt/api/navigation.py:45 | ||
msgid "Home" | ||
msgstr "" | ||
|
@@ -97,7 +133,7 @@ msgstr "" | |
msgid "Model" | ||
msgstr "" | ||
|
||
#: amt/api/navigation.py:59 amt/site/templates/projects/new.html.j2:114 | ||
#: amt/api/navigation.py:59 amt/site/templates/projects/new.html.j2:134 | ||
msgid "Instruments" | ||
msgstr "" | ||
|
||
|
@@ -304,11 +340,31 @@ msgstr "" | |
msgid "Your project name here" | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/new.html.j2:35 | ||
#: amt/site/templates/projects/new.html.j2:37 | ||
msgid "Lifecycle" | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/new.html.j2:38 | ||
msgid "Select the lifecycle your project is currently in" | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/new.html.j2:38 | ||
msgid "Read" | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/new.html.j2:38 | ||
msgid "Algorithm Framework on lifecycles" | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/new.html.j2:38 | ||
msgid "for background information" | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/new.html.j2:55 | ||
msgid "AI Act Profile" | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/new.html.j2:37 | ||
#: amt/site/templates/projects/new.html.j2:57 | ||
msgid "" | ||
"The AI Act profile provides insight into, among other things, the type of" | ||
" AI system and the associated obligations from the European AI Act. If " | ||
|
@@ -317,33 +373,33 @@ msgid "" | |
"tree." | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/new.html.j2:42 | ||
#: amt/site/templates/projects/new.html.j2:62 | ||
msgid "Find your AI Act profile" | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/new.html.j2:97 | ||
#: amt/site/templates/projects/new.html.j2:117 | ||
msgid "Yes" | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/new.html.j2:107 | ||
#: amt/site/templates/projects/new.html.j2:127 | ||
msgid "No" | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/new.html.j2:116 | ||
#: amt/site/templates/projects/new.html.j2:136 | ||
msgid "" | ||
"Overview of instruments for the responsible development, deployment, " | ||
"assessment and monitoring of algorithms and AI-systems." | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/new.html.j2:124 | ||
#: amt/site/templates/projects/new.html.j2:144 | ||
msgid "Choose one or more instruments" | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/new.html.j2:138 | ||
#: amt/site/templates/projects/new.html.j2:158 | ||
msgid "Create Project" | ||
msgstr "" | ||
|
||
#: amt/site/templates/projects/new.html.j2:152 | ||
#: amt/site/templates/projects/new.html.j2:172 | ||
msgid "Copy results and close" | ||
msgstr "" | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.