Skip to content

flexpa/rtpbc-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

CARIN RTPBC + BB + DIC Prototype

A demonstration of how to bridge CARIN Digital Insurance Card (DIC) Coverage resources with Real-Time Pharmacy Benefit Check (RTPBC) requirements, enabling real-world adoption of pharmacy benefit checking at the point of prescribing.

๐Ÿ”— Coverage Resource Relationships

graph TB
    subgraph "Health Plan"
        DIC["CARIN DIC Coverage<br/>Resource includes<br/>RxBIN RxPCN<br/>RxGroup RxID"]
    end
    
    DIC -->|"Embedded in"| CBB
    
    subgraph "CARIN Blue Button API"
        CBB["Coverage Endpoint<br/>/Coverage/{id}<br/>Returns DIC-profiled<br/>Coverage Resource"]
    end
    
    CBB -->|"GET request"| CLIENT
    
    subgraph "Client Application"
        CLIENT["Retrieve Coverage<br/>from CARIN BB API"]
        CLIENT --> TRANSFORM
        TRANSFORM["Extract Pharmacy IDs<br/>from DIC Coverage"]
        TRANSFORM --> RTPBC
        RTPBC["Use with RTPBC<br/>for benefit checks"]
    end
    
    style DIC fill:#81c784
    style CBB fill:#e1f5fe
    style CLIENT fill:#fff9c4
    style TRANSFORM fill:#fff9c4
    style RTPBC fill:#ffb74d
Loading

This implementation demonstrates how CARIN DIC Coverage Resources are embedded within CARIN Blue Button APIs, then retrieved and used to enable Real-Time Pharmacy Benefit Check workflows, helping patients get real-time benefits information about their prescriptions.

Why RTPBC + CARIN BB Patient Access API = Perfect Match

Implementing RTPBC in the context of a CARIN Blue Button Patient Access API creates a powerful synergy that solves multiple challenges simultaneously:

1. Authentication is Already Solved

  • CARIN BB APIs require OAuth 2.0 patient authentication
  • Patients have already consented and authenticated to access their data
  • The same authenticated session can be used for RTPBC requests
  • No need for separate authentication workflows or credentials

2. Patient-Centered Architecture

  • Both APIs are designed for patient empowerment
  • Patients control access to their own benefit information
  • Aligns with CMS interoperability rules requiring patient access
  • Supports patient choice and transparency in healthcare costs

3. Single Integration Point

  • Developers integrate once with the payer's CARIN BB API
  • Same API provides claims history AND real-time benefit checks
  • Reduces implementation complexity and maintenance burden
  • Leverages existing SMART on FHIR infrastructure

4. Trust and Security

  • Patient has established trust relationship with their health plan
  • OAuth flow ensures only authorized applications access data
  • Audit trails show patient-initiated benefit checks
  • Reduces risk of unauthorized pharmacy benefit inquiries

๐ŸŽฏ The Interoperability Challenge

This prototype addresses a critical gap preventing widespread adoption of real-time pharmacy benefit checking in the United States healthcare system.

๐Ÿ“‹ Problem Statement

The Vision: Real-Time Pharmacy Benefit Check

The CARIN Real-Time Pharmacy Benefit Check (RTPBC) Implementation Guide enables a transformative capability: allowing prescribers to check medication coverage and patient out-of-pocket costs at the point of prescribing. This means:

  • Patients know their copay before leaving the doctor's office
  • Physicians can discuss affordable alternatives during the visit
  • Prior authorization requirements are identified immediately
  • Pharmacy surprises and medication abandonment are reduced

The Barrier: Missing Pharmacy Identifiers

RTPBC requires specific pharmacy benefit identifiers to route requests to the correct Pharmacy Benefit Manager (PBM) systems. These identifiers, familiar from physical insurance cards, include:

  • rxid - The member's unique identifier for pharmacy benefits (often different from medical ID)
  • rxgroup - Identifies the specific benefit design/formulary
  • rxbin - Bank Identification Number that routes to the correct PBM processor
  • rxpcn - Processor Control Number for additional routing specificity

Without these identifiers, RTPBC requests cannot be processed - they literally cannot reach the systems that know the patient's drug coverage.

The Gap: CARIN Blue Button Doesn't Include Pharmacy Elements

Most health plans have implemented the CARIN Consumer Directed Payer Data Exchange (CARIN Blue Buttonยฎ) Implementation Guide, which enables patients to access their claims data via FHIR APIs. However, the Coverage resource in CARIN BB was designed for medical claims and doesn't profile these pharmacy-specific elements.

This creates a chicken-and-egg problem:

  • Prescriber systems need these identifiers to check drug prices
  • Payer systems have the data but don't expose it via their FHIR APIs
  • Adding new fields to existing implementations is a significant undertaking

The Bridge: CARIN Digital Insurance Card

The CARIN Digital Insurance Card Implementation Guide was designed to digitize insurance cards for mobile wallets and apps. Critically, it includes ALL the pharmacy identifiers needed for RTPBC:

Coverage.class[rxbin]   โ†’ Maps to โ†’ RTPBC Coverage.class:bin
Coverage.class[rxpcn]   โ†’ Maps to โ†’ RTPBC Coverage.class:pcn  
Coverage.class[rxgroup] โ†’ Maps to โ†’ RTPBC Coverage.class:rxgroup-id
Coverage.class[rxid]    โ†’ Maps to โ†’ RTPBC Coverage.class:pbm-member-id

Many payers are already implementing or planning to implement digital insurance cards for member convenience. This creates an opportunity: systems that expose CARIN DIC Coverage resources already have the data needed for RTPBC.

Why This Matters

  • For Patients: Medication costs become transparent at the point of care, reducing abandonment and improving adherence
  • For Providers: Enables informed prescribing decisions during the visit by helping patients get real-time benefit information
  • For Payers: Existing digital insurance card implementations can enable RTPBC without major rework
  • For the Ecosystem: Demonstrates how FHIR IGs can work together to solve real-world problems

๐Ÿ’ก Solution

This demo implements a complete end-to-end flow:

  1. SMART on FHIR Authorization - Simulated OAuth2 flow with popup-based authentication
  2. FHIR API Integration - Retrieves Coverage resources with the CARIN DIC profile
  3. Data Transformation - Maps DIC Coverage elements to RTPBC-required format
  4. Visual Demonstration - Side-by-side comparison showing the transformation

๐Ÿš€ Quick Start

Prerequisites

  • Bun runtime installed
  • Modern web browser (Chrome, Firefox, Safari, or Edge)
  • Port 3000 and 3001 available

Installation & Running

  1. Clone the repository

    git clone <repository-url>
    cd rtpbc-demo
  2. Start the Mock FHIR Server

    cd server
    bun install
    bun run dev

    The server will start on http://localhost:3001

  3. Start the Client Application (in a new terminal)

    cd client
    bun serve.js

    The client will be available at http://localhost:3000

๐Ÿ“– Demo Walkthrough

  1. Navigate to http://localhost:3000 in your browser
  2. Click "Start SMART Launch" to begin the authorization flow
  3. Sign in using the pre-filled demo credentials (or any values)
  4. View the transformation as the app:
    • Fetches the CARIN DIC Coverage resource
    • Transforms it to RTPBC format
    • Displays both versions side-by-side
    • Shows the field mappings

๐Ÿ—๏ธ Architecture

Project Structure

rtpbc-demo/
โ”œโ”€โ”€ server/                 # Mock FHIR server
โ”‚   โ”œโ”€โ”€ index.js           # Express server with SMART auth
โ”‚   โ”œโ”€โ”€ mockData.js        # FHIR resource examples
โ”‚   โ””โ”€โ”€ auth.html          # OAuth authorization page
โ”œโ”€โ”€ client/                 # Browser-based demo app
โ”‚   โ”œโ”€โ”€ index.html         # Main application UI
โ”‚   โ”œโ”€โ”€ app.js             # SMART client & transformation logic
โ”‚   โ””โ”€โ”€ styles.css         # Application styling
โ””โ”€โ”€ README.md              # This file

Key Components

  • Mock FHIR Server: Implements SMART on FHIR authorization and FHIR API endpoints
  • Coverage Transformation: Maps CARIN DIC fields to RTPBC requirements
  • Visual Interface: Shows the complete data flow and transformations

๐Ÿ”„ Field Mapping Details

The transformation preserves critical pharmacy routing information:

CARIN DIC Field Example Value RTPBC Field Purpose
Coverage.class[rxbin] "100045" Coverage.class:bin PBM routing
Coverage.class[rxpcn] "1234000" Coverage.class:pcn Processor routing
Coverage.class[rxgroup] "GOLD2024" Coverage.class:rxgroup-id Group benefits
Coverage.class[rxid] "102345672-01" Coverage.class:pbm-member-id Member identification

๐Ÿ”’ Security Considerations

This is a demonstration application with simplified security:

  • Mock authentication (no real credentials required)
  • No data persistence
  • CORS enabled for local development

For production implementations:

  • Implement real SMART on FHIR security
  • Follow OAuth2 best practices
  • Validate all FHIR resources
  • Implement proper error handling
  • Add audit logging

๐Ÿ› ๏ธ Implementation Standards

This reference implementation follows these HL7 FHIR Implementation Guides:

๐Ÿ“š Additional Resources

CARIN Alliance Resources

Related Standards

๐Ÿค Contributing

This is a reference implementation intended to demonstrate the concept. For questions or suggestions:

  • Open an issue in the repository
  • Contact the CARIN Alliance working groups
  • Participate in HL7 FHIR connectathons

โ„น๏ธ Sponsored by Flexpa
Flexpa is committed to advancing healthcare interoperability and supporting real-world adoption of FHIR standards. We believe that patients deserve transparency in healthcare costs, and this reference implementation demonstrates one path toward that goal.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •