The Problem with Raw User Data
When building the backend for an urban infrastructure platform, the biggest bottleneck isn't the database, it's the users. A citizen reporting a problem rarely uses structured terminology. They don't say, "Electrical failure, Priority 1, Jurisdiction: City Council." They say, "The streetlamp on 5th avenue is sparking and my dog is terrified."
Passing this raw text directly into a database requires a human administrator to manually read and route every single ticket. To automate this, we need to extract structured JSON from unstructured panic.
The RAG Solution
Instead of relying on a raw LLM (which might hallucinate categories that our database doesn't accept), we implemented a lightweight Retrieval-Augmented Generation (RAG) pipeline in Node.js.…