# louisslnn/ai-note-tracker architecture

> Architecture diagram of the GitHub repository louisslnn/ai-note-tracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/louisslnn/ai-note-tracker
- Repository: https://github.com/louisslnn/ai-note-tracker

## Overview

##### Project Type and Purpose
- This is a full-stack Python web application built with Streamlit, called “AI Note Tracker.”
- Purpose: let users add, search, retrieve, and (eventually) summarize notes via text input, voice input, or file upload. Notes are stored in a vector database (Chroma) and searched via embeddings/AI.

##### File Structure
- Top-level files
- Home.py – Streamlit entrypoint (defines main UI tabs/sections)
- requirements.txt, README.md, LICENSE
- utils.py – shared helper functions
- “pages/” folder
- Chatbot.py – UI for conversational retrieval or Q&A over notes
- Summarizer.py – UI to trigger summarization
- “backend/” folder (business logic / services)
- database_handler.py – low-level Chroma vector store operations
- save_prompt.py – processes and saves new notes (text, file)
- get_last_note.py – retrieves most recent note
- summarizer.py – calls OpenAI (or local) summarization APIs
- voice_input.py – captures & transcribes audio (in development)
- “vector_store/” folder
- chroma.sqlite3 + binary files for vector shards – persistent note storage

##### README for Insights
- Main tech stack: Python ≥3.7, Streamlit, Chroma vector DB, OpenAI embeddings/chat, (future) speech-to-text
- Features: add notes, retrieve notes by keyword or “last note,” AI summarization, voice input, file upload

a. Components
- User & Browser – end-user interacts via web browser
- Streamlit Frontend – Home.py + pages/
- Backend Service Layer – utils.py + backend/*.py
- Vector Database – Chroma (vector_store/)
- External AI Services – OpenAI Embeddings & Chat API; Speech-to-Text API (future)
b. Relationships & Data Flows
1. User → Streamlit UI (clicks “Add Note,” “Search,” “Summarize”)
2. UI → Backend Service (calls save_prompt, get_last_note, summarizer, voice_input)
3. save_prompt → database_handler → Vector DB (upsert embeddings + metadata)
4. get_last_note/search → database_handler → Vector DB → returns note text/embeddings
5. summarizer → External AI Service → returns summary → UI
6. voice_input → Speech-to-Text API → text → save_prompt
c. Architectural Patterns & Principles
- Layered (Presentation / Service / Data)
- Clear separation of concerns: UI vs. business logic vs. data storage
- Dependency injection via utils.py for shared config (e.g., API keys, DB paths)
d. Key Technologies
- Python, Streamlit
- Chroma Vector Store (chroma.sqlite3 + binary shards)
- OpenAI Python SDK for embeddings & chat
- SpeechRecognition or similar (future)

##### Detail Without Overthinking
- Seven backend modules as separate service functions or group logically (note ingestion vs. retrieval vs. summarization vs. voice).
- Vector_store folder’s contents as one persistent data store.
- Don’t omit the utils.py; either include it as a shared “Helper/Config” module or note its role in wiring the system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Actors
    User["User (Browser)"]:::actor

    %% Frontend Layer
    subgraph "Frontend (Streamlit App)"
        direction TB
        Home["Home.py"]:::frontend
        Chatbot["Chatbot.py"]:::frontend
        SummUI["Note Summarizer.py"]:::frontend
    end

    %% Backend Service Layer
    subgraph "Backend Service Layer"
        direction TB
        Utils["utils.py"]:::helper
        Ingest["save_prompt.py"]:::service
        Retrieve["get_last_note.py"]:::service
        SummService["summarizer.py"]:::service
        Voice["voice_input.py"]:::service
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        DBHandler["database_handler.py"]:::data
        ChromaDB["Chroma Vector DB\n(chroma.sqlite3 + shards)"]:::database
    end

    %% External Services
    subgraph "External AI Services"
        direction TB
        Embeddings["OpenAI Embedding API"]:::external
        ChatAPI["OpenAI Chat API"]:::external
        STT["Speech-to-Text API"]:::external
    end

    %% Connections User -> Frontend
    User -->|"interacts"| Home
    User -->|"opens Chatbot UI"| Chatbot
    User -->|"opens Summarizer UI"| SummUI

    %% Frontend -> Backend Services
    Home -->|"add/search notes"| Ingest
    Home -->|"fetch last note"| Retrieve
    Chatbot -->|"Q&A retrieval"| Retrieve
    SummUI -->|"request summarization"| SummService
    Home -->|"voice note"| Voice

    %% Utils wiring
    Utils --> Ingest
    Utils --> Retrieve
    Utils --> SummService
    Utils --> Voice
    Utils --> DBHandler

    %% Backend Services -> Data Layer
    Ingest -->|"upsert embeddings + metadata"| DBHandler
    Retrieve -->|"query notes"| DBHandler
    DBHandler -->|"read/write vectors"| ChromaDB

    %% Summarization Flow
    SummService -->|"call embeddings"| Embeddings
    SummService -->|"call chat API"| ChatAPI
    SummService -->|"return summary"| SummUI

    %% Voice Input Flow
    Voice -->|"transcribe audio"| STT
    Voice -->|"send text to ingestion"| Ingest

    %% Click Events
    click Home "https://github.com/louisslnn/ai-note-tracker/blob/main/Home.py"
    click Chatbot "https://github.com/louisslnn/ai-note-tracker/blob/main/pages/Chatbot.py"
    click SummUI "https://github.com/louisslnn/ai-note-tracker/blob/main/pages/Note Summarizer.py"
    click Ingest "https://github.com/louisslnn/ai-note-tracker/blob/main/backend/save_prompt.py"
    click Retrieve "https://github.com/louisslnn/ai-note-tracker/blob/main/backend/get_last_note.py"
    click SummService "https://github.com/louisslnn/ai-note-tracker/blob/main/backend/summarizer.py"
    click Voice "https://github.com/louisslnn/ai-note-tracker/blob/main/backend/voice_input.py"
    click DBHandler "https://github.com/louisslnn/ai-note-tracker/blob/main/backend/database_handler.py"
    click Utils "https://github.com/louisslnn/ai-note-tracker/blob/main/utils.py"
    click ChromaDB "https://github.com/louisslnn/ai-note-tracker/blob/main/vector_store/chroma.sqlite3"

    %% Styles
    classDef actor fill:#f2f2f2,stroke:#333,stroke-width:1px
    classDef frontend fill:#cce5ff,stroke:#005cbf,stroke-width:1px
    classDef service fill:#d4edda,stroke:#155724,stroke-width:1px
    classDef helper fill:#e2e3e5,stroke:#6c757d,stroke-width:1px
    classDef data fill:#fff3cd,stroke:#856404,stroke-width:1px
    classDef database fill:#ffe5b4,stroke:#cc7a00,stroke-width:1px
    classDef external fill:#e2e3e5,stroke:#6c757d,stroke-width:1px
```
