A small fleet management and simulation project providing a REST API, a GPS simulator, and pretrained models for maintenance risk prediction.
- Python 3.8+ installed
- PostgreSQL installed (if you want to run the API with a local database)
- Clone the repository.
- Create and activate a virtual environment (macOS / Linux):
python3 -m venv venv source venv/bin/activate - Install dependencies:
pip install -r requirements.txt
- Copy the example environment file and update values:
If
cp .env.example .env # edit .env and fill in your DB credentials and any other variables.env.exampleis not present, create a.envwith the database connection information you use for theapiservice. - Keep .env inside both the 'api' and 'Data Seeding and simulation' folder.
- Create a PostgreSQL user and database (example):
sudo -u postgres psql CREATE USER fms_user WITH PASSWORD 'your_password'; CREATE DATABASE fms_db OWNER fms_user; \q
- Import schema (if
schema.sqlexists at repo root):psql -U fms_user -d fms_db -f schema.sql
- Run the seed script to populate initial data (if needed):
python "Data Seeding and Simulation/seed.py"
- Start the API server (from repository root):
python -m api.server
- Start the GPS simulator (from repository root):
python "Data Seeding and Simulation/gps_simulator.py" - Run the main application (if applicable):
Then open http://localhost:5000 (or the port printed by the app).
python app.py
Pretrained model artifacts are located in the Models/ directory, for example:
Models/pm_rf_days_regressor.joblibModels/pm_rf_risk_regressor.joblibModels/component_encoding.joblib
app.py— main application runnerapi/— API package (server, routes, services)Data Seeding and Simulation/— simulator and seed scriptsModels/— pretrained model artifactsrequirements.txt— Python dependencies
- If you get DB connection errors, check
.envvalues and ensure PostgreSQL is running. - If a module import fails, make sure the virtualenv is activated and
pip install -r requirements.txtcompleted successfully. - For paths with spaces (like
Data Seeding and Simulation) use quotes when running from shell.