Add initial implementation of CalMiner with project structure, environment setup, and core features

- Create .env.example for environment variables
- Update README with project structure and development setup instructions
- Implement FastAPI application with API routes for scenarios and parameters
- Add database models for scenarios, parameters, and simulation results
- Introduce validation middleware for JSON requests
- Create services for running simulations and generating reports
- Add testing strategy and directory structure in documentation
This commit is contained in:
2025-10-20 18:37:57 +02:00
parent cb9749010f
commit 39c45e720c
20 changed files with 604 additions and 64 deletions

View File

@@ -24,29 +24,67 @@ A range of features are implemented to support these functionalities.
The architecture is documented in [docs/architecture.md](docs/architecture.md).
## Project Structure
The project is organized into several key directories:
- `models/`: Contains SQLAlchemy models representing database tables.
- `routes/`: Defines FastAPI routes for API endpoints.
- `services/`: Business logic and service layer.
- `components/`: Frontend components (to be defined).
- `config/`: Configuration files and settings.
- `middleware/`: Custom middleware for request/response processing.
- `tests/`: Unit and integration tests.
- `templates/`: HTML templates (if applicable).
- `docs/`: Documentation files.
Key files include:
- `main.py`: FastAPI application entry point.
- `.env`: Environment variables for configuration.
- `requirements.txt`: Python dependencies.
## Development
The development setup instructions are provided in [docs/development_setup.md](docs/development_setup.md).
To get started locally:
```powershell
# Clone the repository
git clone https://git.allucanget.biz/allucanget/calminer.git
cd calminer
# Create and activate a virtual environment
python -m venv .venv
.\.venv\Scripts\Activate.ps1
# Install dependencies
pip install -r requirements.txt
# Start the development server
uvicorn main:app --reload
```
## Testing
Testing guidelines and best practices are outlined in [docs/testing.md](docs/testing.md).
## Database Objects
The database is composed of several tables that store different types of information. All tables are under schema `bricsium_platform`. See `structure.sql` for full DDL. Here are some of the most important ones:
The database is composed of several tables that store different types of information.
- **CAPEX** — `bricsium_platform.capex`: Stores data on capital expenditures.
- **OPEX** — `bricsium_platform.opex`: Contains information on operational expenditures.
- **Chemical consumption** — `bricsium_platform.chemical_consumption`: Tracks the consumption of chemical reagents.
- **Fuel consumption** — `bricsium_platform.fuel_consumption`: Records the amount of fuel consumed.
- **Water consumption** — `bricsium_platform.water_consumption`: Monitors the use of water.
- **Scrap consumption** — `bricsium_platform.scrap_consumption`: Tracks the consumption of scrap materials.
- **Production output** — `bricsium_platform.production_output`: Stores data on production output, such as tons produced and recovery rates.
- **Equipment operation** — `bricsium_platform.equipment_operation`: Contains operational data for each piece of equipment.
- **Ore batch** — `bricsium_platform.ore_batch`: Stores information on ore batches, including their grade and other characteristics.
- **Exchange rate** — `bricsium_platform.exchange_rate`: Contains currency exchange rates.
- **Simulation result** — `bricsium_platform.simulation_result`: Stores the results of the Monte Carlo simulations.
- **CAPEX** — `capex`: Stores data on capital expenditures.
- **OPEX** — `opex`: Contains information on operational expenditures.
- **Chemical consumption** — `chemical_consumption`: Tracks the consumption of chemical reagents.
- **Fuel consumption** — `fuel_consumption`: Records the amount of fuel consumed.
- **Water consumption** — `water_consumption`: Monitors the use of water.
- **Scrap consumption** — `scrap_consumption`: Tracks the consumption of scrap materials.
- **Production output** — `production_output`: Stores data on production output, such as tons produced and recovery rates.
- **Equipment operation** — `equipment_operation`: Contains operational data for each piece of equipment.
- **Ore batch** — `ore_batch`: Stores information on ore batches, including their grade and other characteristics.
- **Exchange rate** — `exchange_rate`: Contains currency exchange rates.
- **Simulation result** — `simulation_result`: Stores the results of the Monte Carlo simulations.
## Static Parameters