Overview
Anar Insights is a decision intelligence platform that turns raw government data into actionable analytics. Ask questions in natural language -- English or Arabic -- and get structured data results with AI-suggested visualizations. Build executive dashboards, generate automated analytical reports, and connect multiple data sources.
Traditional BI tools require SQL knowledge and manual chart configuration. Insights eliminates that barrier: analysts and decision-makers type questions in plain language, and the platform translates them into structured queries, executes them against connected data sources, and returns results with the most appropriate visualization.
Key Capabilities
Natural Language Queries
Type a question like "Which department has the highest citizen satisfaction?" and Insights translates it into a structured query, executes it against your data, and returns tabular results with a suggested chart type (bar, line, pie, area, or table).
The query engine supports both English and Arabic, enabling bilingual analytics across government organizations.
AI Report Generation
Generate analytical reports from your data by specifying a title, data source, and focus areas. The LLM analyzes the underlying data and produces structured sections with key findings, supporting charts, and executive summaries.
Custom Dashboards
Build dashboards by dragging KPI cards, charts, and data tables onto a grid canvas. Widgets are positioned with x/y coordinates and sized with width/height values, enabling precise layout control. Dashboards persist across sessions and can be shared across teams.
Trends Analysis
Dedicated trends page with time-series visualizations across all connected data sources. Track KPIs over configurable time ranges with automated trend detection and anomaly highlighting.
CSV Upload and Data Import
Upload CSV files directly through the dashboard with automatic column type detection, duplicate detection, and data validation. Import and export data sources for portability across environments.
Data Source Connectors
Connect CSV files and REST APIs as data sources. Insights indexes the data, detects column types, and makes it available for natural language querying and dashboard widgets. Search across all data sources with full-text filtering.
Architecture
Insights uses a FastAPI backend on port 8010 and a Next.js dashboard on port 3011.
The backend contains three core modules: the NL Query Engine (translates natural language to structured queries via LLM, then executes against DataFrames), the Report Generator (LLM-powered multi-section analysis), and Data Connectors (CSV files and REST API integrations). Aggregation is handled by pandas.
Demo Data
Insights ships with two pre-loaded government datasets: Government Analytics 2024 (department budgets, spending, satisfaction) and Government Services Performance (service-level metrics, processing times, digital adoption).
Quick Start
cd insights/backend
uv sync
uv run uvicorn anar_insights.main:app --reload --port 8010
Ask a question:
curl -X POST http://localhost:8010/api/v1/insights/query \
-H "Content-Type: application/json" \
-d '{
"question": "Which department has the highest citizen satisfaction?",
"language": "en",
"source_id": "demo-gov-analytics"
}'
Dashboard
The Insights dashboard provides seven views:
- Overview -- Summary metrics, recent queries, and quick action shortcuts
- Query Console -- Natural language query input with tabular results and chart rendering
- Trends -- Time-series trend analysis with configurable date ranges and KPI tracking
- Dashboard Builder -- Drag-and-drop widget placement with KPI, chart, and table components
- Reports -- AI-generated analytical reports with key findings and visualizations
- Data Sources -- Connection management, CSV upload, and data import/export
- Search -- Full-text search across all data sources and query history
Observability
Insights is instrumented with OpenTelemetry via anar_shared.setup_otel(). When OTEL_EXPORTER_OTLP_ENDPOINT is set, traces, logs, and metrics are exported to the OTel Collector.
MCP Server
Insights exposes a Model Context Protocol server at /mcp via FastApiMCP, enabling AI assistants to run NL queries, manage dashboards, and generate reports programmatically.
Gateway Integration
When GATEWAY_URL is set, Insights routes LLM calls through Anar Gateway for unified cost tracking and safety scanning.
Test Suite
325 tests across 31 endpoints cover NL query engine, data connectors, CSV upload, trends analysis, dashboards, report generation, data import/export, duplicate detection, search, and API endpoints.
cd insights/backend && uv run pytest
Next Steps
- Data Sources -- Connecting CSV files and API integrations
- Dashboards -- Building and configuring executive dashboards
- Reports -- Generating AI-powered analytical reports
- API Reference -- Full endpoint documentation