Skip to content

Commit

Permalink
Refactor all mentions of TAD to AMT
Browse files Browse the repository at this point in the history
  • Loading branch information
laurensWe committed Jul 23, 2024
1 parent 28a0104 commit c6f1409
Show file tree
Hide file tree
Showing 162 changed files with 318 additions and 274 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"DEVCONTAINER": "1",
"PYTHONASYNCIODEBUG": "1",
"POETRY_VIRTUALENVS_CREATE": "false",
"PYTHONPATH": "/workspaces/tad/"
"PYTHONPATH": "/workspaces/amt/"
},
"remoteUser": "root",
"features": {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ jobs:
- name: Make changes to project to inject commit hash
run: |
sed -i 's/VERSION: str = .*$/VERSION: str = "${{ steps.get_commit_hash.outputs.commit_hash }}"/g' tad/core/config.py
sed -i 's/VERSION: str = .*$/VERSION: str = "${{ steps.get_commit_hash.outputs.commit_hash }}"/g' amt/core/config.py
- name: Log in to the Container registry
uses: docker/login-action@v3
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Get GHCR package hash
id: get_package_hash
run: |
container_id=$(gh api --paginate -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /orgs/MinBZK/packages/container/tad/versions | jq -r '.[] | select(.metadata.container.tags | contains(["${{ inputs.image_tag }}"])) | .name')
container_id=$(gh api --paginate -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /orgs/MinBZK/packages/container/amt/versions | jq -r '.[] | select(.metadata.container.tags | contains(["${{ inputs.image_tag }}"])) | .name')
echo "container_id=$container_id" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -53,16 +53,16 @@ jobs:
- name: Make changes to the file
run: |
sed -i 's/newTag: .*$/newTag: ${{inputs.image_tag }}@${{ steps.get_package_hash.outputs.container_id }}/g' apps/tad/overlays/${{ inputs.environment }}/kustomization.yaml
sed -i 's|minbzk.github.io/version: .*$|minbzk.github.io/version: ${{ inputs.image_tag }}|g' apps/tad/overlays/${{ inputs.environment }}/kustomization.yaml
git add apps/tad/overlays/${{ inputs.environment }}/kustomization.yaml
sed -i 's/newTag: .*$/newTag: ${{inputs.image_tag }}@${{ steps.get_package_hash.outputs.container_id }}/g' apps/amt/overlays/${{ inputs.environment }}/kustomization.yaml
sed -i 's|minbzk.github.io/version: .*$|minbzk.github.io/version: ${{ inputs.image_tag }}|g' apps/amt/overlays/${{ inputs.environment }}/kustomization.yaml
git add apps/amt/overlays/${{ inputs.environment }}/kustomization.yaml
- name: show changes
run: git diff --staged

- name: push changes
run: |
git commit -m "Update tad overlay ${{ inputs.environment }} tag ${{ steps.get_package_hash.outputs.container_id }}"
git commit -m "Update amt overlay ${{ inputs.environment }} tag ${{ steps.get_package_hash.outputs.container_id }}"
git push --force-with-lease
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ pytestdebug.log
# macos
.DS_Store

# tad tool
tad.log*
# amt tool
amt.log*
database.sqlite3
output/

Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
rev: v4.6.0
hooks:
- id: end-of-file-fixer
exclude: ^tad/static/vendor/.*
exclude: ^amt/static/vendor/.*
- id: trailing-whitespace
- id: check-yaml
exclude: example/
Expand All @@ -23,7 +23,7 @@ repos:
hooks:
- id: check-modified-migrations
name: check-modified-migrations
entry: sh -c '! git diff --cached --name-only --diff-filter=MD | grep ^tad/migrations/versions'
entry: sh -c '! git diff --cached --name-only --diff-filter=MD | grep ^amt/migrations/versions'
language: system
pass_filenames: false
always_run: true
Expand Down
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": "0.2.0",
"configurations": [
{
"name": "tad - fastapi",
"name": "amt - fastapi",
"type": "debugpy",
"request": "launch",
"module": "uvicorn",
Expand All @@ -13,7 +13,7 @@
"--reload",
"--port",
"8000",
"tad.server:app"
"amt.server:app"
],
"cwd": "${workspaceFolder}/",
"env": {
Expand Down
16 changes: 8 additions & 8 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Buiding TAD
# Buiding AMT

There are several ways to build and run TAD.
There are several ways to build and run AMT.

1. Poetry
2. Container

## Building TAD with Poetry
## Building AMT with Poetry

Poetry is a Python package and dependency manager. Before you can install Poetry you first need to install Python. Please follow [these](https://github.com/pyenv/pyenv?tab=readme-ov-file#installation) instructions.
Poetry is a Python package and dependency manager. Before you can install Poetry you first need to install Python. Please follow [these](https://github.com/pyenv/pyenv?amt=readme-ov-file#installation) instructions.

Once you have Python available you can install Poetry. See [here](https://python-poetry.org/docs/#installation).

Expand All @@ -20,7 +20,7 @@ poetry install
When poetry is done installing all dependencies you can start using the tool.

```shell
poetry run python -m uvicorn tad.main:app --log-level warning
poetry run python -m uvicorn amt.main:app --log-level warning
```

### Suggested development ENVIRONMENT settings
Expand All @@ -34,21 +34,21 @@ export ENVIRONMENT=demo AUTO_CREATE_SCHEMA=true

We support most SQL database types. You can use the variable `APP_DATABASE_SCHEME` to change the database. The default scheme is sqlite.

If you change the `models` at tad/models of the application you can generate a new migration file
If you change the `models` at amt/models of the application you can generate a new migration file

```shell
alembic revision --autogenerate -m "a message"
```

Please make sure you check the auto generated file in tad/migrations/
Please make sure you check the auto generated file in amt/migrations/

to upgrade to the latest version of the database schema use

```shell
alembic upgrade head
```

## Building TAD with Containers
## Building AMT with Containers

Containers allows to package software, make it portable, and isolated. Before you can run a container you first need a container runtime. There are several available, but al lot of users use [docker desktop](https://www.docker.com/products/docker-desktop/).

Expand Down
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LABEL [email protected] \
organization=MinBZK \
license=EUPL-1.2 \
org.opencontainers.image.description="Transparency of Algorithmic Decision making" \
org.opencontainers.image.source=https://github.com/MinBZK/tad \
org.opencontainers.image.source=https://github.com/MinBZK/amt \
org.opencontainers.image.licenses=EUPL-1.2

ENV PYTHONUNBUFFERED=1 \
Expand All @@ -32,7 +32,7 @@ ENV PATH="/app/.venv/bin:$PATH"

FROM project-base AS development

COPY ./tad/ ./tad/
COPY amt/ ./amt/
COPY ./tests/ ./tests/
COPY ./script/ ./script/
COPY ./README.md ./README.md
Expand All @@ -50,20 +50,20 @@ RUN coverage report

FROM project-base AS production

RUN groupadd tad && \
adduser --uid 100 --system --ingroup tad tad
RUN groupadd amt && \
adduser --uid 100 --system --ingroup amt amt

#todo(berry): create log folder so permissions can be set to root:root
# currenlt problem is that i could not get the logger to accept a path in the filerotate handler
RUN chown tad:tad /app/
RUN chown amt:amt /app/

USER tad
USER amt

COPY --chown=root:root --chmod=755 ./tad /app/tad
COPY --chown=root:root --chmod=755 amt /app/amt
COPY --chown=root:root --chmod=755 alembic.ini /app/alembic.ini
COPY --chown=root:root --chmod=755 prod.env /app/.env
COPY --chown=root:root --chmod=755 LICENSE /app/LICENSE
COPY --chown=tad:tad --chmod=755 docker-entrypoint.sh /app/docker-entrypoint.sh
COPY --chown=amt:amt --chmod=755 docker-entrypoint.sh /app/docker-entrypoint.sh

ENV PYTHONPATH=/app/
WORKDIR /app/
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Transparency of Algorithmic Decision making (TAD)
# Algorithm Management Toolkit (AMT)

![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/minbzk/tad/ci.yml?label=tests)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=MinBZK_tad&metric=coverage)](https://sonarcloud.io/summary/new_code?id=MinBZK_tad)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=MinBZK_tad&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=MinBZK_tad)
![GitHub Release](https://img.shields.io/github/v/release/minbzk/tad?include_prereleases&sort=semver)
![GitHub License](https://img.shields.io/github/license/minbzk/tad)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=MinBZK_tad&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=MinBZK_tad)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/minbzk/amt/ci.yml?label=tests)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=MinBZK_amt&metric=coverage)](https://sonarcloud.io/summary/new_code?id=MinBZK_amt)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=MinBZK_amt&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=MinBZK_amt)
![GitHub Release](https://img.shields.io/github/v/release/minbzk/amt?include_prereleases&sort=semver)
![GitHub License](https://img.shields.io/github/license/minbzk/amt)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=MinBZK_amt&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=MinBZK_amt)

TAD is a modern tool to apply technical and non-technical tests for an AI model.
AMT is a modern tool to apply technical and non-technical tests for an AI model.

Note: The main branch may be in an unstable or even broken state during development. Please use releases instead of the main branch.

## How to contribute

See [contributing docs](CONTRIBUTING.md)

## How to build and run TAD
## How to build and run AMT

See [build docs](BUILD.md)

Expand Down
2 changes: 1 addition & 1 deletion alembic.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[alembic]
# path to migration scripts
script_location = tad/migrations
script_location = amt/migrations

# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
# Uncomment the line below if you want the files to be prepended with date and time
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tad/__main__.py → amt/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from tad.cli import check_state
from amt.cli import check_state

if __name__ == "__main__":
check_state.get_tasks_by_priority()
File renamed without changes.
6 changes: 3 additions & 3 deletions tad/api/deps.py → amt/api/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from starlette.background import BackgroundTask
from starlette.templating import _TemplateResponse # pyright: ignore [reportPrivateUsage]

from tad.core.config import VERSION, get_settings
from tad.core.internationalization import (
from amt.core.config import VERSION, get_settings
from amt.core.internationalization import (
format_datetime,
get_dynamic_field_translations,
get_requested_language,
Expand Down Expand Up @@ -74,6 +74,6 @@ def Redirect(self, request: Request, url: str) -> HTMLResponse:


templates = LocaleJinja2Templates(
directory="tad/site/templates/", context_processors=[custom_context_processor], undefined=get_undefined_behaviour()
directory="amt/site/templates/", context_processors=[custom_context_processor], undefined=get_undefined_behaviour()
)
templates.env.filters["format_datetime"] = format_datetime # pyright: ignore [reportUnknownMemberType]
2 changes: 1 addition & 1 deletion tad/api/main.py → amt/api/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from fastapi import APIRouter

from tad.api.routes import health, pages, project, projects, root, tasks
from amt.api.routes import health, pages, project, projects, root, tasks

api_router = APIRouter()
api_router.include_router(root.router)
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions tad/api/routes/pages.py → amt/api/routes/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from fastapi import APIRouter, Depends, Request
from fastapi.responses import HTMLResponse

from tad.api.deps import templates
from tad.services.statuses import StatusesService
from tad.services.tasks import TasksService
from amt.api.deps import templates
from amt.services.statuses import StatusesService
from amt.services.tasks import TasksService

router = APIRouter()

Expand Down
8 changes: 4 additions & 4 deletions tad/api/routes/project.py → amt/api/routes/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from fastapi import APIRouter, Depends, Request
from fastapi.responses import HTMLResponse

from tad.api.deps import templates
from tad.services.projects import ProjectsService
from tad.services.statuses import StatusesService
from tad.services.tasks import TasksService
from amt.api.deps import templates
from amt.services.projects import ProjectsService
from amt.services.statuses import StatusesService
from amt.services.tasks import TasksService

router = APIRouter()
logger = logging.getLogger(__name__)
Expand Down
8 changes: 4 additions & 4 deletions tad/api/routes/projects.py → amt/api/routes/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from fastapi import APIRouter, Depends, Request
from fastapi.responses import HTMLResponse

from tad.api.deps import templates
from tad.schema.project import ProjectNew
from tad.services.instruments import InstrumentsService
from tad.services.projects import ProjectsService
from amt.api.deps import templates
from amt.schema.project import ProjectNew
from amt.services.instruments import InstrumentsService
from amt.services.projects import ProjectsService

router = APIRouter()
logger = logging.getLogger(__name__)
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions tad/api/routes/tasks.py → amt/api/routes/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from fastapi import APIRouter, Depends, Request
from fastapi.responses import HTMLResponse

from tad.api.deps import templates
from tad.schema.task import MovedTask
from tad.services.tasks import TasksService
from amt.api.deps import templates
from amt.schema.task import MovedTask
from amt.services.tasks import TasksService

router = APIRouter()

Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions tad/cli/check_state.py → amt/cli/check_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import click
import yaml

from tad.schema.assessment_card import AssessmentCard
from tad.schema.instrument import Instrument, InstrumentTask
from tad.schema.system_card import SystemCard
from tad.services.instruments import InstrumentsService
from tad.services.storage import StorageFactory
from amt.schema.assessment_card import AssessmentCard
from amt.schema.instrument import Instrument, InstrumentTask
from amt.schema.system_card import SystemCard
from amt.services.instruments import InstrumentsService
from amt.services.storage import StorageFactory

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion tad/clients/github.py → amt/clients/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from datetime import datetime, timezone

import httpx
from tad.schema.github import RepositoryContent
from amt.schema.github import RepositoryContent

logger = logging.getLogger(__name__)

Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions tad/core/config.py → amt/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
from pydantic_core import MultiHostUrl
from pydantic_settings import BaseSettings, SettingsConfigDict

from tad.core.exceptions import SettingsError
from tad.core.types import DatabaseSchemaType, EnvironmentType, LoggingLevelType
from amt.core.exceptions import SettingsError
from amt.core.types import DatabaseSchemaType, EnvironmentType, LoggingLevelType

logger = logging.getLogger(__name__)

# Self type is not available in Python 3.10 so create our own with TypeVar
SelfSettings = TypeVar("SelfSettings", bound="Settings")

PROJECT_NAME: str = "TAD"
PROJECT_DESCRIPTION: str = "Transparency of Algorithmic Decision making"
PROJECT_NAME: str = "AMT"
PROJECT_DESCRIPTION: str = "Algorithm Management Toolkit"
VERSION: str = "0.1.0" # replace in CI/CD pipeline


Expand All @@ -43,9 +43,9 @@ class Settings(BaseSettings):

APP_DATABASE_SERVER: str = "db"
APP_DATABASE_PORT: int = 5432
APP_DATABASE_USER: str = "tad"
APP_DATABASE_USER: str = "amt"
APP_DATABASE_PASSWORD: str | None = None
APP_DATABASE_DB: str = "tad"
APP_DATABASE_DB: str = "amt"

APP_DATABASE_FILE: str = "/database.sqlite3"

Expand Down
4 changes: 2 additions & 2 deletions tad/core/db.py → amt/core/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from sqlalchemy.pool import QueuePool, StaticPool
from sqlmodel import Session, SQLModel, create_engine, select, update

from tad.core.config import get_settings
from tad.models import Status, Task, User
from amt.core.config import get_settings
from amt.models import Status, Task, User

logger = logging.getLogger(__name__)

Expand Down
File renamed without changes.
Loading

0 comments on commit c6f1409

Please sign in to comment.