Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rybera

Denial defense infrastructure for commercial health insurers and TPAs.

Rybera intercepts fraudulent and miscoded claims before payment — scoring each one in real time, surfacing anomalies to Special Investigations Unit analysts, and generating court-defensible evidence packs for recovery and appeal.


The Problem

Commercial health insurance fraud costs the US system an estimated $36–50 billion per year (NHCAA: ~3–5% of ~$1T commercial premium). The dominant fraud vector today is AI-scribe-driven upcoding: providers using AI documentation tools that systematically inflate E/M codes, creating a statistically detectable but individually plausible pattern that legacy rule engines miss entirely.

Rybera catches it.


Product Architecture

Layered Fraud Scoring Pipeline (real-time, < 2s p99)

POST /v1/claims/score
        │
        ├── Ingest & normalize (patient_id hashed at boundary)
        ├── NPPES / OIG LEIE enrichment
        │
        ├── Layer 2 — AI Inflation Detection
        │     Clinical note embedding · coherence scoring ·
        │     speed-of-documentation signal · condition delta
        │
        ├── Layer 3 — Provider Pattern Analysis
        │     24-month rolling profile · E/M distribution z-score ·
        │     AI-scribe z-score · billed amount z-score · changepoint detection
        │
        ├── Layer 4 — Policyholder Pattern Analysis
        │     Cross-provider claim velocity · distinct provider count ·
        │     escalation rate · high-E/M concentration
        │
        └── Composite Score (0–100) + Routing Recommendation
              PAY  →  normal adjudication
              HOLD →  pend for SIU review
              ESCALATE → immediate SIU investigation

Clinical Validation Pipeline (E/M coding integrity)

validation_graph.py — LangGraph validation pipeline
        │
        ├── Clinical Validation Agent   (2021 AMA MDM scoring, forced tool-use)
        ├── AI-Scribe Detection         (HealthScribe / DeepScribe / Nabla signatures)
        ├── NCCI / MUE Code Edits       (deterministic bundling + volume checks)
        ├── Modifier Abuse Checks       (deterministic — fraud.py primitives)
        └── Disposition Synthesis       (fraud score + recommendation)

Validates E/M coding against the documented clinical note, catches NCCI bundling violations, modifier misuse, and AI-scribe-inflated documentation.

POST /api/v1/validate-claim           Full LangGraph validation pipeline
POST /api/v1/validate-claim/batch     Bulk validation
POST /api/v1/validate-claim/stream    SSE stream — watch agents fire live
GET  /api/v1/validations              Paginated validation history
GET  /api/v1/validations/{id}/audit-trail  Immutable SHA-256-chained audit log

SIU Portal (case management)

All SIU endpoints require an analyst session (Authorization: Bearer <JWT> from POST /v1/siu/auth/login) and are tenant-scoped to the analyst's carrier — one carrier's analysts can never read another carrier's data (ADR-037).

/v1/siu/auth/login                    Analyst login → JWT (8h)
/v1/siu/queue                         Case queue for SIU analysts
/v1/siu/cases/{id}                    Full case detail + scoring breakdown
/v1/siu/cases/{id}/decision           Accept / reject / pend decision
/v1/siu/cases/{id}/evidence-pack      Trigger PDF evidence pack generation
/v1/siu/rings · /rings/{id}           Ranked fraud-ring queue + ring detail
/v1/siu/typologies                    Learned fraud typologies
/v1/evidence-packs/{id}/download      Download court-defensible evidence PDF

Tech Stack

Layer Technology
API FastAPI (async), uvicorn
AI / Orchestration Claude Sonnet 4.6 (scoring), LangGraph (clinical validation pipeline)
Observability W&B Weave — every agent op traced
Database PostgreSQL + asyncpg (prod), SQLite + aiosqlite (dev/test)
Background jobs Celery + Redis
Encryption AES-256-GCM field encryption (crypto.py)
Audit ledger SHA-256-chained immutable ledger (ledger.py)
External registries OIG LEIE (daily sync), NPPES NPI REST API (7-day cache)
Frontend React 18 + TypeScript + Vite + Tailwind CSS (rybera-frontend/)
Migrations Alembic (12 migrations: V2 → V13)
Containerisation Docker + docker-compose (PostgreSQL, Redis, API, Worker, Flower)

HIPAA Compliance

Every enforcement point is documented in DECISIONS.md (ADR-001 through ADR-038):

  • patient_id SHA-256 hashed at the first line of every API endpoint — raw value never stored
  • clinical_note processed in memory only — stripped before any DB write
  • Cache-Control: no-store on all responses (middleware-enforced)
  • AES-256-GCM field encryption for PHI columns (FIELD_ENCRYPTION_KEY)
  • Immutable audit ledger with hash chain (court-defensible, ADR-002)
  • Per-carrier KMS-backed key derivation (carrier_kms.py, Phase 3)
  • OIG LEIE exclusion check on every claim at ingest

Quickstart

Local development (SQLite, no Redis)

cp .env.example .env
# .env ships ready for local dev: ENVIRONMENT=development + SQLite.
#   - Set ANTHROPIC_API_KEY   → required for clinical validation / scoring
#   - Set FIELD_ENCRYPTION_KEY → required before ANY real PHI (dev runs without it)

pip install -r requirements.txt
python seed_db.py     # loads the demo carrier + sample claims — the dashboard is empty without it
python start.py       # serves the API and the prebuilt frontend on :8000

Open http://localhost:8000 — Rybera frontend loads automatically. Swagger UI at http://localhost:8000/docs.

The SIU portal fails closed (ADR-037): sign in with the seeded demo analyst — carrier carrier-archive-medicare, username demo.analyst, password RyberaDemo2026! (or your RYBERA_DEMO_ANALYST_PASSWORD). Create more analysts via POST /v1/siu/auth/register (open in development; bootstrap-token-gated in production).

Run the test suite (477 pass, 12 documented xfail — see KNOWN_ISSUES.md):

pytest -q

For live frontend development (hot-reload dev server on :5173, proxies to the API on :8000):

cd rybera-frontend && npm install && npm run dev

Production (Docker)

cp .env.example .env
# Set for production: ENVIRONMENT=production, a Postgres DATABASE_URL,
# FIELD_ENCRYPTION_KEY, SECRET_KEY, and CORS_ALLOWED_ORIGINS
# (comma-separated carrier portal URLs — no wildcard in production).

alembic upgrade head   # build/upgrade the Postgres schema to V13
docker compose up -d

Services: api (port 8000), worker (Celery), flower (port 5555), db (Postgres), redis.


API Reference

Fraud Scoring

POST /v1/claims/score
Header: X-Rybera-Carrier-Key: <carrier_key>

{
  "carrier_id": "carrier-abc",
  "external_claim_id": "CLM-2026-001",
  "provider_npi": "1234567890",
  "patient_id": "MBR-99999",          ← hashed at boundary
  "em_code_billed": "99215",
  "icd10_codes": ["M17.11"],
  "cpt_codes": ["99215", "20610"],
  "modifiers": [],
  "billed_amount": 485.00,
  "date_of_service": "2026-06-01",
  "clinical_note": "..."               ← never stored
}

→ {
    "composite_score": 82,
    "score_recommendation": "ESCALATE",
    "score_reliability": "reliable",
    "layer2_score": 71,
    "layer3_score": 88,
    "layer4_score": 65,
    ...
  }

Clinical Validation

POST /api/v1/validate-claim
Header: X-API-Key: <tenant_key>

→ {
    "validation_id": "...",
    "fraud_score": 74,
    "risk_level": "HIGH",
    "disposition_recommendation": "HOLD",
    ...
  }

Key Files

File Purpose
server.py Unified FastAPI entry point — all routes
database.py SQLAlchemy async ORM — all schema models
scoring.py Composite fraud score aggregator
ingest.py Claim normalization + NPPES/LEIE enrichment
layer2_ai_inflation.py AI scribe upcoding detection
layer3_provider_pattern.py 24-month provider behavior profiling
layer4_policyholder.py Cross-provider policyholder patterns
layer5_graph.py Network graph — collusion ring detection
validation_graph.py Clinical validation pipeline (LangGraph)
fraud.py Deterministic fraud-signal primitives (modifier / POS / volume)
phi_redaction.py Clinical-note redaction for the audit trail (ADR-036)
siu_portal.py SIU case management router
evidence_pack.py ReportLab evidence PDF generation
ledger.py SHA-256-chained immutable audit ledger
crypto.py AES-256-GCM field encryption
carrier_kms.py Per-carrier HKDF key derivation
external_registry.py OIG LEIE + NPPES NPI registry
ai_scribe_detector.py Clinical note AI-generation detection
clinical_agent.py LLM-based MDM scoring agent
worker.py Celery background tasks
start.py Development launcher

Business Model

Rybera is priced on shared savings: 20% of overbilling recovered through Rybera's intervention. No upfront licensing — carriers pay only when Rybera catches fraud.

SHARED_SAVINGS_RATE=0.20 (configurable per carrier in .env).


Architecture Decisions

All non-obvious design choices are documented in DECISIONS.md (ADR-001 through ADR-038), covering database choice, immutable ledger design, HIPAA de-identification approach, encryption strategy, OIG sync method, provider profile window, real-time scoring latency constraints, NPPES caching, evidence-pack determinism, analyst-id-from-session auth (ADR-010), and the fraud-ring intelligence layer.

About

Rybera — real-time fraud-ring intelligence & denial defense for commercial health insurers. Five-layer claim scoring, SIU investigation portal, court-defensible evidence packs. FastAPI + React.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages