Refactor architecture documentation and enhance security features
- Updated architecture constraints documentation to include detailed sections on technical, organizational, regulatory, environmental, and performance constraints. - Created separate markdown files for each type of constraint for better organization and clarity. - Revised the architecture scope section to provide a clearer overview of the system's key areas. - Enhanced the solution strategy documentation with detailed explanations of the client-server architecture, technology choices, trade-offs, and future considerations. - Added comprehensive descriptions of backend and frontend components, middleware, and utilities in the architecture documentation. - Migrated UI, templates, and styling notes to a dedicated section for better structure. - Updated requirements.txt to include missing dependencies. - Refactored user authentication logic in the users.py and security.py files to improve code organization and maintainability, including the integration of OAuth2 password bearer token handling.
This commit is contained in:
13
docs/architecture/05_blocks/05_01_architecture_overview.md
Normal file
13
docs/architecture/05_blocks/05_01_architecture_overview.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title: '05 — Architecture Overview'
|
||||
description: "This overview complements architecture with a high-level map of CalMiner's module layout and request flow."
|
||||
status: draft
|
||||
---
|
||||
|
||||
This overview complements [architecture](README.md) with a high-level map of CalMiner's module layout and request flow.
|
||||
|
||||
Refer to the detailed architecture chapters in `docs/architecture/`:
|
||||
|
||||
- Module map & components: [Building Block View](../05_building_block_view.md)
|
||||
- Request flow & runtime interactions: [Runtime View](../06_runtime_view.md)
|
||||
- Simulation roadmap & strategy: [Solution Strategy](../04_solution_strategy.md)
|
||||
13
docs/architecture/05_blocks/05_02_backend_components.md
Normal file
13
docs/architecture/05_blocks/05_02_backend_components.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title: '05 — Backend Components'
|
||||
description: 'Description of the backend components of the CalMiner application.'
|
||||
status: draft
|
||||
---
|
||||
|
||||
- **FastAPI application** (`main.py`): entry point that configures routers, middleware, and startup/shutdown events.
|
||||
- **Routers** (`routes/`): modular route handlers for scenarios, parameters, costs, consumption, production, equipment, maintenance, simulations, and reporting. Each router defines RESTful endpoints, request/response schemas, and orchestrates service calls.
|
||||
- leveraging a shared dependency module (`routes/dependencies.get_db`) for SQLAlchemy session management.
|
||||
- **Models** (`models/`): SQLAlchemy ORM models representing database tables and relationships, encapsulating domain entities like Scenario, CapEx, OpEx, Consumption, ProductionOutput, Equipment, Maintenance, and SimulationResult.
|
||||
- **Services** (`services/`): business logic layer that processes data, performs calculations, and interacts with models. Key services include reporting calculations and Monte Carlo simulation scaffolding.
|
||||
- `services/settings.py`: manages application settings backed by the `application_setting` table, including CSS variable defaults, persistence, and environment-driven overrides that surface in both the API and UI.
|
||||
- **Database** (`config/database.py`): sets up the SQLAlchemy engine and session management for PostgreSQL interactions.
|
||||
11
docs/architecture/05_blocks/05_03_frontend_components.md
Normal file
11
docs/architecture/05_blocks/05_03_frontend_components.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: '05 — Frontend Components'
|
||||
description: 'Description of the frontend components of the CalMiner application.'
|
||||
status: draft
|
||||
---
|
||||
|
||||
- **Templates** (`templates/`): Jinja2 templates for server-rendered HTML views, extending a shared base layout with a persistent sidebar for navigation.
|
||||
- **Static Assets** (`static/`): CSS and JavaScript files for styling and interactivity. Shared CSS variables in `static/css/main.css` define the color palette, while page-specific JS modules in `static/js/` handle dynamic behaviors.
|
||||
- **Reusable partials** (`templates/partials/components.html`): macro library that standardises select inputs, feedback/empty states, and table wrappers so pages remain consistent while keeping DOM hooks stable for existing JavaScript modules.
|
||||
- `templates/settings.html`: Settings hub that renders theme controls and environment override tables using metadata provided by `routes/ui.py`.
|
||||
- `static/js/settings.js`: applies client-side validation, form submission, and live CSS updates for theme changes, respecting environment-managed variables returned by the API.
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
title: '05 — Middleware & Utilities'
|
||||
description: 'Description of the middleware and utility components of the CalMiner application.'
|
||||
status: draft
|
||||
---
|
||||
|
||||
- **Middleware** (`middleware/validation.py`): applies JSON validation before requests reach routers.
|
||||
- **Testing** (`tests/unit/`): pytest suite covering route and service behavior, including UI rendering checks and negative-path router validation tests to ensure consistent HTTP error semantics. Playwright end-to-end coverage is planned for core smoke flows (dashboard load, scenario inputs, reporting) and will attach in CI once scaffolding is completed.
|
||||
Reference in New Issue
Block a user