# sodium16/rg-hack-t07 architecture

> Architecture diagram of the GitHub repository sodium16/rg-hack-t07, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sodium16/rg-hack-t07
- Repository: https://github.com/sodium16/rg-hack-t07

## Overview

This is a Streamlit lecture-to-revision-notes study app. A student supplies a lecture recording; the app validates and transcribes it, indexes transcript words and timestamps, then generates revision notes, key terms, and grounded answers. A verification layer locates quoted evidence in the transcript and gates what reaches the student; the UI presents the results, report, and timestamp-linked playback. The README documents these capabilities, while sampled source excerpts and the SOURCE INDEX support only some implementation links, so unsampled connections are omitted.

Main entry points: [`main.py`](https://github.com/sodium16/rg-hack-t07/blob/main/main.py) (Streamlit app), [`app/speech.py`](https://github.com/sodium16/rg-hack-t07/blob/main/app/speech.py) (Speech transcription), [`app/notes.py`](https://github.com/sodium16/rg-hack-t07/blob/main/app/notes.py) (Notes and terms), [`app/qa.py`](https://github.com/sodium16/rg-hack-t07/blob/main/app/qa.py) (Grounded Q&A)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Student experience"]
  node_ui["Streamlit app<br/>[main.py]"]
  node_pipeline["CLI pipeline<br/>[pipeline.py]"]
end

subgraph group_transcription["Audio and transcript"]
  node_audio["Audio validation<br/>[audio.py]"]
  node_speech["Speech transcription<br/>[speech.py]"]
  node_cache[("Speech cache")]
  node_transcript["Transcript index"]
end

subgraph group_grounding["Grounding and study content"]
  node_notes["Notes and terms<br/>[notes.py]"]
  node_qa["Grounded Q&amp;A<br/>[qa.py]"]
  node_verify["Evidence verification<br/>[verify.py]"]
  node_safety["Safety and masking<br/>[safety.py]"]
end

subgraph group_platform["Shared services"]
  node_llm["Foundry client<br/>[llm.py]"]
  node_transport["HTTP transport<br/>[net.py]"]
  node_language["Language matching<br/>[language.py]"]
  node_prompts["Prompt schemas<br/>[prompts.py]"]
  node_contracts["Data contracts<br/>[models.py]"]
  node_settings["Settings<br/>[config.py]"]
end

node_student(("Student"))
node_azure_speech["Azure Speech"]
node_foundry["Azure Foundry"]

node_student -->|"uploads lecture"| node_ui
node_ui -->|"validates audio"| node_audio
node_ui -->|"requests transcript"| node_speech
node_audio -->|"hashes audio"| node_speech
node_speech -->|"transcribes audio"| node_azure_speech
node_speech -->|"reads/writes cache"| node_cache
node_speech -->|"produces transcript"| node_transcript
node_ui -->|"indexes transcript"| node_transcript
node_ui -->|"requests notes"| node_notes
node_ui -->|"asks questions"| node_qa
node_notes -->|"drafts content"| node_llm
node_qa -->|"drafts answers"| node_llm
node_llm -->|"sends requests"| node_transport
node_transport -->|"calls model API"| node_foundry
node_notes -->|"verifies quotes"| node_verify
node_qa -->|"checks evidence"| node_verify
node_verify -->|"locates quotes"| node_transcript
node_notes -->|"checks terms"| node_transcript
node_qa -->|"checks relevance"| node_language
node_ui -->|"scans transcript"| node_safety
node_ui -->|"shows verified results"| node_student
node_pipeline -->|"transcribes audio"| node_speech
node_pipeline -->|"generates notes"| node_notes
node_pipeline -->|"answers questions"| node_qa
node_notes -->|"formats prompts"| node_prompts
node_qa -->|"formats prompts"| node_prompts
node_speech -->|"builds transcript"| node_contracts
node_ui -->|"loads settings"| node_settings
node_llm -->|"loads credentials"| node_settings

click node_ui "https://github.com/sodium16/rg-hack-t07/blob/main/main.py"
click node_audio "https://github.com/sodium16/rg-hack-t07/blob/main/app/audio.py"
click node_speech "https://github.com/sodium16/rg-hack-t07/blob/main/app/speech.py"
click node_transcript "https://github.com/sodium16/rg-hack-t07/blob/main/app/transcript_index.py"
click node_notes "https://github.com/sodium16/rg-hack-t07/blob/main/app/notes.py"
click node_qa "https://github.com/sodium16/rg-hack-t07/blob/main/app/qa.py"
click node_verify "https://github.com/sodium16/rg-hack-t07/blob/main/app/verify.py"
click node_safety "https://github.com/sodium16/rg-hack-t07/blob/main/app/safety.py"
click node_llm "https://github.com/sodium16/rg-hack-t07/blob/main/app/llm.py"
click node_transport "https://github.com/sodium16/rg-hack-t07/blob/main/app/net.py"
click node_language "https://github.com/sodium16/rg-hack-t07/blob/main/app/language.py"
click node_prompts "https://github.com/sodium16/rg-hack-t07/blob/main/app/prompts.py"
click node_contracts "https://github.com/sodium16/rg-hack-t07/blob/main/app/models.py"
click node_settings "https://github.com/sodium16/rg-hack-t07/blob/main/app/config.py"
click node_pipeline "https://github.com/sodium16/rg-hack-t07/blob/main/app/pipeline.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_ui,node_pipeline toneBlue
class node_audio,node_speech,node_cache,node_transcript toneAmber
class node_notes,node_qa,node_verify,node_safety toneMint
class node_llm,node_transport,node_language,node_prompts,node_contracts,node_settings toneRose
class node_student,node_azure_speech,node_foundry toneIndigo
```

## Components

### Student experience

- [Streamlit app](https://github.com/sodium16/rg-hack-t07/blob/main/main.py): `main.py`
- [CLI pipeline](https://github.com/sodium16/rg-hack-t07/blob/main/app/pipeline.py): `app/pipeline.py`

### Audio and transcript

- [Audio validation](https://github.com/sodium16/rg-hack-t07/blob/main/app/audio.py): `app/audio.py`
- [Speech transcription](https://github.com/sodium16/rg-hack-t07/blob/main/app/speech.py): `app/speech.py`
- **Speech cache**
- [Transcript index](https://github.com/sodium16/rg-hack-t07/blob/main/app/transcript_index.py): `app/transcript_index.py`

### Grounding and study content

- [Notes and terms](https://github.com/sodium16/rg-hack-t07/blob/main/app/notes.py): `app/notes.py`
- [Grounded Q&A](https://github.com/sodium16/rg-hack-t07/blob/main/app/qa.py): `app/qa.py`
- [Evidence verification](https://github.com/sodium16/rg-hack-t07/blob/main/app/verify.py): `app/verify.py`
- [Safety and masking](https://github.com/sodium16/rg-hack-t07/blob/main/app/safety.py): `app/safety.py`

### Shared services

- [Foundry client](https://github.com/sodium16/rg-hack-t07/blob/main/app/llm.py): `app/llm.py`
- [HTTP transport](https://github.com/sodium16/rg-hack-t07/blob/main/app/net.py): `app/net.py`
- [Language matching](https://github.com/sodium16/rg-hack-t07/blob/main/app/language.py): `app/language.py`
- [Prompt schemas](https://github.com/sodium16/rg-hack-t07/blob/main/app/prompts.py): `app/prompts.py`
- [Data contracts](https://github.com/sodium16/rg-hack-t07/blob/main/app/models.py): `app/models.py`
- [Settings](https://github.com/sodium16/rg-hack-t07/blob/main/app/config.py): `app/config.py`

### Other components

- **Student**
- **Azure Speech**
- **Azure Foundry**

## Connections

- Student → Streamlit app: uploads lecture (evidence: `README.md`)
- Streamlit app → Audio validation: validates audio (evidence: `README.md`)
- Streamlit app → Speech transcription: requests transcript (evidence: `README.md`)
- Audio validation → Speech transcription: hashes audio (evidence: `app/audio.py`)
- Speech transcription → Azure Speech: transcribes audio (evidence: `README.md`)
- Speech transcription → Speech cache: reads/writes cache (evidence: `README.md`)
- Speech transcription → Transcript index: produces transcript (evidence: `README.md`)
- Streamlit app → Transcript index: indexes transcript (evidence: `README.md`)
- Streamlit app → Notes and terms: requests notes (evidence: `main.py`)
- Streamlit app → Grounded Q&A: asks questions (evidence: `main.py`)
- Notes and terms → Foundry client: drafts content (evidence: `app/notes.py`)
- Grounded Q&A → Foundry client: drafts answers (evidence: `app/qa.py`)
- Foundry client → HTTP transport: sends requests (evidence: `app/llm.py`)
- HTTP transport → Azure Foundry: calls model API
- Notes and terms → Evidence verification: verifies quotes (evidence: `app/notes.py`)
- Grounded Q&A → Evidence verification: checks evidence (evidence: `app/qa.py`)
- Evidence verification → Transcript index: locates quotes (evidence: `app/verify.py`)
- Notes and terms → Transcript index: checks terms (evidence: `app/notes.py`)
- Grounded Q&A → Language matching: checks relevance (evidence: `app/qa.py`)
- Streamlit app → Safety and masking: scans transcript (evidence: `main.py`)
- Streamlit app → Student: shows verified results (evidence: `README.md`)
- CLI pipeline → Speech transcription: transcribes audio (evidence: `app/pipeline.py`)
- CLI pipeline → Notes and terms: generates notes (evidence: `app/pipeline.py`)
- CLI pipeline → Grounded Q&A: answers questions (evidence: `app/pipeline.py`)
- Notes and terms → Prompt schemas: formats prompts (evidence: `app/notes.py`)
- Grounded Q&A → Prompt schemas: formats prompts (evidence: `app/qa.py`)
- Speech transcription → Data contracts: builds transcript (evidence: `app/speech.py`)
- Streamlit app → Settings: loads settings (evidence: `README.md`)
- Foundry client → Settings: loads credentials (evidence: `app/llm.py`)
