# sonysemiconductorsolutions/aitrios-sample-tool-angle-adjustment architecture

> Architecture diagram of the GitHub repository sonysemiconductorsolutions/aitrios-sample-tool-angle-adjustment, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sonysemiconductorsolutions/aitrios-sample-tool-angle-adjustment
- Repository: https://github.com/sonysemiconductorsolutions/aitrios-sample-tool-angle-adjustment

## Overview

##### Project Type and Purpose
- AAT is a web-based application for adjusting and validating camera angles on devices connected to an external service (AITRIOS). It serves two distinct user groups:
– Contractors: Use a mobile web app (found in the web-app directory) to adjust and submit camera angles.
– Admins: Use a desktop web app (found in the web-admin directory) to review and approve or reject these submissions.
- A shared backend server (in the backend folder) implements the API endpoints to serve both frontend apps.

##### File Structure to Extract Architectural Components
- Backend (backend directory)
– Contains a Python-based server with organized subdirectories: “api” for endpoint definitions, “models”, “schemas”, “services”, and supporting libraries. Its Dockerfiles, Pipfiles, and Prisma schemas indicate a containerized server, ORM-managed database (with Prisma using Postgres), and defined API routes.
– The “prisma” subdirectory shows schema definitions for the database.
- Frontend
– Web-admin (admin app): A desktop-targeted React/Vite application written in TypeScript, with clearly separated components, pages, services (for API interaction), state management (store slices), and localization assets.
– Web-app (contractor app): A mobile-friendly web application also built with React/Vite and TypeScript. It maintains a similar organizational structure with components, pages, contexts, and API repositories.
- Documentation (docsrc) and Tools (tools directory)
– Documentation covers setup guides for various environments (AWS, Azure, Codespaces) and API usage workflows.
– Tools such as “caat-helper” and cloud-setup scripts offer supplementary operational assistance and automation for deployment and maintenance.

- Use clear, descriptive labels for each component (e.g., “Backend API Server”, “Admin Frontend”, “Contractor Frontend”, “Database (Postgres via Prisma)”, “API Gateway/Integration with AITRIOS”).
– From the frontends to the backend.
– From the backend to the database, and if applicable, to external systems.
- Essential architectural elements:

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Frontend Applications"
        WF1["Contractor Frontend (Mobile)"]:::frontend
        WF2["Admin Frontend (Desktop)"]:::frontend
    end

    subgraph "Backend API Server"
        BE1["API Endpoints"]:::backend
        BE2["Business Logic & Services"]:::backend
        BE3["Data Models & ORM Layer"]:::backend
        BE5["Prisma ORM"]:::backend
        BE4["External Integration (AITRIOS)"]:::external
    end

    subgraph "Database (Postgres via Prisma)"
        DB1["schema.prisma"]:::database
        DB2["schema.postgres.prisma"]:::database
    end

    subgraph "DevOps & Tools"
        DO1["Containerization (Docker)"]:::tools
        DO2["Cloud Setup Scripts"]:::tools
        DO3["Supplementary Tools (caat-helper)"]:::tools
    end

    WF1 -->|"RESTAPI"| BE1
    WF2 -->|"RESTAPI"| BE1
    BE1 -->|"CallsLogic"| BE2
    BE2 -->|"AccessesModels"| BE3
    BE3 -->|"UsesORM"| BE5
    BE5 -->|"CRUD"| DB1
    DB1 -.->|"Alternate"| DB2
    BE2 -->|"Integrates"| BE4

    DO1 -.-> WF1
    DO1 -.-> WF2
    DO1 -.-> BE1
    DO2 -.-> DO1
    DO3 -.-> DO1

    style WF1 fill:#ffcccc,stroke:#333,stroke-width:2px
    style WF2 fill:#ffcccc,stroke:#333,stroke-width:2px
    style BE1 fill:#ccffcc,stroke:#333,stroke-width:2px
    style BE2 fill:#ccffcc,stroke:#333,stroke-width:2px
    style BE3 fill:#ccffcc,stroke:#333,stroke-width:2px
    style BE5 fill:#ccffcc,stroke:#333,stroke-width:2px
    style BE4 fill:#ffebcc,stroke:#333,stroke-width:2px
    style DB1 fill:#cce5ff,stroke:#333,stroke-width:2px
    style DB2 fill:#cce5ff,stroke:#333,stroke-width:2px
    style DO1 fill:#e6ccff,stroke:#333,stroke-width:2px,stroke-dasharray: 5,5
    style DO2 fill:#e6ccff,stroke:#333,stroke-width:2px,stroke-dasharray: 5,5
    style DO3 fill:#e6ccff,stroke:#333,stroke-width:2px,stroke-dasharray: 5,5

    click WF1 "https://github.com/sonysemiconductorsolutions/aitrios-sample-tool-angle-adjustment/tree/main/web-app"
    click WF2 "https://github.com/sonysemiconductorsolutions/aitrios-sample-tool-angle-adjustment/tree/main/web-admin"
    click BE1 "https://github.com/sonysemiconductorsolutions/aitrios-sample-tool-angle-adjustment/tree/main/backend/src/api"
    click BE2 "https://github.com/sonysemiconductorsolutions/aitrios-sample-tool-angle-adjustment/tree/main/backend/src/services"
    click BE3 "https://github.com/sonysemiconductorsolutions/aitrios-sample-tool-angle-adjustment/tree/main/backend/src/models"
    click BE5 "https://github.com/sonysemiconductorsolutions/aitrios-sample-tool-angle-adjustment/tree/main/backend/prisma"
    click BE4 "https://github.com/sonysemiconductorsolutions/aitrios-sample-tool-angle-adjustment/blob/main/backend/src/services/aitrios_service.py"
    click DB1 "https://github.com/sonysemiconductorsolutions/aitrios-sample-tool-angle-adjustment/blob/main/backend/prisma/schema.prisma"
    click DB2 "https://github.com/sonysemiconductorsolutions/aitrios-sample-tool-angle-adjustment/blob/main/backend/prisma/schema.postgres.prisma"
    click DO1 "https://github.com/sonysemiconductorsolutions/aitrios-sample-tool-angle-adjustment/tree/main/backend/Dockerfile"
    click DO2 "https://github.com/sonysemiconductorsolutions/aitrios-sample-tool-angle-adjustment/tree/main/tools/cloud-setup"
    click DO3 "https://github.com/sonysemiconductorsolutions/aitrios-sample-tool-angle-adjustment/tree/main/tools/caat-helper"
```
