stemedb/latent/ux.md
jordan b3e8a9a058 feat: Multi-application expansion with chaos testing and community UI
Major additions:
- Community Next.js app (port 18187) for browsing claims with API docs
- stemedb-chaos crate: Fault injection, chaos testing, CRDT properties
- Latent ingestion system: Reddit/FDA ingesters with ADK-Go agents
- Disputed claims handling: Manual review workflows and validation
- Aphoria security scanner: New extractors (SQL injection, command
  injection, weak crypto, TLS version), policy-based ignores, UAT reports
- Docker infrastructure: Dockerfile, docker-compose.yml for full stack
- VulnBank demo: Intentionally vulnerable multi-language test corpus

SDK & API enhancements:
- Source registry handlers for tracking data provenance
- Metrics endpoint
- Skeptic filtering improvements

Code quality:
- Split 14 large files (>500 lines) into focused modules
- All files now under 500-line limit per project guidelines

Documentation:
- Chaos testing guide, circuit breakers, observability docs
- Phase 7 UAT documentation updates
- Martin Kleppmann technical writer agent

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 01:24:14 -07:00

8.3 KiB

Latent: User Interface (ASCII)

Role: Pharmacovigilance Analyst / BioTech Investor Task: Investigating a potential safety signal for "Semaglutide"

1. The Dashboard (The "Heatmap")

The entry point. Not a search bar, but a live monitor of Epistemic Divergence.

┌─────────────────────────────────────────────────────────────────────────────────┐
│ LATENT v1.0                                [ Settings ] [ Alerts ] [ Export ]   │
└─────────────────────────────────────────────────────────────────────────────────┘
  WATCHLIST (12 Molecules)                    DIVERGENCE SCORE (Last 30d)
  ─────────────────────────────────────────────────────────────────────────────────
  1. Semaglutide (Ozempic)     [CRITICAL]     ██████████████░░  0.88 (+0.12) ▲
  2. Tirzepatide (Mounjaro)    [ELEVATED]     ████████░░░░░░░░  0.52 (+0.04) ▲
  3. Risankizumab              [STABLE]       ██░░░░░░░░░░░░░░  0.15 (-0.01) ▼
  4. L-Theanine (Supp)         [NOISY]        ████░░░░░░░░░░░░  0.28 (+0.00) ─
  ─────────────────────────────────────────────────────────────────────────────────

  [ ALERT ] Semaglutide: "Gastroparesis" signal crossed Tier 4 threshold (0.6).
            Primary Driver: Patient Forums (Tier 5) vs Clinical Label (Tier 0).

2. The Molecule View (The "Conflict Engine")

User clicks "Semaglutide". This is the core view. It splits reality into three layers.

┌─────────────────────────────────────────────────────────────────────────────────┐
│ MOLECULE: Semaglutide                                                           │
│ STATUS:   DIVERGENT ⚠️                                                          │
└─────────────────────────────────────────────────────────────────────────────────┘

  [ LAYER 1: THE OFFICIAL TRUTH (Tier 0-1) ]
  ────────────────────────────────────────────────────────────────────────
  FDA Label (2023-01):  "GI adverse events common. No mention of paralysis."
  NEJM Trial (Step 1):  "Nausea (44%), Vomiting (24%). Transient."
  EMA Filing:           "Thyroid signal monitored. No GI alarm."
  ────────────────────────────────────────────────────────────────────────
       ▼
       ▼  (Conflict: 0.88)
       ▼
  [ LAYER 2: THE LATENT SIGNAL (Tier 4-5) ]
  ────────────────────────────────────────────────────────────────────────
  Reddit (/r/Ozempic):  "Stomach paralysis" (Cluster: 412 posts, +45% WoW)
  Twitter (MDs):        "Seeing ER admits for aspiration pneumonia." (12 sigs)
  FAERS (Raw):          "Gastric obstruction" (84 unverified reports)
  ────────────────────────────────────────────────────────────────────────

  [ ANALYSIS: THE SKEPTIC LENS ]
  "The Official Truth says GI issues are 'Transient'.
   The Latent Signal says GI issues are 'Permanent/Severe' (Paralysis).
   
   This is a CATEGORICAL CONFLICT.
   Signal Authority: Low (Tier 5) but Density is High (Vol > 400)."

3. The Timeline (The "Time Travel")

User investigates when this divergence started.

  TIMELINE: "Gastroparesis" Signal vs. Label Updates
  ──────────────────────────────────────────────────────────────────────────────
  2022-Q1  | 2022-Q2  | 2022-Q3  | 2022-Q4  | 2023-Q1  | 2023-Q2  | 2023-Q3 (Now)
  ─────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────────
  Label    |          |          |          |          |          |
  (Tier 0) | [SILENT] | [SILENT] | [SILENT] | [SILENT] | [SILENT] | [SILENT]
  ─────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────────
  Social   |          |          |          |          |   ⚠️     |   🔥
  (Tier 5) |    .     |    ..    |   ...    |  .....   | [SIGNAL] | [SURGE]
           |          |          |          |          | First    | CNN picks
           |          |          |          |          | Cluster  | up story
  ──────────────────────────────────────────────────────────────────────────────
  
  [ INSIGHT ]
  The Latent Signal emerged in 2023-Q2. The Label is lagging by ~6 months.
  Predicted Label Update: Q4 2023 (Probability: 75%)

4. The Source Inspector (The "Evidence")

User clicks on the "Reddit Cluster" to see the raw data.

┌─────────────────────────────────────────────────────────────────────────────────┐
│ SOURCE INSPECTOR: Cluster #8492 "Gastroparesis"                                 │
└─────────────────────────────────────────────────────────────────────────────────┘

  SOURCE CLASS: Tier 5 (Anecdotal/Unverified)
  VOLUME:       412 Assertions
  SENTIMENT:    Negative (-0.9)
  
  [ KEY EXCERPTS ]
  1. "ER Doc said my stomach essentially stopped working. Been off Oz for 3mo."
     (Source: Reddit, Karma: 4k, Date: 2 days ago)
     
  2. "Diagnosed with gastroparesis after 6 months on 1mg."
     (Source: PatientsLikeMe, Verified User, Date: 1 week ago)

  [ RELATED CLINICAL CONTEXT ]
  * Does this match Mechanism of Action? YES (GLP-1 slows gastric emptying).
  * Is it in the Label? NO (Label says "nausea", not "paralysis").

5. The Command Line (The "Power User")

For the analyst who wants to query the graph directly.

> latent query --subject "Semaglutide" --predicate "side_effect" --lens skeptic

[RESULT]
Subject: Semaglutide
Predicate: side_effect

1. Nausea (Confidence: 0.99) [Consensus]
   - Sources: FDA, EMA, NEJM, Reddit

2. Vomiting (Confidence: 0.98) [Consensus]
   - Sources: FDA, EMA, Reddit

3. Gastroparesis (Confidence: 0.45) [CONFLICT]
   - Sources: Reddit (High Vol), Twitter (Med Vol)
   - Contradicted By: NEJM ("No signal")
   - Source Tier Spread: 4 (Tier 1 vs Tier 5)

> latent simulate --event "FDA Warning Added"

[SIMULATION]
If FDA adds "Gastroparesis" warning (Tier 0):
- Conflict Score drops to 0.1 (Resolution reached).
- Liability risk for past prescriptions increases (Knowledge date: 2023-Q2).