This application is a small monitoring system used by DATACallasisstent AI tools to automatically respond to incidents, unexpected outages and inform customers.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-18 10:11:23 +01:00
api Everything except APi token access in dashboard 2026-11-18 09:44:50 +01:00
dashboard Everything except APi token access in dashboard 2026-11-18 09:44:50 +01:00
database Everything except APi token access in dashboard 2026-11-18 09:44:50 +01:00
models Everything except APi token access in dashboard 2026-11-18 09:44:50 +01:00
repositories Add application setups 2026-11-12 14:25:18 +01:00
schemas Everything except APi token access in dashboard 2026-11-18 09:44:50 +01:00
security Everything except APi token access in dashboard 2026-11-18 09:44:50 +01:00
services Everything except APi token access in dashboard 2026-11-18 09:44:50 +01:00
.gitignore Exclude sensitive files from Git 2026-11-18 10:11:23 +01:00
app.py Everything except APi token access in dashboard 2026-11-18 09:44:50 +01:00
config.py Everything except APi token access in dashboard 2026-11-18 09:44:50 +01:00
main.py Everything except APi token access in dashboard 2026-11-18 09:44:50 +01:00
project.txt Everything except APi token access in dashboard 2026-11-18 09:44:50 +01:00
Readme.md Everything except APi token access in dashboard 2026-11-18 09:44:50 +01:00
README.md Initial commit 2026-11-10 12:45:39 +00:00
requirement.txt Everything except APi token access in dashboard 2026-11-18 09:44:50 +01:00
test_db.py Update DATA STATUS project files 2026-11-12 12:00:26 +01:00

DATAKI – Central Incident Management System

  1. Project Overview

DATAKI is a centralized Incident Management System designed to monitor, report, manage, and track incidents affecting servers and IT infrastructure.

The application uses a modular backend architecture built with Python, FastAPI, PostgreSQL, SQLAlchemy, and Keycloak for authentication and role-based access control (RBAC).

The system initially provides an Operator Dashboard, allowing authorized Operators to create, view, update, resolve, and delete incidents.

A User Dashboard will be introduced in a future development phase.

  1. Technology Stack Component Technology Programming Language Python Backend Framework FastAPI Database PostgreSQL ORM SQLAlchemy Data Validation Pydantic Authentication Keycloak Authorization Role-Based Access Control (RBAC) API Communication REST API HTTP Client HTTPX Dashboard Backend FastAPI Frontend Templates Jinja2, HTML, CSS API Documentation Swagger UI / OpenAPI Development Environment Visual Studio Code Version Control Git
  2. Project Architecture text DATAKI/ │ ├── API/ │ ├── init.py │ └── incident_api.py │ ├── Database/ │ ├── init.py │ └── connection02.py │ ├── models/ │ ├── init.py │ └── incident05.py │ ├── schemas/ │ ├── init.py │ └── incident.py │ ├── Repositories/ │ ├── init.py │ └── incident_respository.py │ ├── services/ │ ├── init.py │ └── incident_service.py │ ├── security/ │ ├── init.py │ └── security03.py │ ├── Operator_Dashboard/ │ ├── init.py │ ├── operator_dashboard.py │ └── templates/ │ └── operator.html │ ├── Customer_Dashboard/ │ ├── init.py │ ├── customer_dashboard.py │ └── templates/ │ └── customer.html │ ├── main.py │ ├── config.py ├── .env ├── .gitignore ├── requirements.txt ├── README.md │ └── test_db.py

Note: This is the target logical structure. Your current project has some differently named folders and files. Standardize the names and imports when migrating; do not create duplicate modules.

  1. Backend Architecture – Layer Responsibilities 4.1 API Layer

Location: API/incident_api.py

Responsible for:

Defining REST API endpoints. Receiving HTTP requests. Validating request data through Pydantic schemas. Applying authentication and authorization dependencies. Calling the Service layer. Returning appropriate HTTP responses.

Incident endpoints:

Method Endpoint Description Access GET /incidents/ Retrieve all incidents Authenticated users GET /incidents/{id} Retrieve an incident Authenticated users POST /incidents/ Create an incident Operator PUT /incidents/{id} Update an incident Operator DELETE /incidents/{id} Delete an incident Operator 4.2 Database Layer

Location: Database/connection02.py

Responsible for:

Establishing PostgreSQL connectivity. Configuring SQLAlchemy engine. Managing database sessions. Providing database dependencies to API endpoints. 4.3 Models Layer

Location: models/incident05.py

Responsible for defining SQLAlchemy database models.

The Incident model represents the incidents table in PostgreSQL.

Main attributes:

id server_name complaint complaint_time complaint_duration is_active is_exposed is_historical created_by created_at updated_at deleted_at

Additional database models include:

User Role IncidentHistory IncidentAssignment AuditLog 4.4 Schemas Layer

Location: schemas/incident.py

Responsible for request and response validation using Pydantic.

Schemas:

IncidentCreate IncidentUpdate IncidentResponse

This layer ensures that incoming data follows the expected structure and validation rules.

4.5 Repository Layer

Location: Repositories/incident_respository.py

Responsible for database operations.

Responsibilities:

Create incident records. Retrieve incident records. Update incident records. Soft-delete incident records. Retrieve active and historical incidents.

The Repository layer communicates directly with SQLAlchemy and PostgreSQL.

4.6 Service Layer

Location: services/incident_service.py

Contains the business logic of the application.

Responsibilities:

Process incident creation. Validate business rules. Retrieve incidents. Update incident information. Resolve incidents. Coordinate repository operations. Handle incident lifecycle management.

The Service layer separates business logic from API endpoints and database queries.

4.7 Security Layer

Location: security/security03.py

Responsible for Keycloak-based authentication and authorization.

Responsibilities:

Validate Keycloak access tokens. Verify token signatures using Keycloak JWKS. Validate token issuer and expiration. Identify authenticated users. Extract user roles. Enforce Operator permissions. Reject unauthorized requests.

Keycloak is the identity provider. FastAPI acts as the resource server and validates the access tokens.

  1. Role-Based Access Control

The system follows a role-based access model.

Functionality Operator User Login through Keycloak Yes Yes View incidents Yes Yes Create incidents Yes No Update incidents Yes No Resolve incidents Yes No Delete incidents Yes No View incident history Yes Yes

All incident modification operations must be authorized by the backend, not merely hidden in the frontend.

  1. Operator Dashboard

Location: Operator_Dashboard/

The Operator Dashboard provides the interface for authorized Operators.

Planned functionality:

Keycloak authentication. Operator login and logout. View all incidents. Create new incidents. Update incident details. Resolve incidents. Delete incidents. View active incidents. View historical incidents. Display incident status.

The dashboard communicates with the Central FastAPI application through authenticated REST API requests.

  1. Customer/User Dashboard – Future Development

Location: Customer_Dashboard/

The User Dashboard will be developed in a later phase.

Planned functionality:

User authentication through Keycloak. View published incidents. View incident status. View incident history. Filter incidents by server. View exposed and non-exposed incidents.

Users will have read-only access to incident information. Incident creation, modification, and deletion will remain restricted to Operators.

  1. PostgreSQL Database Design

Database: incident_db

The database contains the following main tables:

Table Purpose users Stores application user records roles Stores application roles incidents Stores incident information incident_history Tracks incident changes incident_assignments Tracks incident assignments audit_logs Records important application actions

Key database relationships:

A user can create multiple incidents. An incident can have multiple history records. An incident can have multiple assignments. User roles determine application permissions.

Keycloak manages authentication identities, while PostgreSQL maintains application-specific user records and relationships.

  1. Incident Lifecycle

The incident management workflow follows these stages:

Operator authenticates through Keycloak. Backend validates the access token. Backend checks the Operator role. Operator submits incident information. API validates the request. Service layer processes the business logic. Repository saves the incident in PostgreSQL. Dashboard retrieves and displays the incident. Operator can update, resolve, or delete the incident. Historical information is retained according to the incident lifecycle and retention policy. 10. Environment Configuration

Sensitive configuration is maintained in a .env file.

Example:

env DB_HOST=127.0.0.1 DB_PORT=5432 DB_NAME=incident_db DB_USER=incident_user DB_PASSWORD=your_database_password

KEYCLOAK_SERVER_URL=http://localhost:8080 KEYCLOAK_REALM=your_realm KEYCLOAK_CLIENT_ID=your_client_id

Never commit .env files, passwords, client secrets, or access tokens to version control.

  1. Installation and Setup Step 1 – Clone or open the project bash cd ~/Desktop/DATAKI

Step 2 – Activate virtual environment bash source .venv/bin/activate

Step 3 – Install dependencies bash pip install -r requirements.txt

Step 4 – Configure environment variables

Create and configure the .env file with your PostgreSQL and Keycloak settings.

Step 5 – Test PostgreSQL connection bash python test_db.py

Step 6 – Start FastAPI

From the DATAKI root directory:

bash uvicorn main:app --reload

Step 7 – Access API documentation

Swagger UI:

text http://127.0.0.1:8000/docs

ReDoc:

text http://127.0.0.1:8000/redoc

Health check:

text http://127.0.0.1:8000/health

  1. Development Roadmap Phase 1 – Backend Foundation PostgreSQL database setup. SQLAlchemy database connection. Incident database table. Pydantic schemas. Repository layer. Service layer. Incident REST API. Initial Keycloak security implementation. FastAPI application startup.

Phase 2 – Authentication and Authorization Complete Keycloak integration. Configure Operator role. Verify JWT validation. Implement secure session management. Test role-based access control. Phase 3 – Operator Dashboard

Implement Keycloak login flow. Build Operator Dashboard interface. Implement incident creation. Implement incident listing. Implement incident updating. Implement incident resolution. Implement incident deletion. Phase 4 – User Dashboard Develop User Dashboard. Implement read-only incident access. Display incident history. Implement incident filtering. Phase 5 – Testing and Deployment Unit testing.

API integration testing. Authentication testing. Authorization testing. Database transaction testing. Logging and monitoring. Production deployment. 13. Architectural Design Principles

The application follows these software engineering principles:

Separation of concerns. Layered architecture. Reusable components. Centralized authentication. Role-based authorization. Database normalization. Input validation. Secure configuration management. Maintainability and scalability. Clear separation between business logic and data access.