Project Name: UIDAI OpsCommand Dashboard
One-liner: A comprehensive, real-time-simulated operations command dashboard for UIDAI to monitor Aadhaar operations, security (Satark), compliance (Saksham), field tasks (Kartavya), and migration trends (Pravas).
Problem Solved: Adhaar operations generate massive amounts of data across scattered systems. Administrators lack a unified "Single Pane of Glass" to visualize fraud anomalies, monitor MBU (Mandatory Biometric Update) compliance backlogs, and efficiently allocate field tasks based on geospatial insights.
Target Audience: UIDAI Administrators, Field Operation Managers, and Data Analysts.
- Framework: React 18 with TypeScript
- Build Tool: Vite (SWC plugin)
- Styling: Tailwind CSS + Shadcn UI (Radix Primitives) + Lucide React Icons
- State Management: React Hooks (
useState,useContext,useMemo) + TanStack Query (configured but primarily used for JSON fetching) - Visualization: Recharts (Bar, Scatter, Pie charts)
- Animations: Framer Motion (
AnimatePresence,motion.div) - PDF Generation: jsPDF (Client-side generation)
- Routing: React Router DOM (v6)
Note: The current codebase consumes a static app_data.json. The architecture implies a backend data pipeline.
- Logic: Python Data Pipeline (
generate_insights.py) - Functions: Data cleaning, multi-part CSV ingestion, and JSON output generation.
- Output:
app_data.jsonserved statically to the frontend.
- Anomaly Detection: Ensemble learning approach (Isolation Forest, Local Outlier Factor) to score "Fraud Probability" and "Confidence".
- Logic: identifying unusual patterns in enrollment data (e.g., high update frequency in specific pincodes).
- Hosting: Static Site Generation (Vite Build) -> Capable of deploying to Vercel, Netlify, or S3.
- Asset Delivery: Public directory serving
app_data.json.
Logic: Generates a multi-page executive summary PDF directly in the browser. It captures the current state of the dashboard, including filtered metrics, critical alerts, and top deficit districts.
- Key File:
src/utils/pdfGenerator.ts - Algorithm:
- Canvas Drawing: Uses
jspdfprimitive shapes (rect,text) to draw headers/footers manually. - Dynamic Pagination: Tracks
yPos(vertical cursor); checksif (yPos > 250)to triggerpdf.addPage(). - Data Filtering: Injects current
AppDataandFilterStateto render contextual "Applied Filters" and specific filtered lists (e.g., "Top 5 Fraud Cases"). - Formatting: Auto-formats numbers with
toLocaleStringand dates withtoLocaleDateString('en-IN').
- Canvas Drawing: Uses
Logic: The raw JSON data contains unstructured text fields (e.g., WhatsApp messages) that need to be parsed into structured data for filtering.
- Key File:
src/hooks/useAppData.ts - Algorithm:
- Regex Parsing: Uses regex
/📍\s*([^,\n]+),\s*([^\n]+)/to extract "District" and "State" fromwhatsapp_msgstring inaction_tickets. - Memoization: Uses
useMemoto re-calculate derived datasets (filteredActionTickets,uniqueStates,uniqueDistricts) only whenfiltersordatachange, optimizing performance for large datasets. - Client-Side Search: Implements multi-field search (Pincode, District, Task Name) using
toLowerCase().includes().
- Regex Parsing: Uses regex
Logic: Displays fraud/anomaly detection results with visual indicators for risk levels.
- Key File:
src/components/dashboard/SatarkView.tsx - Visualization: Uses
rechartsto render:- Confidence Distribution: Pie Chart showing the breakdown of High/Medium/Low confidence alerts.
- Metric Cards: React components displaying aggregated counters (Total Analyzed, High Risk).
graph TD
subgraph Data_Pipeline_Backend
A[Raw CSV Data] -->|Ingest| B(Python Processing Script)
B -->|ML Ensemble| C{Anomaly Detection Models}
C -->|Score & Aggregate| D[JSON Generator]
D -->|Output| E(public/app_data.json)
end
subgraph Frontend_Repo
F[React App] -->|Fetch| E
G[DataManager Context] -->|Parse & Enrich| F
H[Dashboard View] -->|Read State| G
I[PDF Generator] -->|Read State| G
end
E -.->|Static Serve| F
sequenceDiagram
participant User
participant Browser as Frontend (React)
participant DataLayer as useAppData Hook
participant StaticAssets as public/app_data.json
User->>Browser: Opens Dashboard (Load Page)
Browser->>DataLayer: Mount Component
DataLayer->>StaticAssets: GET /app_data.json
StaticAssets-->>DataLayer: Return JSON Payload (2MB+)
rect rgb(240, 248, 255)
Note over DataLayer: Client-Side Processing
DataLayer->>DataLayer: Parse JSON
DataLayer->>DataLayer: Regex Extract (District/State)
DataLayer->>DataLayer: Apply Initial Filters
end
DataLayer-->>Browser: Update State (data, loading=false)
Browser-->>User: Render Dashboard UI
User->>Browser: Select "Satark" Tab
Browser->>Browser: Animate Transition (Framer Motion)
Browser-->>User: Show Anomaly Charts
User->>Browser: Click "Download Report"
Browser->>Browser: Execute generatePDFReport(data)
Browser-->>User: Prompt File Download (.pdf)
Problem: The raw ticket data comes with a free-text whatsapp_msg field containing the location, rather than structured state and district columns. This makes filtering by State or District impossible on the raw JSON.
Solution: Implemented a Regex-based parser in useAppData.ts (extractLocationFromMessage). This runs once on data load to "enrich" the action_tickets array, creating virtual columns for district and state that power the FilterBar and uniqueDistricts logic.
Problem: The Executive Summary report length varies based on the number of filtered items (e.g., number of Fraud Cases). A static layout would cut off content or overflow the page.
Solution: Used a "cursor-based" rendering approach in pdfGenerator.ts. A yPos variable tracks the current vertical position. Before rendering a new section, the code checks if (yPos > 250). If true, it calls pdf.addPage() and resets yPos = 20, ensuring content flows gracefully across multiple pages.
Problem: Filtering thousands of compliance_map_data entries on every keystroke in the search bar causes UI lag.
Solution: Heavily leveraged useMemo in useFilteredData. The derived arrays (filteredActionTickets, filteredComplianceData) are only recalculated when dependencies (data, filters) strictly change. This prevents expensive array iterations on purely cosmetic re-renders (like opening the sidebar).
- Node.js: v18.0.0 or higher
- npm: v9.0.0 or higher
- Git
Create a .env file in the root directory (optional for this version as it uses static data):
VITE_API_URL=http://localhost:8000 # If connecting to a live backend-
Clone the repository:
git clone https://github.com/Mrigank005/UIDAI-Hackathon-Frontend.git cd UIDAI-Hackathon-Frontend -
Install Dependencies:
npm install
-
Run Development Server:
npm run dev
Access the app at
http://localhost:8080. -
Build for Production:
npm run build npm run preview