# aryamanpurohit/medically-streamlit-app architecture

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

- Interactive diagram: https://gitdiagram.com/aryamanpurohit/medically-streamlit-app
- Repository: https://github.com/aryamanpurohit/medically-streamlit-app

## Overview

Medically is a PDF-grounded medical question-answering chatbot. Its workflow prepares the medical PDF as a searchable FAISS index, then accepts a question, retrieves relevant chunks, and asks a hosted language model to answer from that context. The repository provides both a Streamlit chat interface and a separate command-line query script. The excerpts show the ingestion and query wiring; README content is empty, so no additional capabilities are documented. External framework internals are represented only where the code configures or invokes them.

Main entry points: [`Medically-By Aryaman/medibot.py`](https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/medibot.py) (Streamlit Chat), [`Medically-By Aryaman/connect_memory_with_llm.py`](https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/connect_memory_with_llm.py) (CLI Query), [`Medically-By Aryaman/vectorstore/db_faiss`](https://github.com/aryamanpurohit/medically-streamlit-app/tree/main/Medically-By%20Aryaman/vectorstore/db_faiss) (FAISS Index), [`Medically-By Aryaman/create_memory_for_llm.py`](https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/create_memory_for_llm.py) (PDF Loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Knowledge Ingestion"]
  node_pdf["Medical PDF"]
  node_pdf_loader["PDF Loader"]
  node_chunker["Text Chunker"]
end

subgraph group_index["Vector Index"]
  node_embedding_builder["Embedding Builder"]
  node_index_writer["Index Writer"]
  node_faiss_index[("FAISS Index")]
end

subgraph group_query["Question Answering"]
  node_retrieval_qa["Retrieval QA<br/>[medibot.py]"]
  node_prompt["Context Prompt<br/>[medibot.py]"]
  node_hosted_llm["Hosted LLM"]
  node_cli_qa["CLI Retrieval QA"]
  node_cli_prompt["CLI Context Prompt"]
end

subgraph group_interfaces["User Interfaces"]
  node_streamlit_app["Streamlit Chat<br/>[medibot.py]"]
  node_cli_app["CLI Query"]
end

node_streamlit_user(("Chat User"))
node_cli_user(("CLI User"))

node_pdf_loader -->|"loads PDF"| node_pdf
node_pdf_loader -->|"passes documents"| node_chunker
node_chunker -->|"passes chunks"| node_embedding_builder
node_embedding_builder -->|"provides embeddings"| node_index_writer
node_index_writer -->|"saves index"| node_faiss_index
node_streamlit_user -->|"enters question"| node_streamlit_app
node_streamlit_app -->|"loads index"| node_faiss_index
node_streamlit_app -->|"configures prompt"| node_prompt
node_streamlit_app -->|"configures endpoint"| node_hosted_llm
node_streamlit_app -->|"invokes chain"| node_retrieval_qa
node_retrieval_qa -->|"retrieves chunks"| node_faiss_index
node_retrieval_qa -->|"uses prompt"| node_prompt
node_retrieval_qa -->|"generates answer"| node_hosted_llm
node_cli_user -->|"enters query"| node_cli_app
node_cli_app -->|"loads index"| node_faiss_index
node_cli_app -->|"configures prompt"| node_cli_prompt
node_cli_app -->|"configures endpoint"| node_hosted_llm
node_cli_app -->|"invokes chain"| node_cli_qa
node_cli_qa -->|"retrieves chunks"| node_faiss_index
node_cli_qa -->|"uses prompt"| node_cli_prompt
node_cli_qa -->|"generates answer"| node_hosted_llm

click node_pdf "https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/data/The_GALE_ENCYCLOPEDIA_of_MEDICINE_SECOND.pdf"
click node_pdf_loader "https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/create_memory_for_llm.py"
click node_chunker "https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/create_memory_for_llm.py"
click node_embedding_builder "https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/create_memory_for_llm.py"
click node_index_writer "https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/create_memory_for_llm.py"
click node_faiss_index "https://github.com/aryamanpurohit/medically-streamlit-app/tree/main/Medically-By%20Aryaman/vectorstore/db_faiss"
click node_streamlit_app "https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/medibot.py"
click node_cli_app "https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/connect_memory_with_llm.py"
click node_retrieval_qa "https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/medibot.py"
click node_prompt "https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/medibot.py"
click node_cli_qa "https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/connect_memory_with_llm.py"
click node_cli_prompt "https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/connect_memory_with_llm.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_pdf,node_pdf_loader,node_chunker,node_streamlit_user,node_cli_user toneBlue
class node_embedding_builder,node_index_writer,node_faiss_index toneAmber
class node_retrieval_qa,node_prompt,node_hosted_llm,node_cli_qa,node_cli_prompt toneMint
class node_streamlit_app,node_cli_app toneRose
```

## Components

### Knowledge Ingestion

- [Medical PDF](https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/data/The_GALE_ENCYCLOPEDIA_of_MEDICINE_SECOND.pdf): `Medically-By Aryaman/data/The_GALE_ENCYCLOPEDIA_of_MEDICINE_SECOND.pdf`
- [PDF Loader](https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/create_memory_for_llm.py): `Medically-By Aryaman/create_memory_for_llm.py`
- [Text Chunker](https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/create_memory_for_llm.py): `Medically-By Aryaman/create_memory_for_llm.py`

### Vector Index

- [Embedding Builder](https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/create_memory_for_llm.py): `Medically-By Aryaman/create_memory_for_llm.py`
- [Index Writer](https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/create_memory_for_llm.py): `Medically-By Aryaman/create_memory_for_llm.py`
- [FAISS Index](https://github.com/aryamanpurohit/medically-streamlit-app/tree/main/Medically-By%20Aryaman/vectorstore/db_faiss): `Medically-By Aryaman/vectorstore/db_faiss`

### Question Answering

- [Retrieval QA](https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/medibot.py): `Medically-By Aryaman/medibot.py`
- [Context Prompt](https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/medibot.py): `Medically-By Aryaman/medibot.py`
- **Hosted LLM**
- [CLI Retrieval QA](https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/connect_memory_with_llm.py): `Medically-By Aryaman/connect_memory_with_llm.py`
- [CLI Context Prompt](https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/connect_memory_with_llm.py): `Medically-By Aryaman/connect_memory_with_llm.py`

### User Interfaces

- [Streamlit Chat](https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/medibot.py): `Medically-By Aryaman/medibot.py`
- [CLI Query](https://github.com/aryamanpurohit/medically-streamlit-app/blob/main/Medically-By%20Aryaman/connect_memory_with_llm.py): `Medically-By Aryaman/connect_memory_with_llm.py`

### Other components

- **Chat User**
- **CLI User**

## Connections

- PDF Loader → Medical PDF: loads PDF (evidence: `Medically-By Aryaman/create_memory_for_llm.py`)
- PDF Loader → Text Chunker: passes documents (evidence: `Medically-By Aryaman/create_memory_for_llm.py`)
- Text Chunker → Embedding Builder: passes chunks (evidence: `Medically-By Aryaman/create_memory_for_llm.py`)
- Embedding Builder → Index Writer: provides embeddings (evidence: `Medically-By Aryaman/create_memory_for_llm.py`)
- Index Writer → FAISS Index: saves index (evidence: `Medically-By Aryaman/create_memory_for_llm.py`)
- Chat User → Streamlit Chat: enters question (evidence: `Medically-By Aryaman/medibot.py`)
- Streamlit Chat → FAISS Index: loads index (evidence: `Medically-By Aryaman/medibot.py`)
- Streamlit Chat → Context Prompt: configures prompt (evidence: `Medically-By Aryaman/medibot.py`)
- Streamlit Chat → Hosted LLM: configures endpoint (evidence: `Medically-By Aryaman/medibot.py`)
- Streamlit Chat → Retrieval QA: invokes chain (evidence: `Medically-By Aryaman/medibot.py`)
- Retrieval QA → FAISS Index: retrieves chunks (evidence: `Medically-By Aryaman/medibot.py`)
- Retrieval QA → Context Prompt: uses prompt (evidence: `Medically-By Aryaman/medibot.py`)
- Retrieval QA → Hosted LLM: generates answer (evidence: `Medically-By Aryaman/medibot.py`)
- CLI User → CLI Query: enters query (evidence: `Medically-By Aryaman/connect_memory_with_llm.py`)
- CLI Query → FAISS Index: loads index (evidence: `Medically-By Aryaman/connect_memory_with_llm.py`)
- CLI Query → CLI Context Prompt: configures prompt (evidence: `Medically-By Aryaman/connect_memory_with_llm.py`)
- CLI Query → Hosted LLM: configures endpoint (evidence: `Medically-By Aryaman/connect_memory_with_llm.py`)
- CLI Query → CLI Retrieval QA: invokes chain (evidence: `Medically-By Aryaman/connect_memory_with_llm.py`)
- CLI Retrieval QA → FAISS Index: retrieves chunks (evidence: `Medically-By Aryaman/connect_memory_with_llm.py`)
- CLI Retrieval QA → CLI Context Prompt: uses prompt (evidence: `Medically-By Aryaman/connect_memory_with_llm.py`)
- CLI Retrieval QA → Hosted LLM: generates answer (evidence: `Medically-By Aryaman/connect_memory_with_llm.py`)
