# sujayv26/smarty_vibz_sih architecture

> Architecture diagram of the GitHub repository sujayv26/smarty_vibz_sih, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sujayv26/smarty_vibz_sih
- Repository: https://github.com/sujayv26/smarty_vibz_sih

## Overview

CONSight is a schedule-intelligence API that turns field reports into schedule-linked progress: reports arrive through text, spreadsheets, WhatsApp, voice or scanned diaries; extraction creates progress events; matching proposes schedule activities; confidence scoring either auto-matches or sends uncertain results to planner review and audit. Separate capabilities manage schedule import/export, delay analysis and institutional-memory analytics. The README documents these broader features; sampled source confirms the matching, confidence, persistence and WhatsApp paths, but not every route-to-service connection.

Main entry points: [`backend/app/services/confidence_service.py`](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/confidence_service.py) (Confidence Service), [`backend/app/models/schedule.py`](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/models/schedule.py) (Schedule Data), [`backend/app/services/extraction_service.py`](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/extraction_service.py) (Extraction Service), [`backend/app/matching/engine.py`](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/matching/engine.py) (Matching Engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Field Ingestion"]
  node_progress_api["Progress API<br/>[progress.py]"]
  node_whatsapp["WhatsApp Webhook<br/>[webhooks.py]"]
  node_voice["Voice Service<br/>[voice_service.py]"]
  node_ocr["OCR Service<br/>[ocr_service.py]"]
  node_extract["Extraction Service"]
  node_excel_progress["Excel Progress"]
end

subgraph group_schedule["Schedule Management"]
  node_schedule_api["Schedule API<br/>[schedule.py]"]
  node_xer_api["XER Import Export<br/>[xer_import.py]"]
  node_xer_service["XER Services<br/>[service.py]"]
end

subgraph group_match["Matching And Review"]
  node_match_api["Matching API<br/>[matching.py]"]
  node_match_engine["Matching Engine<br/>[engine.py]"]
  node_confidence_api["Confidence API<br/>[confidence.py]"]
  node_confidence["Confidence Service"]
  node_confidence_engine["Confidence Scoring"]
  node_reviews_api["Planner Reviews<br/>[reviews.py]"]
end

subgraph group_intelligence["Schedule Intelligence"]
  node_delay["Delay Analysis"]
  node_prediction["Delay Prediction"]
  node_analytics["Institutional Analytics"]
end

subgraph group_platform["API And Persistence"]
  node_api["FastAPI Application<br/>[main.py]"]
  node_progress_store[("Progress Events<br/>[progress.py]")]
  node_schedule_store[("Schedule Data<br/>[schedule.py]")]
  node_review_store[("Reviews And Audit<br/>[confidence.py]")]
  node_db[("Database Sessions<br/>[database.py]")]
end

node_field(("Field Reporter"))
node_planner(("Planner"))

node_field -->|"submits reports"| node_progress_api
node_field -->|"sends messages"| node_whatsapp
node_field -->|"provides speech"| node_voice
node_field -->|"provides diaries"| node_ocr
node_progress_api -->|"extracts text"| node_extract
node_progress_api -->|"imports spreadsheet"| node_excel_progress
node_whatsapp -->|"processes message"| node_extract
node_voice -.->|"transcribes report"| node_extract
node_ocr -.->|"extracts report"| node_extract
node_extract -->|"creates events"| node_progress_store
node_excel_progress -->|"writes events"| node_progress_store
node_schedule_api -->|"manages activities"| node_schedule_store
node_xer_api -->|"imports exports"| node_xer_service
node_xer_service -->|"imports activities"| node_schedule_store
node_match_api -->|"runs matching"| node_match_engine
node_match_engine -->|"reads events"| node_progress_store
node_match_engine -->|"reads candidates"| node_schedule_store
node_confidence_api -->|"evaluates event"| node_confidence
node_whatsapp -->|"evaluates result"| node_confidence
node_confidence -->|"requests matches"| node_match_engine
node_confidence -->|"scores candidates"| node_confidence_engine
node_confidence -->|"writes decisions"| node_review_store
node_confidence -->|"updates auto-match"| node_progress_store
node_reviews_api -->|"handles decisions"| node_confidence
node_planner -->|"reviews candidates"| node_reviews_api
node_confidence -->|"creates activity"| node_schedule_store
node_delay -->|"analyzes schedule"| node_schedule_store
node_prediction -->|"reads schedule"| node_schedule_store
node_analytics -->|"analyzes history"| node_schedule_store
node_api -->|"configures sessions"| node_db

click node_api "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/main.py"
click node_progress_api "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/api/progress.py"
click node_whatsapp "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/api/webhooks.py"
click node_voice "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/voice_service.py"
click node_ocr "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/ocr_service.py"
click node_extract "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/extraction_service.py"
click node_excel_progress "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/excel_progress_service.py"
click node_progress_store "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/models/progress.py"
click node_schedule_api "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/api/schedule.py"
click node_xer_api "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/api/xer_import.py"
click node_xer_service "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/xer/service.py"
click node_schedule_store "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/models/schedule.py"
click node_match_api "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/api/matching.py"
click node_match_engine "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/matching/engine.py"
click node_confidence_api "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/api/confidence.py"
click node_confidence "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/confidence_service.py"
click node_confidence_engine "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/confidence_engine.py"
click node_reviews_api "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/api/reviews.py"
click node_review_store "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/models/confidence.py"
click node_delay "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/delay_ripple_service.py"
click node_prediction "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/ml_delay_service.py"
click node_analytics "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/analytics_service.py"
click node_db "https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/database.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_progress_api,node_whatsapp,node_voice,node_ocr,node_extract,node_excel_progress toneBlue
class node_schedule_api,node_xer_api,node_xer_service toneAmber
class node_match_api,node_match_engine,node_confidence_api,node_confidence,node_confidence_engine,node_reviews_api toneMint
class node_delay,node_prediction,node_analytics toneRose
class node_api,node_progress_store,node_schedule_store,node_review_store,node_db,node_field,node_planner toneIndigo
```

## Components

### Field Ingestion

- [Progress API](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/api/progress.py): `backend/app/api/progress.py`
- [WhatsApp Webhook](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/api/webhooks.py): `backend/app/api/webhooks.py`
- [Voice Service](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/voice_service.py): `backend/app/services/voice_service.py`
- [OCR Service](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/ocr_service.py): `backend/app/services/ocr_service.py`
- [Extraction Service](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/extraction_service.py): `backend/app/services/extraction_service.py`
- [Excel Progress](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/excel_progress_service.py): `backend/app/services/excel_progress_service.py`

### Schedule Management

- [Schedule API](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/api/schedule.py): `backend/app/api/schedule.py`
- [XER Import Export](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/api/xer_import.py): `backend/app/api/xer_import.py`
- [XER Services](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/xer/service.py): `backend/app/services/xer/service.py`

### Matching And Review

- [Matching API](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/api/matching.py): `backend/app/api/matching.py`
- [Matching Engine](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/matching/engine.py): `backend/app/matching/engine.py`
- [Confidence API](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/api/confidence.py): `backend/app/api/confidence.py`
- [Confidence Service](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/confidence_service.py): `backend/app/services/confidence_service.py`
- [Confidence Scoring](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/confidence_engine.py): `backend/app/services/confidence_engine.py`
- [Planner Reviews](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/api/reviews.py): `backend/app/api/reviews.py`

### Schedule Intelligence

- [Delay Analysis](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/delay_ripple_service.py): `backend/app/services/delay_ripple_service.py`
- [Delay Prediction](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/ml_delay_service.py): `backend/app/services/ml_delay_service.py`
- [Institutional Analytics](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/services/analytics_service.py): `backend/app/services/analytics_service.py`

### API And Persistence

- [FastAPI Application](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/main.py): `backend/app/main.py`
- [Progress Events](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/models/progress.py): `backend/app/models/progress.py`
- [Schedule Data](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/models/schedule.py): `backend/app/models/schedule.py`
- [Reviews And Audit](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/models/confidence.py): `backend/app/models/confidence.py`
- [Database Sessions](https://github.com/sujayv26/smarty_vibz_sih/blob/main/backend/app/database.py): `backend/app/database.py`

### Other components

- **Field Reporter**
- **Planner**

## Connections

- Field Reporter → Progress API: submits reports
- Field Reporter → WhatsApp Webhook: sends messages
- Field Reporter → Voice Service: provides speech
- Field Reporter → OCR Service: provides diaries
- Progress API → Extraction Service: extracts text
- Progress API → Excel Progress: imports spreadsheet
- WhatsApp Webhook → Extraction Service: processes message
- Voice Service → Extraction Service: transcribes report
- OCR Service → Extraction Service: extracts report
- Extraction Service → Progress Events: creates events
- Excel Progress → Progress Events: writes events
- Schedule API → Schedule Data: manages activities
- XER Import Export → XER Services: imports exports
- XER Services → Schedule Data: imports activities
- Matching API → Matching Engine: runs matching
- Matching Engine → Progress Events: reads events
- Matching Engine → Schedule Data: reads candidates
- Confidence API → Confidence Service: evaluates event
- WhatsApp Webhook → Confidence Service: evaluates result
- Confidence Service → Matching Engine: requests matches
- Confidence Service → Confidence Scoring: scores candidates
- Confidence Service → Reviews And Audit: writes decisions
- Confidence Service → Progress Events: updates auto-match
- Planner Reviews → Confidence Service: handles decisions
- Planner → Planner Reviews: reviews candidates
- Confidence Service → Schedule Data: creates activity
- Delay Analysis → Schedule Data: analyzes schedule
- Delay Prediction → Schedule Data: reads schedule
- Institutional Analytics → Schedule Data: analyzes history
- FastAPI Application → Database Sessions: configures sessions
