AI-Powered Civic Intelligence Platform
Know who's accountable. Every civic issue. Every Indian citizen.
Java 21 Β· Spring Boot 3.5 Β· PostgreSQL Β· React 19 Β· CI/CD Β· MIT License
Live Demo Β· API Docs Β· GitLab
CivicOS empowers 1.4 billion Indian citizens to identify exactly who is responsible for any civic issue. A single plain-language search resolves to the accountable government department, the currently posted official with contact details, governing legislation, and actionable steps to file complaints β all in under 200ms.
The platform features The Civic Record, a newspaper-style frontend that aggregates real-time civic news with AI-matched accountability data, and an integrated complaint filing system with real-time status tracking.
Input: exam leak
| Field | Result |
|---|---|
| Responsible Department | National Testing Agency |
| Current Official | Pradeep Singh Kharola, Director General β dg@nta.ac.in |
| Accountability Chain | NTA β Ministry of Education |
| Governing Law | Right to Information Act, 2005 |
| Complaint Portal | RTI Online |
| Citizen Actions | File RTI β Contact NTA grievance cell β Escalate to MoE |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β The Civic Record (Frontend) β
β React 19 β’ Vite β’ Vercel β’ TypeScript β
β β
β ββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββ β
β β India Map Search β β Complaint System β β
β β β’ Location Search β β β’ File Complaint β β
β β β’ Incident Search β β β’ Track Complaint β β
β β β’ Filters β β β’ Status Timeline β β
β ββββββββββββ¬ββββββββββββ ββββββββββββββββ¬ββββββββββββββββ β
ββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ
β β
βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CivicOS Backend API (Spring Boot 3.5) β
β Java 21 β’ Render β’ GitLab CI/CD β
β β
β ββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Incident Search β β Complaint Service β β
β ββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β 1. Keyword Search (GIN) β β β’ File Complaint β β
β β 2. Semantic Search β β β’ Generate Tracking ID β β
β β (pgvector) β β β’ Track Complaint β β
β β 3. LLM Classification β β β’ Status Timeline β β
β β (Groq Llama 3.3 70B) β β β’ Government Portal Linking β β
β ββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β ββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Accountability Engine β β News & Daily Edition β β
β ββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β β’ Recursive CTE β β β’ NewsData.io Aggregation β β
β β β’ Department Hierarchy β β β’ AI Department Mapping β β
β β β’ Governing Acts β β β’ Daily Newspaper Generation β β
β β β’ Jurisdiction Lookup β β β’ Front Page Rendering β β
β ββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β ββββββββββββββββββββββββββββββ β
β β Official Posting Service β β
β ββββββββββββββββββββββββββββββ β
β β β’ Temporal Queries β β
β β β’ Current Officials β β
β β β’ Historical Records β β
β ββββββββββββββββββββββββββββββ β
β β
β Apache Kafka β Search Analytics β
βββββββββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Supabase PostgreSQL 16 + pgvector β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β β’ departments β’ officials β’ official_postings β
β β’ incident_categories β’ complaints β’ complaint_status_history β
β β’ news_articles β’ daily_editions β’ acts β
β β’ embeddings β’ search_analytics β’ jurisdictions β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | React 19, Vite | Newspaper-style SPA |
| Backend | Java 21, Spring Boot 3.5 | REST API |
| Database | PostgreSQL 16 (Supabase) | Primary data store |
| Migrations | Flyway | Schema versioning |
| ORM | Spring Data JPA, Hibernate | Data access |
| Search | GIN indexes, pgvector | Keyword + semantic search |
| LLM | Groq (Llama 3.3 70B) | Classification fallback |
| Embeddings | Ollama (nomic-embed-text) | Vector search |
| News | NewsData.io API | Real-time civic news |
| Events | Apache Kafka | Search analytics |
| CI/CD | GitLab | Build, test, SAST, secret detection |
| Frontend Hosting | Vercel | Auto-deploy on push |
| Backend Hosting | Render | Auto-deploy on push |
| Testing | JUnit 5, Testcontainers | Integration tests |
Every query passes through three layers before returning "no match":
| Tier | Method | Latency | Coverage |
|---|---|---|---|
| 1 | GIN-indexed keyword match | ~5ms | Exact keyword hits |
| 2 | pgvector embedding similarity | ~50ms | Semantic matches |
| 3 | Groq Llama 3.3 70B classification | ~800ms | Fuzzy / out-of-vocabulary |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Complaint Processing Pipeline β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββ
β SUBMITTED β
ββββββββ¬ββββββββ
β
βΌ
ββββββββββββββββ
βACKNOWLEDGED β
βββββ¬βββββββ¬ββββ
β β
β βββββββββββββββββββββββββββββββ
βΌ βΌ
ββββββββββββββββ ββββββββββββββββ
β IN_PROGRESS β β REJECTED β
βββββ¬βββββββ¬ββββ ββββββββββββββββ
β β
β βββββββββββββββββββββββββββββββ
βΌ βΌ
ββββββββββββββββ ββββββββββββββββ
β RESOLVED β β REJECTED β
ββββββββββββββββ ββββββββββββββββ
Status Flow:
SUBMITTED β ACKNOWLEDGED β IN_PROGRESS β RESOLVED
β β
ββββββββΊ REJECTED ββββββββ
- Auto-generated tracking IDs (
CIV-YYYY-NNNNN) - Transaction-safe filing with duplicate-key retry (
REQUIRES_NEWpropagation) - Real-time tracking with visual status timeline
- Direct links to official government complaint portals
- Aggregates civic news from 1000+ Indian sources via NewsData.io
- AI-matches each article to accountable departments
- Generates a newspaper-style front page with accountability overlay
- Manual refresh capability from the frontend
# Search with jurisdiction context
curl "https://civicos-r2sf.onrender.com/api/v1/incidents/search?query=exam+leak&stateCode=DL&districtCode=ND"
# Track a complaint
curl "https://civicos-r2sf.onrender.com/api/v1/complaints/track/CIV-2026-00001"| Method | Endpoint | Description |
|---|---|---|
GET |
/api/v1/incidents/search |
Three-tier incident search |
GET |
/api/v1/departments/{code}/officials |
Current officials |
GET |
/api/v1/departments/{code}/officials?asOf={date} |
Point-in-time officials |
POST |
/api/v1/complaints?categoryCode=X&departmentCode=Y |
File a complaint |
GET |
/api/v1/complaints/track/{id} |
Track complaint status |
PATCH |
/api/v1/complaints/{id}/status?newStatus=X |
Update complaint status |
GET |
/api/v1/news/latest |
Latest civic news |
GET |
/api/v1/news/edition/today |
Today's front page |
POST |
/api/v1/news/edition/generate?force=true |
Regenerate edition |
POST |
/api/v1/news/fetch |
Trigger news fetch |
src/main/java/com/civicos/platform/
βββ common/
β βββ ai/ # EmbeddingService, LlmClassificationService
β βββ exception/ # Global exception handling, ErrorCode enum
β βββ kafka/ # SearchEventProducer, SearchEvent
β βββ logging/ # Request tracing filter
β βββ response/ # ApiResponse envelope
βββ config/ # CORS, security, web configuration
βββ domain/
βββ act/ # Acts & Legislation
β βββ api/ # REST controller
β βββ application/ # ActService, ActResponse
β βββ domain/ # Act entity, ActRepository
βββ complaint/ # Complaint System
β βββ api/ # ComplaintController
β βββ application/ # ComplaintService, ComplaintResponse
β βββ domain/ # Complaint entity, ComplaintRepository
βββ department/ # Department Hierarchy
β βββ api/ # DepartmentController
β βββ application/ # AccountabilityService, AccountabilityNode
β βββ domain/ # Department entity, recursive CTE queries
βββ incident/ # Incident Search
β βββ api/ # IncidentController
β βββ application/ # IncidentSearchService (3-tier)
β βββ domain/ # IncidentCategory, GIN/vector queries
βββ news/ # News & Edition
β βββ api/ # NewsController
β βββ application/ # NewsFetchService, DailyEditionService
β βββ domain/ # NewsArticle, DailyEdition entities
βββ official/ # Officials & Postings
βββ api/ # OfficialController
βββ application/ # OfficialService
βββ domain/ # Official entity, temporal queries
Temporal Postings with Physical Guarantees PostgreSQL exclusion constraints prevent two active officials for the same department β enforced at the database level, not just application logic:
EXCLUDE USING gist (
department_id WITH =,
daterange(start_date, COALESCE(end_date,'9999-12-31'),'[]') WITH &&
)WITH RECURSIVE accountability_chain AS (
SELECT id, name, code, parent_department_id, 0 AS depth
FROM departments WHERE id = :departmentId
UNION ALL
SELECT d.id, d.name, d.code, d.parent_department_id, ac.depth + 1
FROM departments d
INNER JOIN accountability_chain ac ON d.id = ac.parent_department_id
)
SELECT * FROM accountability_chain ORDER BY depth ASC- Java 21
- Docker Desktop
- Git
- Groq API Key
- NewsData.io API Key
- Supabase
# Clone
git clone https://gitlab.com/shresthbhargava/civic-record.git
cd civic-record
# Environment variables
export GROQ_API_KEY=gsk_xxx
export NEWSDATA_API_KEY=xxx
export SPRING_DATASOURCE_URL=jdbc:postgresql://...
export SPRING_DATASOURCE_USERNAME=postgres
export SPRING_DATASOURCE_PASSWORD=xxx
# Start local PostgreSQL
docker-compose up -d
# Run
./gradlew bootRun./gradlew testTests use Testcontainers β Docker must be running.
GitLab pipelines run automatically on every push:
| Stage | Jobs | What it does |
|---|---|---|
build |
compileJava | Compilation check |
test |
test | JUnit 5 + Testcontainers |
security |
sast, secret_detection | Vulnerability & secret scanning |
| Component | Platform |
|---|---|
| Frontend | Vercel |
| Backend | Render |
| Database | Supabase |
| CI/CD | GitLab |
MIT License.
Built with determination for 1.4 billion citizens.
Built by Shresth Bhargava