stemedb/uat/consumer-health/README.md
jordan 41c676a78e feat: Aphoria enterprise features + ontology SDK + file length compliance
Enterprise Features:
- Hosted mode with remote sync for team pattern aggregation
- Community sharing with privacy-preserving anonymization
- LLM-based semantic claim extraction with Gemini integration
- Pattern learning with promotion to declarative extractors
- High-entropy secrets extractor with configurable thresholds
- Auth bypass and insecure cookies extractors

Module Refactoring:
- Split oversized files to comply with 500-line limit
- Config split: types/core.rs, types/extractors.rs, types/hosted.rs, etc.
- Handlers split: scan.rs, policy.rs, report.rs modules
- Extractors split: declarative/, high_entropy_secrets/, insecure_cookies/
- Learning split: store modules with metrics and persistence

SDK & Ontology:
- stemedb-ontology SDK with fluent builders and StemeDB client
- Pharma domain extractors for FDA Orange Book data
- Consumer health UAT test infrastructure

Code Quality:
- Fixed clippy warnings (needless_borrows_for_generic_args)
- Added KVStore trait imports where needed
- Fixed utoipa path re-exports for OpenAPI docs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 12:55:29 -07:00

122 lines
4.8 KiB
Markdown

# Consumer Health UAT Scenarios
User Acceptance Testing for the Ontology Layer + Medical Vertical.
## Prerequisites
1. StemeDB running: `cargo run -p stemedb-api`
2. Ontology crate built: `cargo build -p stemedb-ontology`
3. Pharma CLI available: `cargo build --bin pharma-ingest`
## Week 4 Milestone: Automated UAT Infrastructure
**Status:****VERIFIED** - All Scenarios Passing (2026-02-05)
**Verification Results:**
```
╔══════════════════════════════════════════════════════════════╗
║ Consumer Health UAT - Week 4 Validation ║
╚══════════════════════════════════════════════════════════════╝
✓ GLP-1 Muscle Loss Contradiction - PASS
✓ Gastroparesis Multi-Source - PASS
✓ Layered Consensus - PASS
✓ Time Travel Query - SKIP (deferred)
╔══════════════════════════════════════════════════════════════╗
║ Results: 4 passed, 0 failed, 0 skipped
╚══════════════════════════════════════════════════════════════╝
```
**Deliverables:**
- **Integration Test Suite:** `crates/stemedb-ontology/tests/consumer_health_uat.rs`
- Real Ed25519 v1 signing (not dummy signatures)
- 4 automated UAT scenarios
- ~17 seconds end-to-end runtime
- **API Readiness Validator:** `validate_api_readiness.sh`
- **Execution Plan:** [WEEK4_EXECUTION_PLAN.md](./WEEK4_EXECUTION_PLAN.md)
### Quick Start (Automated Testing)
```bash
# 1. Start API with fresh database
rm -rf data/ && cargo run -p stemedb-api &
sleep 5
# 2. Run all automated UAT scenarios
STEMEDB_API_URL=http://localhost:18180 cargo test --test consumer_health_uat run_all_uat_scenarios -- --ignored --nocapture
# 3. Run individual scenario
STEMEDB_API_URL=http://localhost:18180 cargo test --test consumer_health_uat uat_glp1_muscle_loss_contradiction -- --ignored --nocapture
```
See [WEEK4_EXECUTION_PLAN.md](./WEEK4_EXECUTION_PLAN.md) for detailed execution instructions.
## Scenario Overview
### GLP-1 Living Systematic Review Scenarios
| Scenario | File | Tests |
|----------|------|-------|
| Muscle Loss Contradiction | `glp1-muscle-loss-contradiction.md` | Skeptic Lens conflict detection |
| FDA Label Paradigm Shift | `glp1-fda-label-paradigm-shift.md` | Epoch supersession O(1) |
| Pre-print vs Peer Review | `glp1-preprint-vs-peer-review.md` | Multi-sig weighting |
| Semantic Decay | `glp1-semantic-decay.md` | 73-day half-life |
| Visual Anchoring | `glp1-visual-anchoring.md` | pHash validation |
### Consumer Health Intelligence Scenarios
| Scenario | File | Tests |
|----------|------|-------|
| Gastroparesis Multi-Source | `gastroparesis-multi-source.md` | Source-class hierarchy |
| Anecdotal Signal Precedence | `anecdotal-signal-precedence.md` | Cluster escalation |
| Guidance Change Propagation | `guidance-change-propagation.md` | "What changed since?" |
| Layered Consensus | `layered-consensus.md` | Per-tier positions |
| Time Travel Query | `time-travel-query.md` | as_of snapshot |
| Disagreement Dashboard | `disagreement-dashboard.md` | Resolved/Active/Emerging |
## Running Scenarios
Each scenario file contains:
1. **Scenario description** - What we're testing
2. **Test matrix** - Expected vs actual results
3. **Commands** - Exact curl/CLI commands to run
4. **Sign-off checklist** - Manual verification points
### Example Workflow
```bash
# 1. Start StemeDB
cargo run --bin stemedb-api &
# 2. Run a scenario
# Follow commands in glp1-muscle-loss-contradiction.md
# 3. Record results
# Update the test matrix with actual values
# 4. Archive results
cp glp1-muscle-loss-contradiction.md results/2024-XX-XX-muscle-loss.md
```
## Weekly Execution Schedule
| Week | Scenarios | Why |
|------|-----------|-----|
| 1 | (none) | Building domain definition |
| 2 | (none) | Building extractor |
| 3 | `glp1-muscle-loss-contradiction` | First conflict demo |
| 4 | `gastroparesis-multi-source`, `layered-consensus` | Source hierarchy |
| 5 | `glp1-fda-label-paradigm-shift` | Epochs |
| 6 | Full suite | Integration validation |
## Success Criteria
From **GLP-1 Living Review**:
- Query `muscle_sparing_effect` with Skeptic lens returns `conflict_score > 0.5`
- Epoch supersession invalidates assertions O(1), not O(N)
- Multi-sig: Lancet reviewer signature has higher weight
From **Consumer Health Intelligence**:
- Tier 0 (FDA) wins over 100x Tier 5 (Reddit) volume
- `lens=layered-consensus` returns per-tier positions
- Source-aware decay: NEJM 8mo old ~0.87 effective; Reddit 26mo old expired