Skip to content

Precision Autoimmune Intelligence Agent -- Demo Guide

Author: Adam Jones Date: March 2026

Step-by-step walkthrough of all 10 Streamlit UI tabs using the 9 demo patients. Use this guide for live demos, recorded walkthroughs, and self-guided exploration.


Prerequisites

Before starting the demo, ensure:

  1. Milvus is running on localhost:19530 with 14 autoimmune collections created
  2. Streamlit UI is running on http://localhost:8531
  3. FastAPI server is running on http://localhost:8532
  4. Anthropic API key is configured (for RAG queries in Tab 1 and patient analysis in Tab 2)
  5. Demo patient data has been generated and ingested

Verify everything is ready:

cd ai_agent_adds/precision_autoimmune_agent

# Create collections and seed knowledge
python3 scripts/setup_collections.py --seed

# Generate and ingest 9 demo patients
python3 scripts/generate_demo_patients.py

# Run tests to verify
python3 -m pytest tests/ -v
# -> 455 tests passed

Quick Health Check

# Check Milvus
curl -s http://localhost:19530/healthz
# Expected: {"status":"OK"}

# Check FastAPI
curl -s http://localhost:8532/healthz
# Expected: {"status":"healthy","collections":14,"milvus":"connected"}

# Check Streamlit
curl -s http://localhost:8531/_stcore/health
# Expected: "ok"

If any service is not responding, see the Troubleshooting section at the end of this guide.


Demo Flow Overview

Tab Time Key Talking Points
1. Clinical Query 3 min RAG search across 14 collections, streaming responses, citation scoring
2. Patient Analysis 4 min Full pipeline: autoantibodies + HLA + activity + flare + therapy
3. Document Ingest 2 min PDF upload, chunking, embedding, collection storage
4. Diagnostic Odyssey 3 min Timeline visualization, delays, pattern recognition
5. Autoantibody Panel 3 min Panel interpretation, disease associations, titer analysis
6. HLA Analysis 2 min Allele-disease mapping, odds ratios, population context
7. Disease Activity 3 min 20 scoring systems, threshold-based classification
8. Flare Prediction 3 min Biomarker patterns, risk stratification, protective factors
9. Therapy Advisor 3 min 22 biologics, PGx filtering, contraindications
10. Knowledge Base 1 min Collection stats, knowledge version, coverage summary
Total ~27 min

For a 15-minute executive demo, focus on: - Tab 1 (Clinical Query) with Sarah Mitchell -- 3 min - Tab 2 (Patient Analysis) with Sarah Mitchell -- 4 min - Tab 4 (Diagnostic Odyssey) with Sarah Mitchell -- 3 min - Tab 9 (Therapy Advisor) with Rachel Thompson -- 3 min - Tab 10 (Knowledge Base) -- 2 min

For a 10-minute technical demo, focus on: - Tab 1 (Clinical Query) -- show streaming RAG -- 2 min - Tab 3 (Document Ingest) -- show PDF pipeline -- 2 min - Tab 5 (Autoantibody Panel) with James Cooper -- 2 min - Tab 6 (HLA Analysis) with David Park -- 2 min - Tab 10 (Knowledge Base) -- collection stats -- 2 min


Patient 1: Sarah Mitchell -- SLE (Systemic Lupus Erythematosus)

Key Narrative

A 34-year-old woman with a 3-year diagnostic odyssey from initial fatigue and joint pain through multiple specialists before receiving a definitive SLE diagnosis. Positive ANA 1:640 homogeneous, anti-dsDNA positive, low C3/C4 complement. HLA-DRB1*03:01 carrier. Currently on hydroxychloroquine and mycophenolate with history of lupus nephritis (Class IV). 27 clinical documents spanning 2022-2025.

Tab 1: Clinical Query

Setup: Navigate to Tab 1 (Clinical Query).

Demo steps:

  1. Type the query: What is Sarah Mitchell's current disease status and flare risk?
  2. Click Submit and watch the streaming response appear token by token
  3. Point out key elements in the response:
  4. Evidence sources from multiple collections (clinical documents, lab results, autoantibody panels)
  5. Citation confidence levels displayed as badges (High, Medium, Low)
  6. The response references specific lab values from ingested documents
  7. The answer is grounded in domain-specific knowledge, not general LLM output
  8. Type a follow-up query: Compare rituximab vs belimumab for Sarah's refractory lupus nephritis
  9. Show collection sources in the evidence panel:
  10. autoimmune_biologic_therapies -- drug mechanism and indications
  11. autoimmune_clinical_documents -- Sarah's actual clinical history
  12. autoimmune_literature -- published evidence for rituximab vs belimumab
  13. autoimmune_pgx_rules -- pharmacogenomic considerations

Expected output highlights: - Streaming response with 3-8 evidence citations - Citations labeled by collection (e.g., "[Biologic Therapy: rituximab]", "[Clinical Document: sarah_mitchell_progress_note_2024-03]") - Relevance scores for each citation (High >= 0.80, Medium >= 0.60)

Key talking point: "The RAG engine searches 14 specialized collections in parallel -- from autoantibody panels to biologic therapy databases to published literature -- and synthesizes a grounded answer with citations. This is not a general-purpose chatbot; every response is anchored in domain-specific knowledge."

Tab 2: Patient Analysis

Setup: Navigate to Tab 2 (Patient Analysis).

Demo steps:

  1. Select Sarah Mitchell from the patient dropdown
  2. Click Run Full Analysis
  3. Wait for the 5-step pipeline to complete (typically 10-30 seconds)
  4. Walk through each section of the output:

Section 1: Autoantibody Interpretation - ANA: 1:640, homogeneous pattern -- positive - Anti-dsDNA: positive -- highly specific for SLE (specificity ~95%) - Anti-Smith: positive -- pathognomonic for SLE - Show how each antibody maps to disease associations with sensitivity/specificity data

Section 2: HLA Associations - HLA-DRB1*03:01 -- OR 2.4 for SLE, OR 3.1 for Sjogren's - Explain the concept of odds ratios and multi-disease risk

Section 3: Disease Activity - SLEDAI-2K score calculation - Activity level classification (remission/low/moderate/high/very high) - Score components breakdown

Section 4: Flare Prediction - Risk score (0.0-1.0) with classification (imminent/high/moderate/low) - Contributing factors (rising anti-dsDNA, falling complement C3) - Protective factors (stable hydroxychloroquine adherence)

Section 5: Biologic Therapy Recommendations - Ranked list of indicated biologics - PGx considerations for each drug - Contraindications and required monitoring

  1. Point out cross-agent findings -- How biomarker results from the Biomarker Agent can feed into autoimmune analysis

Expected output highlights: - Complete analysis result with all 5 sections populated - Critical alerts highlighted (if disease activity is high or flare risk is imminent) - Therapy recommendations with PGx context

Key talking point: "In under 30 seconds, we go from raw clinical data to a complete autoimmune intelligence report -- autoantibody interpretation, HLA risk analysis, disease activity scoring, flare prediction, and therapy recommendations. A rheumatologist would need hours to synthesize this from scattered records."

Tab 3: Document Ingest

Setup: Navigate to Tab 3 (Document Ingest).

Demo steps:

  1. Show the existing document list for Sarah Mitchell -- 27 clinical PDFs already ingested
  2. Explain the ingestion pipeline by walking through the stages:
  3. PDF upload -> page-by-page text extraction (PyPDF2)
  4. Text chunking: 2,500 character chunks with 200 character overlap
  5. Document type classification (7 types: lab report, progress note, imaging, pathology, genetic, referral, medication list)
  6. Medical specialty detection (11 specialties)
  7. Entity extraction: autoantibody names (29 patterns), lab test values (45 patterns)
  8. BGE-small-en-v1.5 embedding (384 dimensions)
  9. Milvus vector insert into autoimmune_clinical_documents collection
  10. Point out the document type breakdown for Sarah:
  11. Progress notes (rheumatology, nephrology, dermatology)
  12. Lab reports (autoantibody panels, CBC, CMP, complement levels)
  13. Imaging reports (chest X-ray, renal ultrasound)
  14. Pathology (renal biopsy -- Class IV lupus nephritis)
  15. Referral letters
  16. Optionally upload a new test PDF to demonstrate the live pipeline

Expected output highlights: - Document list with type classification, specialty, provider, and date - Chunk count per document (typical: 3-8 chunks per PDF page) - Successful embedding and storage confirmation

Key talking point: "Every clinical document is chunked, embedded, and stored as searchable vectors. When you ask a question, the RAG engine can pull relevant passages from any document in the patient's history -- not just structured data, but the actual clinical narrative."

Tab 4: Diagnostic Odyssey

Setup: Navigate to Tab 4 (Diagnostic Odyssey).

Demo steps:

  1. Select Sarah Mitchell from the patient dropdown
  2. Show the timeline visualization -- a chronological view of the diagnostic journey from first symptoms (March 2022) to SLE diagnosis (May 2023)
  3. Walk through the key events on the timeline:
  4. 2022-03: Annual physical -- fatigue dismissed as stress (symptom onset)
  5. 2022-06: Follow-up -- joint pain reported, CBC/CMP ordered (first labs)
  6. 2022-10: ANA ordered after persistent symptoms (first autoimmune test)
  7. 2023-01: Dermatology referral for malar rash (referral)
  8. 2023-04: Rheumatology referral -- full autoimmune panel ordered (turning point)
  9. 2023-05: Definitive SLE diagnosis -- ANA 1:640, anti-dsDNA+, anti-Smith+ (diagnosis)
  10. 2023-09: Nephrology consult -- proteinuria detected (complication)
  11. 2023-10: Renal biopsy -- Class IV lupus nephritis (procedure)
  12. Highlight the diagnostic delay -- 14 months from first symptom to correct diagnosis
  13. Show event classification -- each event is classified by type (symptom onset, diagnosis, misdiagnosis, lab result, imaging, biopsy, referral, ER visit, treatment start, treatment change, flare)
  14. Show the specialists seen -- primary care, dermatology, rheumatology, nephrology
  15. Point out the pattern: initial dismissal -> delayed testing -> specialist referral -> diagnosis

Expected output highlights: - Chronological timeline with color-coded event types - Days-from-first-symptom calculation for each event - Total diagnostic delay prominently displayed

Key talking point: "The diagnostic odyssey analyzer reveals the full timeline of Sarah's journey -- 14 months from first symptoms to diagnosis, 4 different specialists, multiple dismissals. The average lupus patient sees 4 physicians over 4 years before diagnosis. This tool makes that delay visible and actionable."

Tab 5: Autoantibody Panel

Setup: Navigate to Tab 5 (Autoantibody Panel).

Demo steps:

  1. Select Sarah Mitchell from the patient dropdown
  2. Show Sarah's autoantibody panel:
  3. ANA: 1:640, homogeneous pattern -- positive
  4. Anti-dsDNA: positive -- highly specific for SLE (specificity ~95%)
  5. Anti-Smith: positive -- pathognomonic for SLE (specificity ~99%)
  6. C3: low (48 mg/dL, normal 90-180) -- complement consumption
  7. C4: low (6 mg/dL, normal 16-47) -- complement consumption
  8. Show disease association scoring:
  9. Each positive antibody maps to diseases with sensitivity and specificity data
  10. The combination score shows high confidence for SLE
  11. Individual antibody associations are displayed with evidence quality
  12. Contrast with ANA alone:
  13. ANA 1:640 homogeneous is found in 5-15% of healthy individuals
  14. The specificity comes from the combination: ANA + anti-dsDNA + anti-Smith + low complements

Expected output highlights: - Antibody results table with positive/negative status - Disease association matrix showing which diseases each antibody is associated with - Combined confidence score for the most likely diagnosis

Key talking point: "ANA alone is found in 5-15% of healthy individuals. But ANA 1:640 homogeneous plus anti-dsDNA plus anti-Smith plus low complements -- that pattern is pathognomonic for SLE. The autoantibody interpreter understands these combinations, not just individual results."

Tab 6: HLA Analysis

Setup: Navigate to Tab 6 (HLA Analysis).

Demo steps:

  1. Select Sarah Mitchell from the patient dropdown
  2. Show Sarah's HLA profile:
  3. HLA-DRB1*03:01 -- OR 2.4 for SLE, OR 3.1 for Sjogren's
  4. Point out multi-disease risk:
  5. This single allele confers risk for SLE, Sjogren's, T1D, Graves, and Celiac
  6. Explain that this is why autoimmune patients often develop multiple conditions
  7. Show the odds ratio context:
  8. Compare Sarah's HLA-DRB103:01 (OR 2.4 for SLE) to HLA-B27:05 (OR 87.4 for AS)
  9. Explain the wide range of HLA effect sizes across diseases
  10. Discuss population context:
  11. HLA allele frequencies vary by ethnic background
  12. The odds ratios in the knowledge base are derived from published studies

Expected output highlights: - HLA allele table with associated diseases and odds ratios - Multi-disease risk profile visualization - Population frequency context

Key talking point: "HLA-DRB103:01 is a shared risk allele for SLE, Sjogren's, Type 1 Diabetes, Graves, and Celiac. This is why autoimmune patients often develop multiple conditions -- they carry genetic risk across several diseases."*


Patient 2: Rachel Thompson -- Mixed Connective Tissue Disease (MCTD)

Key Narrative

A 38-year-old woman with Mixed Connective Tissue Disease (MCTD), presenting with overlapping features of SLE, SSc, and myositis. Anti-U1 RNP strongly positive, Raynaud's phenomenon, swollen fingers, and inflammatory myopathy. Being managed with immunosuppressive therapy.

Tab 2: Patient Analysis (Rachel Thompson)

Setup: Navigate to Tab 2 (Patient Analysis).

Demo steps:

  1. Select Rachel Thompson from the patient dropdown
  2. Click Run Full Analysis
  3. Highlight the overlap syndrome detection:
  4. The agent identifies MCTD as an overlap of SLE, SSc, and myositis features
  5. Anti-U1 RNP is the hallmark antibody for MCTD
  6. Disease activity must be tracked across multiple organ systems
  7. Compare with Sarah's SLE analysis:
  8. Sarah has a single disease (SLE) with clear classification criteria
  9. Rachel's MCTD requires evaluating criteria from multiple diseases simultaneously

Expected output highlights: - Overlap syndrome identification (MCTD = SLE + SSc + myositis features) - Multi-system disease activity assessment - Therapy recommendations addressing the predominant features

Key talking point: "Rachel's case demonstrates why overlap syndromes are the hardest challenge in autoimmune medicine. The agent evaluates features across SLE, SSc, and myositis simultaneously and recommends therapy based on which features predominate."

Tab 7: Disease Activity

Setup: Navigate to Tab 7 (Disease Activity).

Demo steps:

  1. Select Rachel Thompson from the patient dropdown
  2. Show disease activity scores:
  3. MCTD activity assessment with component scores for each overlap domain
  4. Joint involvement score (from SLE/RA criteria)
  5. Myositis markers (CK, aldolase) contributing to myopathy assessment
  6. Skin thickening score (from SSc modified Rodnan)
  7. Serositis assessment
  8. Compare scoring systems:
  9. Show how SLEDAI-2K captures the lupus features
  10. Show how the modified Rodnan skin score captures SSc features
  11. Show how CK/aldolase track myositis activity
  12. Point out the treatment monitoring complexity:
  13. MCTD requires simultaneous monitoring of multiple organ systems
  14. Different scoring systems are needed for different disease components

Expected output highlights: - Multi-system disease activity breakdown - Activity level classification per domain - Composite assessment with treatment implications

Key talking point: "Rachel's MCTD demonstrates why overlap syndromes are challenging -- she has features spanning SLE, SSc, and myositis. The disease activity scorer evaluates each component and tracks the overall disease trajectory."

Tab 8: Flare Prediction

Setup: Navigate to Tab 8 (Flare Prediction).

Demo steps:

  1. Select Rachel Thompson from the patient dropdown
  2. Show the flare risk assessment:
  3. Overall risk score (0.0-1.0)
  4. Risk classification (imminent >= 0.8, high >= 0.6, moderate >= 0.4, low < 0.4)
  5. 90-day prediction window
  6. Walk through contributing factors:
  7. Rising CRP with changing anti-U1 RNP titers
  8. New organ involvement (e.g., worsening Raynaud's)
  9. Recent immunosuppression changes
  10. Show protective factors:
  11. Stable medication adherence
  12. Normal inflammatory markers in other domains
  13. Discuss monitoring recommendations:
  14. Frequency of lab draws based on risk level
  15. Clinical assessments to schedule
  16. Warning signs for patients

Expected output highlights: - Risk score with classification badge - Contributing factors with individual risk contributions - Protective factors with stabilization evidence - Monitoring frequency recommendations

Key talking point: "Flare prediction is not about a single lab value -- it is about patterns. Rising CRP with changing anti-U1 RNP titers and new organ involvement suggests an imminent flare. The predictor identifies these patterns across 13 biomarker signals per disease."

Tab 9: Therapy Advisor

Setup: Navigate to Tab 9 (Therapy Advisor).

Demo steps:

  1. Select Rachel Thompson from the patient dropdown
  2. Show biologic recommendations for MCTD:
  3. Immunosuppressive therapies targeting overlap features
  4. Organ-specific treatment considerations
  5. Biologic options ranked by evidence and predominant features
  6. Walk through each recommendation:
  7. Drug name, class, and mechanism of action
  8. Indicated diseases and evidence level
  9. PGx considerations (e.g., CYP3A4 for JAK inhibitors, FCGR3A for rituximab)
  10. Contraindications (active infections, hepatitis B, pregnancy)
  11. Required monitoring (TB screening, hepatitis B serology, CBC, LFTs)
  12. Show the PGx filtering:
  13. If Rachel has relevant pharmacogenomic variants, show how they modify recommendations
  14. Explain that PGx data is integrated from the Biomarker Agent

Expected output highlights: - Ranked therapy list with evidence levels - PGx considerations per drug - Contraindication flags - Monitoring requirements table

Key talking point: "Rachel's MCTD requires a nuanced therapy approach -- the advisor considers which overlap features predominate and recommends treatments accordingly. Each recommendation includes PGx considerations, contraindications, and required monitoring."


Patient 3: James Cooper -- T1D + Celiac Overlap

Key Narrative

A 19-year-old male with Type 1 Diabetes, now presenting with GI symptoms and positive anti-tTG antibodies. HLA-DQB1*02:01 carrier (shared risk for both T1D and Celiac). Demonstrates autoimmune polyendocrine overlap syndrome.

Tab 5: Autoantibody Panel (James Cooper)

Setup: Navigate to Tab 5 (Autoantibody Panel).

Demo steps:

  1. Select James Cooper from the patient dropdown
  2. Show James's autoantibody panel:
  3. Anti-GAD65: positive -- highly specific for T1D (specificity ~98%)
  4. Anti-IA2: positive -- T1D-specific islet cell antibody
  5. Anti-ZnT8: positive -- zinc transporter antibody, T1D marker
  6. Anti-tTG IgA: elevated -- tissue transglutaminase, celiac marker
  7. Anti-EMA: positive -- endomysial antibody, celiac confirmation
  8. Show disease association scoring:
  9. Anti-GAD65 + anti-IA2 + anti-ZnT8 map strongly to T1D
  10. Anti-tTG IgA + anti-EMA map strongly to Celiac Disease
  11. The agent recognizes this as a T1D-Celiac overlap pattern
  12. Contrast with Sarah's single-disease panel:
  13. Sarah's antibodies all point to one disease (SLE)
  14. James's antibodies span two distinct autoimmune diseases

Expected output highlights: - Dual disease association mapping - Overlap syndrome identification - Individual antibody sensitivity/specificity data

Key talking point: "James has autoantibodies spanning two diseases -- anti-GAD65 and anti-IA2 for Type 1 Diabetes, plus anti-tTG and anti-EMA for Celiac. This is not coincidence. HLA-DQB102:01 confers shared risk for both conditions, and up to 10% of T1D patients develop Celiac. The autoimmune agent recognizes these overlap patterns."*

Tab 6: HLA Analysis (James Cooper)

Setup: Navigate to Tab 6 (HLA Analysis).

Demo steps:

  1. Select James Cooper from the patient dropdown
  2. Show James's HLA profile:
  3. HLA-DQB1*02:01 -- OR 7.0 for Celiac, OR 3.0 for T1D
  4. HLA-DRB1*03:01 -- shared risk for T1D, SLE, Graves, Celiac
  5. Explain the HLA-DQ2 heterodimer:
  6. HLA-DQB1*02:01 forms part of the HLA-DQ2 molecule
  7. HLA-DQ2 is the strongest known genetic risk factor for celiac disease
  8. Nearly all celiac patients carry HLA-DQ2 or HLA-DQ8
  9. Cross-disease risk profile:
  10. Show the polyautoimmune risk assessment
  11. Discuss monitoring recommendations for additional autoimmune conditions

Expected output highlights: - HLA allele table with dual disease associations - Odds ratios for both T1D and Celiac - Cross-disease risk visualization

Key talking point: "HLA-DQB102:01 forms part of the HLA-DQ2 heterodimer -- the strongest genetic risk factor for celiac disease. The same allele also confers significant T1D risk. This is why autoimmune overlap syndromes are not random -- they are genetically programmed."*


Patient 4: David Park -- Ankylosing Spondylitis

Key Narrative

A 45-year-old male with ankylosing spondylitis (AS), diagnosed after a 3-year diagnostic odyssey. HLA-B*27:05 carrier (OR 87.4 for AS). Presents with chronic lower back pain, sacroiliitis on imaging, and recurrent anterior uveitis. Currently on a TNF inhibitor.

Tab 6: HLA Analysis (David Park)

Setup: Navigate to Tab 6 (HLA Analysis).

Demo steps:

  1. Select David Park from the patient dropdown
  2. Show David's HLA profile:
  3. HLA-B*27:05 -- OR 87.4 for Ankylosing Spondylitis
  4. This is the strongest HLA-disease association in the entire knowledge base
  5. Compare odds ratios across diseases:
  6. HLA-B*27:05 for AS: OR 87.4 (extremely strong)
  7. HLA-DRB1*03:01 for SLE: OR 2.4 (moderate)
  8. HLA-DQB1*02:01 for Celiac: OR 7.0 (strong)
  9. Discuss clinical implications:
  10. Over 90% of AS patients are HLA-B*27 positive
  11. But only 5-10% of HLA-B*27 carriers develop AS
  12. HLA-B*27 testing is a key part of the AS diagnostic workup

Expected output highlights: - HLA-B27:05 prominently displayed with highest odds ratio - Disease association confidence metrics - Broad allele matching (B27:05 maps to B*27 group)

Key talking point: "HLA-B27:05 has the strongest disease association in our knowledge base -- an odds ratio of 87.4 for ankylosing spondylitis. Over 90% of AS patients carry this allele. Yet only 5-10% of carriers develop AS, showing that HLA is necessary but not sufficient."*

Tab 7: Disease Activity (David Park)

Setup: Navigate to Tab 7 (Disease Activity).

Demo steps:

  1. Select David Park from the patient dropdown
  2. Show BASDAI scoring:
  3. Bath Ankylosing Spondylitis Disease Activity Index
  4. Components: fatigue, spinal pain, peripheral pain, enthesitis, morning stiffness severity, morning stiffness duration
  5. Score interpretation: < 4 = low activity, >= 4 = high activity
  6. Discuss treatment decisions based on BASDAI:
  7. BASDAI >= 4 on two occasions 12 weeks apart -> eligible for biologic therapy
  8. This is the ASAS/EULAR recommendation for biologic initiation

Expected output highlights: - BASDAI score with component breakdown - Activity level classification - Treatment eligibility assessment

Tab 4: Diagnostic Odyssey (David Park)

Setup: Navigate to Tab 4 (Diagnostic Odyssey).

Demo steps:

  1. Select David Park from the patient dropdown
  2. Show the 3-year diagnostic journey:
  3. Initial presentation with lower back pain to primary care
  4. Misattributed to mechanical back pain / disc disease
  5. Physical therapy without improvement
  6. Uveitis episode triggers immunology referral
  7. HLA-B*27 testing and sacroiliac joint imaging
  8. Definitive AS diagnosis by rheumatology
  9. Highlight the pattern: inflammatory back pain misdiagnosed as mechanical

Key talking point: "David's 3-year odyssey from first symptoms to AS diagnosis is typical -- inflammatory back pain in young men is frequently misattributed to mechanical causes. The diagnostic odyssey tool makes this pattern visible."


Patient 5: Linda Chen -- Sjogren's Syndrome

Key Narrative

A 45-year-old woman with Sjogren's Syndrome presenting with sicca syndrome (dry eyes, dry mouth), positive anti-SSA/Ro and anti-SSB/La antibodies, abnormal Schirmer test, and parotid gland involvement. HLA-DRB1*03:01 carrier.

Tab 5: Autoantibody Panel (Linda Chen)

Setup: Navigate to Tab 5 (Autoantibody Panel).

Demo steps:

  1. Select Linda Chen from the patient dropdown
  2. Show Linda's panel:
  3. Anti-SSA/Ro: positive -- the most characteristic antibody for Sjogren's (sensitivity ~70%)
  4. Anti-SSB/La: positive -- highly specific for Sjogren's (specificity ~95%)
  5. ANA: positive (1:320, speckled pattern)
  6. RF (Rheumatoid Factor): positive
  7. Explain the SSA/SSB pattern:
  8. Anti-SSA alone is found in SLE, Sjogren's, and neonatal lupus
  9. Anti-SSA + anti-SSB together is the hallmark of primary Sjogren's
  10. The speckled ANA pattern is consistent with anti-SSA/SSB

Key talking point: "Anti-SSA/Ro is not specific to Sjogren's -- it is also found in SLE. But anti-SSA plus anti-SSB together, with sicca symptoms and a speckled ANA pattern, is the hallmark of primary Sjogren's. The agent understands these patterns."


Patient 6: Maya Rodriguez -- POTS / hEDS / MCAS

Key Narrative

A 28-year-old woman with the POTS/hEDS/MCAS triad (Postural Orthostatic Tachycardia Syndrome, hypermobile Ehlers-Danlos Syndrome, Mast Cell Activation Syndrome). This case demonstrates a complex diagnostic odyssey through multiple specialties before the triad is recognized.

Tab 4: Diagnostic Odyssey (Maya Rodriguez)

Setup: Navigate to Tab 4 (Diagnostic Odyssey).

Demo steps:

  1. Select Maya Rodriguez from the patient dropdown
  2. Show the extended diagnostic odyssey:
  3. Years of unexplained symptoms: dizziness, fatigue, GI distress, joint hypermobility
  4. Multiple specialists: cardiology (POTS evaluation), gastroenterology, rheumatology, allergy/immunology
  5. Tilt table testing for POTS diagnosis
  6. Beighton score for hEDS assessment
  7. Mast cell mediator testing for MCAS
  8. Highlight the triad recognition:
  9. POTS, hEDS, and MCAS frequently co-occur
  10. The agent's overlap syndrome detection identifies this as the POTS/hEDS/MCAS triad
  11. Each component was diagnosed separately over months to years

Key talking point: "Maya's case represents the POTS/hEDS/MCAS triad -- three conditions that frequently co-occur but are often diagnosed separately over years. The overlap syndrome detector recognizes this pattern and alerts clinicians to evaluate all three."


Patient 7: Emma Williams -- Multiple Sclerosis (RRMS)

Key Narrative

A 34-year-old woman with Relapsing-Remitting Multiple Sclerosis (RRMS). Presented with optic neuritis, MRI showing periventricular lesions, oligoclonal bands in CSF. HLA-DRB1*15:01 carrier (the strongest genetic risk factor for MS).

Tab 7: Disease Activity (Emma Williams)

Setup: Navigate to Tab 7 (Disease Activity).

Demo steps:

  1. Select Emma Williams from the patient dropdown
  2. Show EDSS scoring:
  3. Expanded Disability Status Scale (0-10)
  4. Functional system scores (visual, brainstem, pyramidal, cerebellar, sensory, bowel/bladder, cerebral)
  5. Discuss DMT (disease-modifying therapy) selection:
  6. Based on disease activity level and EDSS trajectory
  7. High-efficacy vs moderate-efficacy DMTs

Key talking point: "Emma's RRMS requires continuous monitoring with the EDSS scale. The disease activity scorer tracks her functional system scores and helps guide disease-modifying therapy escalation decisions."


Patient 8: Karen Foster -- Systemic Sclerosis (dcSSc)

Key Narrative

A 48-year-old woman with diffuse cutaneous systemic sclerosis (dcSSc). Anti-Scl-70 (anti-topoisomerase I) positive, Raynaud's phenomenon, skin thickening, and interstitial lung disease (ILD).

Tab 9: Therapy Advisor (Karen Foster)

Setup: Navigate to Tab 9 (Therapy Advisor).

Demo steps:

  1. Select Karen Foster from the patient dropdown
  2. Show therapy recommendations for dcSSc:
  3. Immunosuppressive therapies for skin and lung involvement
  4. Mycophenolate or cyclophosphamide for ILD
  5. Nintedanib for progressive ILD
  6. Rituximab as an alternative
  7. Discuss organ-specific monitoring:
  8. Pulmonary function tests (FVC, DLCO) for ILD tracking
  9. Modified Rodnan skin score for skin progression
  10. Echocardiography for pulmonary hypertension screening

Key talking point: "Karen's dcSSc with ILD requires therapy that addresses both skin and lung disease. The advisor ranks treatments by evidence level and includes organ-specific monitoring protocols."


Patient 9: Michael Torres -- Graves' Disease

Key Narrative

A 41-year-old male with Graves' Disease. Positive thyroid-stimulating immunoglobulin (TSI), elevated free T4, suppressed TSH. HLA-DRB1*03:01 carrier.

Tab 2: Patient Analysis (Michael Torres)

Setup: Navigate to Tab 2 (Patient Analysis).

Demo steps:

  1. Select Michael Torres from the patient dropdown
  2. Click Run Full Analysis
  3. Show Burch-Wartofsky scoring:
  4. Point system for thyroid storm assessment
  5. Components: temperature, CNS effects, GI dysfunction, heart rate, heart failure, atrial fibrillation, precipitant history
  6. Score interpretation: < 25 unlikely, 25-44 impending, >= 45 thyroid storm
  7. Show therapy recommendations:
  8. Antithyroid drugs (methimazole, PTU) vs radioactive iodine (RAI) vs thyroidectomy
  9. PGx considerations for drug metabolism

Key talking point: "Michael's Graves' Disease case demonstrates the Burch-Wartofsky scoring system for thyroid storm assessment -- a clinical emergency. The agent calculates the score and provides treatment recommendations including the antithyroid drug vs RAI decision framework."


Tab 10: Knowledge Base

Setup: Navigate to Tab 10 (Knowledge Base).

Demo steps (use with any patient or standalone):

  1. Show knowledge base version and statistics:
  2. Version: 2.0.0
  3. 22 HLA alleles mapped with disease associations and odds ratios
  4. 24 autoantibodies characterized with sensitivity/specificity data
  5. 22 biologic therapies catalogued with PGx considerations
  6. 20 disease activity scoring systems across 13 diseases
  7. 13 flare prediction biomarker patterns
  8. 10 ACR/EULAR classification criteria sets
  9. 9 overlap syndrome patterns
  10. Show collection statistics:
  11. Vector counts per collection
  12. Total vectors across all 14 collections
  13. Index type and similarity metric
  14. Show source citations:
  15. ACR/EULAR classification criteria (with publication years)
  16. CPIC pharmacogenomic guidelines
  17. HLA disease association databases
  18. FDA biologic drug approvals

Key talking point: "The knowledge base is curated from validated clinical sources -- ACR/EULAR classification criteria, HLA disease association databases, CPIC pharmacogenomic guidelines, and FDA biologic approvals. Every recommendation traces back to published evidence."


Sample API Interactions

For technical audiences, demonstrate the REST API alongside the UI:

Query via API

curl -X POST http://localhost:8532/v1/query \
  -H "Content-Type: application/json" \
  -d '{
    "question": "What biologics are recommended for refractory lupus nephritis?",
    "patient_id": "sarah_mitchell"
  }'

Expected response: JSON with answer, evidence (list of citations with scores), and knowledge_used fields.

Patient Analysis via API

curl -X POST http://localhost:8532/v1/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "patient_id": "sarah_mitchell",
    "include_autoantibodies": true,
    "include_hla": true,
    "include_activity": true,
    "include_flare": true,
    "include_therapy": true
  }'

Expected response: JSON with sections for autoantibody_interpretation, hla_associations, disease_activity, flare_prediction, and therapy_recommendations.

Export via API

# FHIR R4 export
curl -X POST http://localhost:8532/v1/export/fhir \
  -H "Content-Type: application/json" \
  -d '{"patient_id": "sarah_mitchell"}' \
  -o sarah_mitchell_fhir.json

# PDF report
curl -X GET http://localhost:8532/v1/report/sarah_mitchell/pdf \
  -o sarah_mitchell_report.pdf

Troubleshooting

Common Issues

Issue Symptoms Resolution
Streamlit not starting Port 8531 not responding Check port is free: lsof -i :8531. Kill conflicting process if needed.
"No collections found" Empty results in all tabs Run python3 scripts/setup_collections.py --seed to create and seed collections.
RAG returns empty responses Query returns but with no citations Check Milvus is running: curl localhost:19530/healthz. Verify collections are seeded.
Document ingest fails Error on PDF upload Check PDF file size (< 50 MB) and format. Ensure PyPDF2 can read the file. Corrupted PDFs will fail.
No demo patients available Patient dropdown is empty Run python3 scripts/generate_demo_patients.py to generate and ingest demo data.
LLM features unavailable Queries return without synthesis Verify AUTO_ANTHROPIC_API_KEY or ANTHROPIC_API_KEY environment variable is set with a valid key.
HLA analysis empty No HLA associations shown Ensure the selected patient has HLA profile data loaded. Not all patients have HLA genotyping.
Slow query responses Queries take > 60 seconds Check network latency to Anthropic API. Verify Milvus is not under memory pressure (docker stats).
Collection count mismatch Fewer than 14 collections Run python3 scripts/setup_collections.py --seed with --drop-existing flag to recreate all collections.

Milvus Connection Issues

# Check if Milvus container is running
docker ps | grep milvus

# Check Milvus logs for errors
docker logs milvus-standalone --tail 50

# Restart Milvus if needed
docker restart milvus-standalone

# Wait for Milvus to be ready (30-60 seconds)
until curl -s http://localhost:19530/healthz | grep -q OK; do
  echo "Waiting for Milvus..."
  sleep 5
done
echo "Milvus is ready"

Anthropic API Issues

# Verify API key is set
echo $ANTHROPIC_API_KEY | head -c 10
# Should show: sk-ant-api

# Test API connectivity
curl -s https://api.anthropic.com/v1/messages \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "content-type: application/json" \
  -H "anthropic-version: 2023-06-01" \
  -d '{"model":"claude-sonnet-4-6","max_tokens":10,"messages":[{"role":"user","content":"hi"}]}' \
  | python3 -m json.tool

Performance Optimization

If demo performance is slow:

  1. Reduce collections searched: Set AUTO_TOP_K_PER_COLLECTION=3 (default 5)
  2. Lower evidence threshold: Set AUTO_SCORE_THRESHOLD=0.50 (default 0.40) to reduce low-relevance results
  3. Check Docker resource allocation: Ensure Docker has at least 8 GB RAM allocated
  4. Monitor Milvus memory: docker stats milvus-standalone -- Milvus should use < 4 GB for 14 collections

Quick Reset

If you need to reset the demo environment completely:

cd ai_agent_adds/precision_autoimmune_agent

# Re-create collections and re-seed knowledge (drops and recreates)
python3 scripts/setup_collections.py --seed --drop-existing

# Re-generate demo patient data
python3 scripts/generate_demo_patients.py

# Verify all tests pass
python3 -m pytest tests/ -v
# -> 455 tests passed

# Restart Streamlit UI
# Ctrl+C the streamlit process, then:
streamlit run app/autoimmune_ui.py --server.port 8531

# Restart FastAPI server
# Ctrl+C the uvicorn process, then:
uvicorn api.main:app --host 0.0.0.0 --port 8532 --workers 2

Docker Reset

# Stop all autoimmune agent containers
docker compose -f docker-compose.yml down

# Rebuild and restart
docker compose -f docker-compose.yml up -d --build

# Watch setup progress
docker compose logs -f autoimmune-setup

# Verify services are healthy
docker compose ps