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:
@@ -6,41 +6,66 @@
|
||||
- PostgreSQL (version 13+)
|
||||
- Git
|
||||
|
||||
## Clone and Project Setup
|
||||
|
||||
```powershell
|
||||
# Clone the repository
|
||||
git clone https://git.allucanget.biz/allucanget/calminer.git
|
||||
cd calminer
|
||||
```
|
||||
|
||||
## Virtual Environment
|
||||
|
||||
```powershell
|
||||
# Create and activate a virtual environment
|
||||
python -m venv .venv
|
||||
.\.venv\Scripts\Activate.ps1
|
||||
```
|
||||
|
||||
## Install Dependencies
|
||||
|
||||
```powershell
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Database Setup
|
||||
|
||||
1. Install PostgreSQL and create a database named `calminer`.
|
||||
|
||||
2. Create schema `bricsium_platform`:
|
||||
1. Create database user:
|
||||
|
||||
```sql
|
||||
CREATE SCHEMA bricsium_platform;
|
||||
CREATE USER calminer_user WITH PASSWORD 'your_password';
|
||||
```
|
||||
|
||||
3. Load the schema from `structure.sql`:
|
||||
2. Create database:
|
||||
|
||||
```bash
|
||||
psql -d calminer -f structure.sql
|
||||
```sql
|
||||
CREATE DATABASE calminer;
|
||||
```
|
||||
|
||||
## Backend Setup
|
||||
## Environment Variables
|
||||
|
||||
1. Clone the repo.
|
||||
2. Create a virtual environment: `python -m venv .venv`
|
||||
3. Activate it: `.venv\Scripts\activate` (Windows) or `source .venv/bin/activate` (Linux/Mac)
|
||||
4. Install dependencies: `pip install -r requirements.txt`
|
||||
5. Set up environment variables (e.g., DB connection string in .env).
|
||||
6. Run migrations if any.
|
||||
7. Start server: `python main.py` or `uvicorn main:app --reload`
|
||||
1. Copy `.env.example` to `.env` at project root.
|
||||
2. Edit `.env` to set database connection string:
|
||||
|
||||
## Frontend Setup
|
||||
```dotenv
|
||||
DATABASE_URL=postgresql://<user>:<password>@localhost:5432/calminer
|
||||
```
|
||||
|
||||
(TBD - add when implemented)
|
||||
3. The application uses `python-dotenv` to load these variables.
|
||||
|
||||
## Running Locally
|
||||
## Running the Application
|
||||
|
||||
- Backend: `uvicorn main:app --reload`
|
||||
- Frontend: (TBD)
|
||||
```powershell
|
||||
# Start the FastAPI server
|
||||
uvicorn main:app --reload
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
- Run tests: `pytest`
|
||||
```powershell
|
||||
pytest
|
||||
```
|
||||
|
||||
## Frontend Setup
|
||||
|
||||
(TBD - add when frontend implemented)
|
||||
|
||||
Reference in New Issue
Block a user