How huiziy/aipatient works
Project type and purpose
• This is a research‐oriented full-stack application that builds LLM-powered simulated patients (“AIPatient”) from EHR data.
• Core purpose: ingest MIMIC III records, extract entities/relations into a Neo4j knowledge graph, power a multi-agent LLM system (Reasoning RAG: retrieval, reasoning, generation, memory) and expose it via a Streamlit interface for interactive medical training.
• There is also an out-of-distribution variant (AIPatient_OOD) and an analysis suite (AIPatient_Analysis) for ablation, robustness, readability, stability evaluations.
File structure
• Top-level folders:
• AIPatient_Analysis – data cleaning, KG construction, LLM model wrappers, evaluation modules, ablation studies.
• AIPatient_Interface – Streamlit app, agent orchestration, Neo4j interface, prompts.
• AIPatient_OOD – similar pipeline for out-of-distribution data (Coral dataset) and evaluation.
• fig – architecture and result figures.
• Key patterns:
• Modular Python packages (each subfolder has __init__.py).
• Separation of concerns: data ingestion/cleaning → graph construction → LLM model → evaluation.
• Config files at each component.
• Jupyter notebooks for prototyping (main.ipynb, main_OOD.ipynb).
• Streamlit is the sole frontend; backend components are Python modules.
• Neo4jDatabase modules in both Analysis and Interface for graph persistence and visualization.
README for additional insights
• High-level architecture described in Figure 1: EHR → KG → multi-agent system → user interface.
• Multi-agent design: retrieval agent, reasoning agent, generation agent, memory preservation.
• Uses Anthropic Claude via Amazon Bedrock as external service.
• Future plans: evaluator agent for feedback loops.
Final advice
• Config.py modules to denote parameterization points.
• Don’t overthink: list all 7 major subsystems plus evaluation branches and external API, connect them logically.