Feature-complete backend repository for the hackathon.
app/-> active FastAPI backendapi/endpointscore/database models + schedulertriggers/weather + fraud trigger logicservices/pricing, ML+SHAP prediction, PDF generation, model training utilitytests/contract tests
docs/API_CONTRACT.md-> frontend/backend integration contractdocs/BACKEND_RUNBOOK.md-> backend owner runbook + curl payloads + error handlingmain.py-> root ASGI entrypoint (app.main:app)requirements.txt-> single dependency source
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --reload --port 8000- ML status:
GET /api/premium/model-status - Premium prediction (ML-first with fallback):
POST /api/premium/predict - Policy PDF download:
GET /api/policies/{rider_id}/current/document - Optional local model training:
python app/services/train_model.py
POST /api/demo/bootstrapPOST /api/triggers/simulateGET /api/claims/{rider_id}GET /api/policies/{rider_id}/currentGET /api/policies/{rider_id}/current/document
python3 -m unittest app.tests.test_phase2_contracts -v
python3 -m unittest app.tests.test_api_endpoints -vThis repo includes render.yaml and Procfile for Render deployment.
- Create a Blueprint service in Render and point it to this repository.
- Set service root to
protoryde-backendif deploying from the umbrella repo. - Render provisions
protoryde-dbfromrender.yamland injectsDATABASE_URL. - Keep
ENABLE_SCHEDULER=falsein production unless you intentionally want live polling.
- Run preflight locally:
./scripts/render_preflight.sh
- Deploy from Render Blueprint.
- Run live smoke checks against Render URL:
BACKEND_URL=https://<your-service>.onrender.com ./scripts/render_live_smoke.sh
See full guide: docs/RENDER_FIRST_DEPLOY.md
- The app normalizes
postgres://topostgresql://automatically for SQLAlchemy compatibility. model.pklis optional; premium prediction falls back to the rule engine when the model is absent.