Files
calminer/docs/architecture/04_solution_strategy_extended.md

4.7 KiB

Implementation Plan (extended)

This file contains the implementation plan (MVP features, steps, and estimates).

Project Setup

  1. Connect to PostgreSQL database with schema calminer.
  2. Create and activate a virtual environment and install dependencies via requirements.txt.
  3. Define environment variables in .env, including DATABASE_URL.
  4. Configure FastAPI entrypoint in main.py to include routers.

Feature: Scenario Management

Scenario Management — Steps

  1. Create models/scenario.py for scenario CRUD.
  2. Implement API endpoints in routes/scenarios.py (GET, POST, PUT, DELETE).
  3. Write unit tests in tests/unit/test_scenario.py.
  4. Build UI component components/ScenarioForm.html.

Feature: Process Parameters

Parameters — Steps

  1. Create models/parameters.py for process parameters.
  2. Implement Pydantic schemas in routes/parameters.py.
  3. Add validation middleware in middleware/validation.py.
  4. Write unit tests in tests/unit/test_parameter.py.
  5. Build UI component components/ParameterInput.html.

Feature: Stochastic Variables

Stochastic Variables — Steps

  1. Create models/distribution.py for variable distributions.
  2. Implement API routes in routes/distributions.py.
  3. Write Pydantic schemas and validations.
  4. Write unit tests in tests/unit/test_distribution.py.
  5. Build UI component components/DistributionEditor.html.

Feature: Cost Tracking

Cost Tracking — Steps

  1. Create models/capex.py and models/opex.py.
  2. Implement API routes in routes/costs.py.
  3. Write Pydantic schemas for CAPEX/OPEX.
  4. Write unit tests in tests/unit/test_costs.py.
  5. 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.
  2. Implement API routes in routes/consumption.py.
  3. Write Pydantic schemas for consumption data.
  4. Write unit tests in tests/unit/test_consumption.py.
  5. Build UI component components/ConsumptionDashboard.html.

Feature: Production Output

Production Output — Steps

  1. Create models/production_output.py.
  2. Implement API routes in routes/production.py.
  3. Write Pydantic schemas for production output.
  4. Write unit tests in tests/unit/test_production.py.
  5. Build UI component components/ProductionChart.html.

Feature: Equipment Management

Equipment Management — Steps

  1. Create models/equipment.py for equipment data.
  2. Implement API routes in routes/equipment.py.
  3. Write Pydantic schemas for equipment.
  4. Write unit tests in tests/unit/test_equipment.py.
  5. Build UI component components/EquipmentList.html.

Feature: Maintenance Logging

Maintenance Logging — Steps

  1. Create models/maintenance.py for maintenance events.
  2. Implement API routes in routes/maintenance.py.
  3. Write Pydantic schemas for maintenance logs.
  4. Write unit tests in tests/unit/test_maintenance.py.
  5. Build UI component components/MaintenanceLog.html.

Feature: Monte Carlo Simulation Engine

Monte Carlo Engine — Steps

  1. Implement Monte Carlo logic in services/simulation.py.
  2. Persist results in models/simulation_result.py.
  3. Expose endpoint in routes/simulations.py.
  4. Write integration tests in tests/unit/test_simulation.py.
  5. Build UI component components/SimulationRunner.html.

Feature: Reporting / Dashboard

Reporting / Dashboard — Steps

  1. Implement report calculations in services/reporting.py.
  2. Add detailed and summary endpoints in routes/reporting.py.
  3. Write unit tests in tests/unit/test_reporting.py.
  4. 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).
  2. Scaffold Parameter Input & Validation (models/parameters.py, middleware, routes, tests).
  3. Prototype the simulation engine with a small deterministic runner and unit tests.
  4. Scaffold Monte Carlo Simulation endpoints (services/simulation.py, routes/simulations.py, tests).
  5. Scaffold Reporting endpoints (services/reporting.py, routes/reporting.py, front-end Dashboard, tests).
  6. Add CI job for tests and coverage.

See UI and Style for the UI template audit, layout guidance, and next steps.