Logo Lanfrica

Ndala-create/mychingola-ml

Domain:

natural language processing

Record type:

software
Creator:
Nda
Host:
# MyChingola ML Triage Service A local, 100% free and open-source NLP service that automatically: 1. **Routes citizen complaints** to the correct council department (Water & Sanitation, Engineering/Roads, Public Health) using TF-IDF + Logistic Regression. 2. **Flags abusive/inappropriate language** before reports reach the Town Clerk, using a locally-editable wordlist. Built for the JETS/TETS DRIS submission — runs entirely on local hardware, no cloud APIs, no per-request cost, and citizen data never leaves council infrastructure. ## Setup ```bash pip install -r requirements.txt python train_model.py # trains and saves model artifacts (~seconds) uvicorn main:app --reload --port 8000 ``` The service will be available at `localhost`. ## Endpoints ### `GET /` Health check — confirms the service is running. ### `POST /triage` ```json // Request { "description": "Large pothole on the main road near the market" } // Response { "flagged": false, "status": "Report Received", "department": "Engineering/Roads", "confidence": 0.54, "auto_routed": true } ``` ## Files - `training_data.csv` — synthetic labelled complaints (department classification training set) - `flagged_terms.py` — editable wordlist for content moderation - `train_model.py` — trains TF-IDF vectorizer + Logistic Regression classifier - `ml_triage.py` — core inference logic (loaded once at startup) - `main.py` — FastAPI app exposing `/triage` ## Retraining As the Town Clerk corrects ML-suggested departments, log those corrections and append them to `training_data.csv`, then re-run `python train_model.py` to improve accuracy over time — no infrastructure changes required. ## Frontend Integration `ReportForm.jsx` calls `POST localhost` with the report description before submitting to Supabase, then stores `department`, `ml_confidence`, `auto_routed`, and `status`/`flagged` on the report row.

Languages