How kattapoornachandu/medical-chat-bot works
Project type and purpose
• This is a Python-based “medical-chat-bot” prototype. It doesn’t have a separate frontend folder, so it appears to be a single-process application—likely a command-line or lightweight web service (app.py) that orchestrates conversational logic by calling an external LLM (e.g., OpenAI Chat API).
• The research/ folder holds exploratory notebooks and tests, indicating that the core business logic lives under app.py, template.py, and the modules in src/.
File structure
– Top-level:
• app.py (application entrypoint, likely defines CLI or HTTP endpoints)
• template.py (prompt templates or message formatting)
• requirements.txt & setup.py (dependency management and packaging)
• src/
– helper.py (utility functions, I/O, parsing)
– prompt.py (builds or enriches prompts before sending them to the LLM)
• research/ (notebooks and trial scripts used during R&D, not part of the running service)
– No database folder or config files beyond requirements, suggesting no persistent store—state is ephemeral or file-based.
README
• It only names the project “medical-chat-bot,” confirming its domain: automated medical Q&A or triage via chat.
Main components
a. User Interface
• CLI client or Web client (browser or terminal)—where user enters medical queries
b. Application Server (app.py)
• Routes or command handlers
• Orchestrates calls to internal modules and external APIs
c. Business-Logic Modules
• prompt.py (constructs the chat prompt, inserts templates, handles system/user roles)
• helper.py (parsing user input, formatting LLM output, utility routines)
• template.py (predefined message skeletons for medical contexts)
d. External Service
• LLM Provider API (e.g., OpenAI Chat API)
e. Development/Research Layer (not in the production path)
• Jupyter notebooks (research/trials.ipynb) and test scripts
Relationships and interactions
– User submits a query → UI
– UI → Application Server (app.py)
– app.py → prompt.py (builds request payload)
– prompt.py + template.py → request is sent to External LLM API
– LLM API returns response → app.py
– app.py → helper.py (post-process, safety checks, format)
– helper.py → UI (display to user)
– research components run offline against src/ for prototyping only
Architectural patterns and principles
– Layered (UI → Controller/Orchestrator → Domain Logic → External Service)
– Single-process monolith (no microservices or database tier)
– Separation of concerns: templating, prompt construction, and utility functions decoupled into modules
– Dependency management via requirements.txt and setup.py for packaging