# yastech722/soapdocs architecture

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

- Interactive diagram: https://gitdiagram.com/yastech722/soapdocs
- Repository: https://github.com/yastech722/soapdocs

## Overview

SOAPDocs is a desktop consultation assistant: users can enter or record/upload a conversation, process audio into a speaker-attributed transcript, and use the consultation screen for note generation and transcript revision. A separate encounter screen answers questions over JSON documents using retrieval-augmented generation. The excerpts show the RAG query path and transcript-revision call; parts of the chat screen are omitted, so links for its note-generation and audio-processing workflow reflect the documented screen responsibilities and imports rather than inspected call sites.

Main entry points: [`Screens/chatscreen.py`](https://github.com/yastech722/soapdocs/blob/main/Screens/chatscreen.py) (Consultation screen), [`utils/RAG.py`](https://github.com/yastech722/soapdocs/blob/main/utils/RAG.py) (Retrieval and answering), [`utils/NoteGenerator.py`](https://github.com/yastech722/soapdocs/blob/main/utils/NoteGenerator.py) (SOAP generation and revision), [`main.py`](https://github.com/yastech722/soapdocs/blob/main/main.py) (Window and navigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop app"]
  node_main["Window and navigation<br/>[main.py]"]
end

subgraph group_consult["Consultation workflow"]
  node_chat["Consultation screen<br/>[chatscreen.py]"]
  node_recorder["Audio capture<br/>[audio_recorder.py]"]
  node_speech["Transcription and diarization<br/>[speech_to_text.py]"]
  node_notes["SOAP generation and revision<br/>[NoteGenerator.py]"]
end

subgraph group_rag["Document Q&amp;A"]
  node_encounter["Encounter Q&amp;A screen<br/>[encounterscreen.py]"]
  node_raglogic["Retrieval and answering<br/>[RAG.py]"]
end

subgraph group_state["Local data"]
  node_docs["JSON source documents"]
  node_vectorstore[("Chroma index<br/>[chroma.sqlite3]")]
end

node_user(("User"))
node_ollama{{"Ollama models"}}
node_microphone(("Microphone"))
node_audiofiles["Selected audio"]

node_user -->|"opens"| node_main
node_main -->|"shows session"| node_chat
node_main -->|"opens history"| node_encounter
node_user -->|"enters dialogue"| node_chat
node_chat -->|"starts capture"| node_recorder
node_microphone -->|"provides audio"| node_recorder
node_user -->|"selects audio"| node_audiofiles
node_chat -->|"processes audio"| node_speech
node_recorder -->|"supplies recording"| node_chat
node_audiofiles -->|"supplies audio"| node_chat
node_chat -->|"revises transcript"| node_notes
node_chat -->|"requests SOAP note"| node_notes
node_notes -->|"calls model"| node_ollama
node_notes -->|"writes notes"| node_docs
node_user -->|"asks question"| node_encounter
node_encounter -->|"queries"| node_raglogic
node_raglogic -->|"loads JSON"| node_docs
node_raglogic -->|"builds index"| node_vectorstore
node_raglogic -->|"embeds and answers"| node_ollama
node_raglogic -->|"searches chunks"| node_vectorstore

click node_main "https://github.com/yastech722/soapdocs/blob/main/main.py"
click node_chat "https://github.com/yastech722/soapdocs/blob/main/Screens/chatscreen.py"
click node_encounter "https://github.com/yastech722/soapdocs/blob/main/Screens/encounterscreen.py"
click node_recorder "https://github.com/yastech722/soapdocs/blob/main/utils/audio_recorder.py"
click node_speech "https://github.com/yastech722/soapdocs/blob/main/utils/speech_to_text.py"
click node_notes "https://github.com/yastech722/soapdocs/blob/main/utils/NoteGenerator.py"
click node_raglogic "https://github.com/yastech722/soapdocs/blob/main/utils/RAG.py"
click node_docs "https://github.com/yastech722/soapdocs/blob/main/doc/generated-notes.json"
click node_vectorstore "https://github.com/yastech722/soapdocs/blob/main/db/chroma.sqlite3"

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_main,node_user toneBlue
class node_chat,node_recorder,node_speech,node_notes toneAmber
class node_encounter,node_raglogic toneMint
class node_docs,node_vectorstore toneRose
class node_ollama,node_microphone,node_audiofiles toneIndigo
```

## Components

### Desktop app

- [Window and navigation](https://github.com/yastech722/soapdocs/blob/main/main.py): `main.py`

### Consultation workflow

- [Consultation screen](https://github.com/yastech722/soapdocs/blob/main/Screens/chatscreen.py): `Screens/chatscreen.py`
- [Audio capture](https://github.com/yastech722/soapdocs/blob/main/utils/audio_recorder.py): `utils/audio_recorder.py`
- [Transcription and diarization](https://github.com/yastech722/soapdocs/blob/main/utils/speech_to_text.py): `utils/speech_to_text.py`
- [SOAP generation and revision](https://github.com/yastech722/soapdocs/blob/main/utils/NoteGenerator.py): `utils/NoteGenerator.py`

### Document Q&A

- [Encounter Q&A screen](https://github.com/yastech722/soapdocs/blob/main/Screens/encounterscreen.py): `Screens/encounterscreen.py`
- [Retrieval and answering](https://github.com/yastech722/soapdocs/blob/main/utils/RAG.py): `utils/RAG.py`

### Local data

- [JSON source documents](https://github.com/yastech722/soapdocs/blob/main/doc/generated-notes.json): `doc/generated-notes.json`
- [Chroma index](https://github.com/yastech722/soapdocs/blob/main/db/chroma.sqlite3): `db/chroma.sqlite3`

### Other components

- **User**
- **Ollama models**
- **Microphone**
- **Selected audio**

## Connections

- User → Window and navigation: opens
- Window and navigation → Consultation screen: shows session
- Window and navigation → Encounter Q&A screen: opens history
- User → Consultation screen: enters dialogue
- Consultation screen → Audio capture: starts capture
- Microphone → Audio capture: provides audio
- User → Selected audio: selects audio
- Consultation screen → Transcription and diarization: processes audio
- Audio capture → Consultation screen: supplies recording
- Selected audio → Consultation screen: supplies audio
- Consultation screen → SOAP generation and revision: revises transcript
- Consultation screen → SOAP generation and revision: requests SOAP note
- SOAP generation and revision → Ollama models: calls model
- SOAP generation and revision → JSON source documents: writes notes
- User → Encounter Q&A screen: asks question
- Encounter Q&A screen → Retrieval and answering: queries
- Retrieval and answering → JSON source documents: loads JSON
- Retrieval and answering → Chroma index: builds index
- Retrieval and answering → Ollama models: embeds and answers
- Retrieval and answering → Chroma index: searches chunks
