# rs-team-2/employee-performance-tracker_team-2 architecture

> Architecture diagram of the GitHub repository rs-team-2/employee-performance-tracker_team-2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-03-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rs-team-2/employee-performance-tracker_team-2
- Repository: https://github.com/rs-team-2/employee-performance-tracker_team-2

## Overview

##### What this project is (type + purpose)
This is a **small full-stack-ish Python application** (two “presentation layers”) that manages:
- **Employee records + projects + assignments** stored in **SQLite** (`company.db`, local file)
- **Performance reviews** stored in **MongoDB Atlas** (cloud NoSQL)
- A **Streamlit web UI** (`app.py`) and a **terminal/CLI menu UI** (`main.py`)
- Shared “service” modules that implement CRUD and reporting across the two databases

So the architecture is best represented as a **modular monolith** with **two UIs** and a **hybrid persistence layer** (SQLite + MongoDB).

##### How to read the file tree as architecture
From the repo root modules:
- `app.py` → **Streamlit UI container** (browser-driven)
- `main.py` → **CLI UI container**
- `employee_manager.py` → **Employee domain logic** (CRUD, likely SQLite)
- `project_manager.py` → **Project + assignments domain logic** (likely SQLite)
- `performance_reviewer.py` → **Performance review domain logic** (MongoDB)
- `reports.py` → **Cross-database reporting** (joins/aggregations across SQLite + MongoDB at the application layer)
- `db_connections.py` → **DB connection + setup utilities** for SQLite and MongoDB
- `seed_data.py` → **Offline bootstrap job** that creates tables + inserts initial data into both stores
- `company.db` → **SQLite database file artifact**
- `tests/*` → **pytest test suite** validating each module (useful to confirm boundaries/interactions)

**Actors**
- HR/Admin/Manager user (primary)
- Developer (runs seeding/tests)

**System**
- “Employee Performance Tracking System”

**External Systems**
- **MongoDB Atlas** (external managed cloud DB)

**Data Stores**
- **SQLite file `company.db`** (local data store; not an external system, but show as a store)

- User ↔ System (via Browser/Streamlit or Terminal/CLI)
- System ↔ MongoDB Atlas (performance reviews)
- System ↔ SQLite file (employees/projects/assignments)

Here “containers” are executable entrypoints / deployable units (even if all local):

##### Streamlit Web App (`app.py`)
- Talks to domain modules (employee/project/performance/reports)
- Reads Mongo URI from `.env` (show config source)

##### Terminal CLI App (`main.py`)
- Same domain modules

##### Database Access / Connection Layer (`db_connections.py`)
- SQLite connection (via `sqlite3`) to `company.db`
- Mongo connection (via `pymongo` or similar) to Atlas using `MONGO_URI`

##### SQLite DB (local file): `company.db`
- Employees, Projects, Assignments tables

##### MongoDB Atlas cluster
- Performance reviews collection(s)

##### Seeding Job / Script (`seed_data.py`)
- One-off/offline container that initializes SQLite tables + inserts seed rows and inserts Mongo seed documents

##### Test Runner (pytest)

- Streamlit app → employee_manager/project_manager → db_connections → SQLite
- Streamlit app → performance_reviewer → db_connections → MongoDB Atlas
- Streamlit app → reports → (db_connections → SQLite) + (db_connections → MongoDB) → aggregated report output
- seed_data.py → db_connections → SQLite + MongoDB (initialization)
- main.py → same as Streamlit paths (but separate UI)

**Presentation**
- `app.py` (Streamlit routes/widgets → calls service functions)
- `main.py` (menu prompts → calls service functions)

**Domain/Service modules**
- `employee_manager.py`
- `project_manager.py`
- `performance_reviewer.py`
- `reports.py`

**Infrastructure**
- `db_connections.py` (connection factory, create tables, helpers)
- `.env` / environment variables (config provider)

**Data stores**
- SQLite: `company.db`
- MongoDB Atlas

- `app.py` → `employee_manager.py`, `project_manager.py`, `performance_reviewer.py`, `reports.py`
- `main.py` → same modules
- Each service module → `db_connections.py`
- `db_connections.py` → SQLite file and → MongoDB Atlas
- `reports.py` → both SQLite and MongoDB paths (explicitly show it depends on both)

##### Hybrid persistence
- Relational data in SQLite (employees/projects/assignments)
- Document data in MongoDB (performance reviews)
- Reports must do “application-layer joins” (since the DBs can’t join across each other)

##### Infrastructure boundary via `db_connections.py`
- Single gateway/factory for DB connections and possibly table creation

##### Batch initialization
- `seed_data.py` is a separate execution path (job) that touches both persistence technologies

##### What “best and most accurate” means here (practical checklist)
- Treat **SQLite as a local file store**, not a server component.
- Treat **MongoDB Atlas as an external managed service** reachable via URI.
- **both UIs** (Streamlit + CLI) as first-class entrypoints.
- **`reports.py`** explicitly as the cross-db aggregator (it’s architecturally important).
- **`seed_data.py`** as a separate workflow that initializes both stores.
- A small “Dev/Test” corner showing `pytest` hitting the service modules (optional but useful for principal-level completeness).
- Verify any README-vs-tree inconsistencies (e.g., the mentioned `connections/db_connections.py`) before finalizing.

- “Submit performance review” (UI → performance_reviewer → db_connections → MongoDB)
- “Generate employee performance summary” (UI → reports → SQLite query + Mongo query → merge → output)

That set will be detailed, faithful to the repo structure, and will communicate the hybrid data model clearly.

## Diagram (Mermaid)

```mermaid
flowchart TD

%% =========================
%% Level A — System Context
%% =========================
subgraph "Level A — System Context"
direction TB
HR["HR/Admin/Manager"]:::actor
DEV["Developer"]:::actor

SYS(("Employee Performance Tracking System")):::system

MONGO_EXT[("MongoDB Atlas\n(Managed Cloud DB)")]:::externalStore
SQLITE_FILE[("SQLite DB File\ncompany.db")]:::dataStore

HR <-->|"use(viaBrowserOrTerminal)"| SYS
DEV -->|"runSeedAndTests"| SYS
SYS -->|"storeAndQueryReviews(Mongo)"| MONGO_EXT
SYS -->|"storeAndQueryCoreData(SQL)"| SQLITE_FILE
end

%% =========================
%% Level B — Container View
%% =========================
subgraph "Level B — Containers (Entrypoints + Stores)"
direction TB

subgraph "Presentation Entrypoints"
direction TB
STREAMLIT_APP("Streamlit Web App"):::presentation
CLI_APP("Terminal CLI App"):::presentation
end

subgraph "Application Services (Shared)"
direction TB
EMP_SVC["Employee Manager Service"]:::service
PROJ_SVC["Project + Assignments Service"]:::service
PERF_SVC["Performance Reviewer Service"]:::service
REPORTS_SVC["Reporting/Aggregation Service"]:::service
end

subgraph "Infrastructure"
direction TB
DB_GATEWAY["DB Connections / Setup Utilities"]:::infrastructure
ENV_CFG[["Config (.env / env vars)\nMONGO_URI"]]:::config
end

subgraph "Data Stores"
direction TB
SQLITE_DB[("SQLite DB File\ncompany.db")]:::dataStore
MONGO_ATLAS[("MongoDB Atlas Cluster")]:::externalStore
end

subgraph "Offline / Dev Workflows"
direction TB
SEED_JOB("Seeding / Bootstrap Job"):::job
PYTEST_RUNNER("pytest test runner"):::devtool
end

STREAMLIT_APP -->|"CRUDemployees(SQL)"| EMP_SVC
STREAMLIT_APP -->|"CRUDprojectsAndAssignments(SQL)"| PROJ_SVC
STREAMLIT_APP -->|"insertQueryReviews(Mongo)"| PERF_SVC
STREAMLIT_APP -->|"aggregateReport(SQL+Mongo)"| REPORTS_SVC

CLI_APP -->|"CRUDemployees(SQL)"| EMP_SVC
CLI_APP -->|"CRUDprojectsAndAssignments(SQL)"| PROJ_SVC
CLI_APP -->|"insertQueryReviews(Mongo)"| PERF_SVC
CLI_APP -->|"aggregateReport(SQL+Mongo)"| REPORTS_SVC

ENV_CFG -->|"provideMONGO_URI"| DB_GATEWAY

EMP_SVC -->|"useSQLiteConnection"| DB_GATEWAY
PROJ_SVC -->|"useSQLiteConnection"| DB_GATEWAY
PERF_SVC -->|"useMongoConnection"| DB_GATEWAY
REPORTS_SVC -->|"querySQLAndMongo"| DB_GATEWAY

DB_GATEWAY -->|"sqlite3(file)"| SQLITE_DB
DB_GATEWAY -->|"pymongo(uri)"| MONGO_ATLAS

SEED_JOB -->|"seedTablesAndRows(SQL)"| DB_GATEWAY
SEED_JOB -->|"seedDocuments(Mongo)"| DB_GATEWAY

PYTEST_RUNNER -->|"validateModules"| EMP_SVC
PYTEST_RUNNER -->|"validateModules"| PROJ_SVC
PYTEST_RUNNER -->|"validateModules"| PERF_SVC
PYTEST_RUNNER -->|"validateModules"| REPORTS_SVC
PYTEST_RUNNER -->|"validateGateway"| DB_GATEWAY
end

%% =========================
%% Level C — Component (Module) View
%% =========================
subgraph "Level C — Components (Repo Modules)"
direction TB

subgraph "Presentation Modules"
direction TB
APP_PY["app.py (Streamlit UI)"]:::presentation
MAIN_PY["main.py (CLI UI)"]:::presentation
end

subgraph "Domain / Service Modules"
direction TB
EMP_MOD["employee_manager.py"]:::service
PROJ_MOD["project_manager.py"]:::service
PERF_MOD["performance_reviewer.py"]:::service
REPORTS_MOD["reports.py (Cross-DB Aggregation)"]:::service
end

subgraph "Infrastructure Modules"
direction TB
DB_CONN_MOD["db_connections.py (DB Gateway)"]:::infrastructure
ENV_EXAMPLE[[".env_example (Mongo URI example)"]]:::config
end

subgraph "Persistence"
direction TB
SQLITE_ARTIFACT[("company.db (SQLite file)")]:::dataStore
MONGO_SERVICE[("MongoDB Atlas")]:::externalStore
end

subgraph "Tests (pytest)"
direction TB
TESTS_DIR["tests/"]:::devtool
CONFTEST["conftest.py (fixtures)"]:::devtool
T_DB["test_db_connections.py"]:::devtool
T_EMP["test_employee_manager.py"]:::devtool
T_PROJ["test_project_manager.py"]:::devtool
T_PERF["test_performance_reviewer.py"]:::devtool
end

APP_PY -->|"callsCRUDemployees"| EMP_MOD
APP_PY -->|"callsCRUDprojectsAssignments"| PROJ_MOD
APP_PY -->|"callsReviewOps"| PERF_MOD
APP_PY -->|"callsReports"| REPORTS_MOD

MAIN_PY -->|"callsCRUDemployees"| EMP_MOD
MAIN_PY -->|"callsCRUDprojectsAssignments"| PROJ_MOD
MAIN_PY -->|"callsReviewOps"| PERF_MOD
MAIN_PY -->|"callsReports"| REPORTS_MOD

EMP_MOD -->|"getSQLiteConn"| DB_CONN_MOD
PROJ_MOD -->|"getSQLiteConn"| DB_CONN_MOD
PERF_MOD -->|"getMongoClient"| DB_CONN_MOD
REPORTS_MOD -->|"joinAtAppLayer(SQL+Mongo)"| DB_CONN_MOD

ENV_EXAMPLE -->|"documentsMONGO_URI"| DB_CONN_MOD

DB_CONN_MOD -->|"readWrite(SQL)"| SQLITE_ARTIFACT
DB_CONN_MOD -->|"readWrite(Mongo)"| MONGO_SERVICE

TESTS_DIR -->|"contains"| CONFTEST
TESTS_DIR -->|"contains"| T_DB
TESTS_DIR -->|"contains"| T_EMP
TESTS_DIR -->|"contains"| T_PROJ
TESTS_DIR -->|"contains"| T_PERF

T_DB -->|"tests"| DB_CONN_MOD
T_EMP -->|"tests"| EMP_MOD
T_PROJ -->|"tests"| PROJ_MOD
T_PERF -->|"tests"| PERF_MOD
CONFTEST -->|"sharedFixtures"| T_DB
CONFTEST -->|"sharedFixtures"| T_EMP
CONFTEST -->|"sharedFixtures"| T_PROJ
CONFTEST -->|"sharedFixtures"| T_PERF

SEED_MOD("seed_data.py (Init + Seed)"):::job
SEED_MOD -->|"createTablesAndSeed(SQL)"| DB_CONN_MOD
SEED_MOD -->|"seedDocs(Mongo)"| DB_CONN_MOD
end

%% =========================
%% Cross-level alignment (light)
%% =========================
SYS -.->|"implementedBy"| STREAMLIT_APP
SYS -.->|"implementedBy"| CLI_APP
STREAMLIT_APP -.->|"module"| APP_PY
CLI_APP -.->|"module"| MAIN_PY
EMP_SVC -.->|"module"| EMP_MOD
PROJ_SVC -.->|"module"| PROJ_MOD
PERF_SVC -.->|"module"| PERF_MOD
REPORTS_SVC -.->|"module"| REPORTS_MOD
DB_GATEWAY -.->|"module"| DB_CONN_MOD
SQLITE_DB -.->|"artifact"| SQLITE_ARTIFACT
MONGO_ATLAS -.->|"service"| MONGO_SERVICE

%% =========================
%% Click Events (component_mapping)
%% =========================
click APP_PY "https://github.com/rs-team-2/employee-performance-tracker_team-2/blob/main/app.py"
click MAIN_PY "https://github.com/rs-team-2/employee-performance-tracker_team-2/blob/main/main.py"
click EMP_MOD "https://github.com/rs-team-2/employee-performance-tracker_team-2/blob/main/employee_manager.py"
click PROJ_MOD "https://github.com/rs-team-2/employee-performance-tracker_team-2/blob/main/project_manager.py"
click PERF_MOD "https://github.com/rs-team-2/employee-performance-tracker_team-2/blob/main/performance_reviewer.py"
click REPORTS_MOD "https://github.com/rs-team-2/employee-performance-tracker_team-2/blob/main/reports.py"
click DB_CONN_MOD "https://github.com/rs-team-2/employee-performance-tracker_team-2/blob/main/db_connections.py"
click SEED_MOD "https://github.com/rs-team-2/employee-performance-tracker_team-2/blob/main/seed_data.py"
click SQLITE_ARTIFACT "https://github.com/rs-team-2/employee-performance-tracker_team-2/blob/main/company.db"
click ENV_EXAMPLE "https://github.com/rs-team-2/employee-performance-tracker_team-2/blob/main/.env_example"
click TESTS_DIR "https://github.com/rs-team-2/employee-performance-tracker_team-2/tree/main/tests/"
click T_DB "https://github.com/rs-team-2/employee-performance-tracker_team-2/blob/main/tests/test_db_connections.py"
click T_EMP "https://github.com/rs-team-2/employee-performance-tracker_team-2/blob/main/tests/test_employee_manager.py"
click T_PROJ "https://github.com/rs-team-2/employee-performance-tracker_team-2/blob/main/tests/test_project_manager.py"
click T_PERF "https://github.com/rs-team-2/employee-performance-tracker_team-2/blob/main/tests/test_performance_reviewer.py"
click CONFTEST "https://github.com/rs-team-2/employee-performance-tracker_team-2/blob/main/tests/conftest.py"

%% =========================
%% Styles
%% =========================
classDef actor fill:#F3F4F6,stroke:#6B7280,stroke-width:1px,color:#111827
classDef system fill:#111827,stroke:#111827,stroke-width:2px,color:#FFFFFF
classDef presentation fill:#DBEAFE,stroke:#2563EB,stroke-width:2px,color:#0B1B3A
classDef service fill:#DCFCE7,stroke:#16A34A,stroke-width:2px,color:#052E16
classDef infrastructure fill:#FFEDD5,stroke:#F97316,stroke-width:2px,color:#3B1D0A
classDef config fill:#FEF3C7,stroke:#D97706,stroke-width:2px,color:#3B2F0B
classDef dataStore fill:#E5E7EB,stroke:#4B5563,stroke-width:2px,color:#111827
classDef externalStore fill:#E0E7FF,stroke:#4F46E5,stroke-width:2px,color:#111827,stroke-dasharray: 4 3
classDef job fill:#FCE7F3,stroke:#DB2777,stroke-width:2px,color:#3A0A1E
classDef devtool fill:#EDE9FE,stroke:#7C3AED,stroke-width:2px,color:#1F1236
```
