# piyushchugeja/voice-assistant-for-form-filling architecture

> Architecture diagram of the GitHub repository piyushchugeja/voice-assistant-for-form-filling, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/piyushchugeja/voice-assistant-for-form-filling
- Repository: https://github.com/piyushchugeja/voice-assistant-for-form-filling

## Overview

##### Project type and purpose
- This is a single‐application Python project: a voice-controlled form-filling desktop app.
- Purpose: capture user speech, convert it to text, populate a form (Tkinter UI), store entries in a local SQLite database, and optionally provide audio feedback.

##### File structure
- Flat structure (no subdirectories):
- main.py – application entry point, ties all components together
- database_connection.py – data access layer for SQLite (`form_filling_app.db`)
- util.py – helper functions (e.g., text cleaning, regex validation)
- form_filling_app.db – the local SQLite database file
- __pycache__ – compiled bytecode caches
- README.md / .gitattributes – metadata
- No build or deployment scripts—single runtime.

##### README for additional insights
- Uses these key libraries: playsound, gtts (text-to-speech), os, threading, tkinter (UI), PIL (images), tkcalendar (date picker), re (regex).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Voice I/O Thread
    subgraph "Voice I/O Thread"
        STT["Speech Recognition\n(speech_recognition)"]:::voice
        TTS["Text-to-Speech\n(gTTS + playsound)"]:::voice
    end

    %% Main UI Thread
    subgraph "Main UI Thread"
        UI["UI Layer\n(Tkinter, PIL, tkcalendar)"]:::ui
        Controller["Controller & Thread Management"]:::logic
        Helper["Input Parsing & Validation\n(util.py)"]:::logic
        DBAccess["Data Access Layer\n(database_connection.py)"]:::data
        DB["SQLite Database\n(form_filling_app.db)"]:::db
        External["Google TTS Service"]:::external
    end

    %% Data Flows
    %% Voice I/O to Controller
    STT -->|"text"| Controller
    %% Controller to Helpers
    Controller -->|"validate input"| Helper
    %% Helper updates UI
    Helper -->|"populate form"| UI
    %% UI events back to Controller
    UI -->|"user actions"| Controller
    %% Controller persists data
    Controller -->|"save data"| DBAccess
    DBAccess -->|"SQL queries"| DB
    %% Controller triggers TTS
    Controller -->|"generate audio"| TTS
    TTS -->|"API request"| External
    External -->|"audio file"| TTS

    %% Click Events
    click STT "https://github.com/piyushchugeja/voice-assistant-for-form-filling/blob/main/main.py"
    click TTS "https://github.com/piyushchugeja/voice-assistant-for-form-filling/blob/main/main.py"
    click UI "https://github.com/piyushchugeja/voice-assistant-for-form-filling/blob/main/main.py"
    click Controller "https://github.com/piyushchugeja/voice-assistant-for-form-filling/blob/main/main.py"
    click Helper "https://github.com/piyushchugeja/voice-assistant-for-form-filling/blob/main/util.py"
    click DBAccess "https://github.com/piyushchugeja/voice-assistant-for-form-filling/blob/main/database_connection.py"
    click DB "https://github.com/piyushchugeja/voice-assistant-for-form-filling/blob/main/form_filling_app.db"

    %% Styles
    classDef voice fill:#CCE5FF,stroke:#333,stroke-width:1px
    classDef ui fill:#CCFFCC,stroke:#333,stroke-width:1px
    classDef logic fill:#FFF2CC,stroke:#333,stroke-width:1px
    classDef data fill:#FFDDCC,stroke:#333,stroke-width:1px
    classDef db fill:#D9D2E9,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef external fill:#F0F0F0,stroke:#666,stroke-dasharray: 3 3,stroke-width:1px
```
