130 lines
4.7 KiB
Markdown
130 lines
4.7 KiB
Markdown
# Implementation Plan (extended)
|
|
|
|
This file contains the implementation plan (MVP features, steps, and estimates).
|
|
|
|
## Project Setup
|
|
|
|
1. Connect to PostgreSQL database with schema `calminer`.
|
|
1. Create and activate a virtual environment and install dependencies via `requirements.txt`.
|
|
1. Define environment variables in `.env`, including `DATABASE_URL`.
|
|
1. Configure FastAPI entrypoint in `main.py` to include routers.
|
|
|
|
## Feature: Scenario Management
|
|
|
|
### Scenario Management — Steps
|
|
|
|
1. Create `models/scenario.py` for scenario CRUD.
|
|
1. Implement API endpoints in `routes/scenarios.py` (GET, POST, PUT, DELETE).
|
|
1. Write unit tests in `tests/unit/test_scenario.py`.
|
|
1. Build UI component `components/ScenarioForm.html`.
|
|
|
|
## Feature: Process Parameters
|
|
|
|
### Parameters — Steps
|
|
|
|
1. Create `models/parameters.py` for process parameters.
|
|
1. Implement Pydantic schemas in `routes/parameters.py`.
|
|
1. Add validation middleware in `middleware/validation.py`.
|
|
1. Write unit tests in `tests/unit/test_parameter.py`.
|
|
1. Build UI component `components/ParameterInput.html`.
|
|
|
|
## Feature: Stochastic Variables
|
|
|
|
### Stochastic Variables — Steps
|
|
|
|
1. Create `models/distribution.py` for variable distributions.
|
|
1. Implement API routes in `routes/distributions.py`.
|
|
1. Write Pydantic schemas and validations.
|
|
1. Write unit tests in `tests/unit/test_distribution.py`.
|
|
1. Build UI component `components/DistributionEditor.html`.
|
|
|
|
## Feature: Cost Tracking
|
|
|
|
### Cost Tracking — Steps
|
|
|
|
1. Create `models/capex.py` and `models/opex.py`.
|
|
1. Implement API routes in `routes/costs.py`.
|
|
1. Write Pydantic schemas for CAPEX/OPEX.
|
|
1. Write unit tests in `tests/unit/test_costs.py`.
|
|
1. Build UI component `components/CostForm.html`.
|
|
|
|
## Feature: Consumption Tracking
|
|
|
|
### Consumption Tracking — Steps
|
|
|
|
1. Create models for consumption: `chemical_consumption.py`, `fuel_consumption.py`, `water_consumption.py`, `scrap_consumption.py`.
|
|
1. Implement API routes in `routes/consumption.py`.
|
|
1. Write Pydantic schemas for consumption data.
|
|
1. Write unit tests in `tests/unit/test_consumption.py`.
|
|
1. Build UI component `components/ConsumptionDashboard.html`.
|
|
|
|
## Feature: Production Output
|
|
|
|
### Production Output — Steps
|
|
|
|
1. Create `models/production_output.py`.
|
|
1. Implement API routes in `routes/production.py`.
|
|
1. Write Pydantic schemas for production output.
|
|
1. Write unit tests in `tests/unit/test_production.py`.
|
|
1. Build UI component `components/ProductionChart.html`.
|
|
|
|
## Feature: Equipment Management
|
|
|
|
### Equipment Management — Steps
|
|
|
|
1. Create `models/equipment.py` for equipment data.
|
|
1. Implement API routes in `routes/equipment.py`.
|
|
1. Write Pydantic schemas for equipment.
|
|
1. Write unit tests in `tests/unit/test_equipment.py`.
|
|
1. Build UI component `components/EquipmentList.html`.
|
|
|
|
## Feature: Maintenance Logging
|
|
|
|
### Maintenance Logging — Steps
|
|
|
|
1. Create `models/maintenance.py` for maintenance events.
|
|
1. Implement API routes in `routes/maintenance.py`.
|
|
1. Write Pydantic schemas for maintenance logs.
|
|
1. Write unit tests in `tests/unit/test_maintenance.py`.
|
|
1. Build UI component `components/MaintenanceLog.html`.
|
|
|
|
## Feature: Monte Carlo Simulation Engine
|
|
|
|
### Monte Carlo Engine — Steps
|
|
|
|
1. Implement Monte Carlo logic in `services/simulation.py`.
|
|
1. Persist results in `models/simulation_result.py`.
|
|
1. Expose endpoint in `routes/simulations.py`.
|
|
1. Write integration tests in `tests/unit/test_simulation.py`.
|
|
1. Build UI component `components/SimulationRunner.html`.
|
|
|
|
## Feature: Reporting / Dashboard
|
|
|
|
### Reporting / Dashboard — Steps
|
|
|
|
1. Implement report calculations in `services/reporting.py`.
|
|
1. Add detailed and summary endpoints in `routes/reporting.py`.
|
|
1. Write unit tests in `tests/unit/test_reporting.py`.
|
|
1. Enhance UI in `components/Dashboard.html` with charts.
|
|
|
|
## MVP Feature Analysis (summary)
|
|
|
|
Goal: Identify core MVP features, acceptance criteria, and quick estimates.
|
|
|
|
### Edge cases to consider
|
|
|
|
- Large simulation runs (memory / timeouts) — use streaming, chunking, or background workers.
|
|
- DB migration and schema versioning.
|
|
- Authentication/authorization for scenario access.
|
|
|
|
### Next actionable items
|
|
|
|
1. Break Scenario Management into sub-issues (models, routes, tests, simple UI).
|
|
1. Scaffold Parameter Input & Validation (models/parameters.py, middleware, routes, tests).
|
|
1. Prototype the simulation engine with a small deterministic runner and unit tests.
|
|
1. Scaffold Monte Carlo Simulation endpoints (`services/simulation.py`, `routes/simulations.py`, tests).
|
|
1. Scaffold Reporting endpoints (`services/reporting.py`, `routes/reporting.py`, front-end Dashboard, tests).
|
|
1. Add CI job for tests and coverage.
|
|
|
|
See [UI and Style](docs/architecture/13_ui_and_style.md) for the UI template audit, layout guidance, and next steps.
|