Admin Portal

Internal operations dashboard for prescription management, patient service, and system monitoring.

Overview

The Admin Portal is a React single-page application hosted on CloudFront at admin.yourera.com. It serves as the primary internal operations tool for the YourEra clinical team, providing a unified interface for prescription management, patient service, and system monitoring.

All data is fetched from the Integration Service API. The portal is built with React 19, Vite 7, and Tailwind 4, deployed to S3 with CloudFront distribution E377C28XG5JL8L.

Pages

PagePathDescription
Dashboard / Revenue metrics, Rx review count, shipment pipeline, pharmacy routing split
RxQueue /rx-queue Prescription approval queue with H&P form and dosage selector
Orders /orders Paginated order table with payment and shipment joined view
Customer Service /customers Patient search, detail view with tabs for intake, payments, Rx, shipments, refills
Appointments /appointments Telehealth appointment list with Zoom links and status filter
Messenger /messenger HubSpot conversation inbox with thread management and reply
Sync Logs /sync-logs Canvas-to-PioneerRx integration audit trail

Architecture

┌─────────────────────────────────────────┐
│  admin.yourera.com (CloudFront + S3)    │
│  React 19 + Vite 7 + Tailwind 4        │
└──────────────────┬──────────────────────┘
                   │ HTTPS (JWT auth)
┌──────────────────▼──────────────────────┐
│  Integration Service (ECS)              │
│  /api/admin/*  /api/tasks  /api/rx-queue│
└──────────────────┬──────────────────────┘
         ┌────────┼────────┐
    Canvas    Stripe   PioneerRx

Authentication

The Admin Portal supports three authentication methods, each issuing a JWT with 24-hour expiry that is included as a Bearer token in all subsequent API requests.

1. OTP Email

Available to any @yourera.com email address. The integration service sends a one-time passcode via AWS SES from noreply@yourera.com. The OTP is stored in memory on the server with a 5-minute TTL.

POST /api/admin/auth/send-code

Sends an OTP to the provided @yourera.com email address.

POST /api/admin/auth/verify

Validates the OTP and returns a signed JWT.

2. Canvas HMAC

Used by the Canvas prescription_queue plugin. The plugin generates an HMAC-signed URL containing a timestamp and signature, which the integration service validates before issuing a JWT. This provides seamless SSO from Canvas into the RxQueue page.

GET /api/admin/auth/validate-canvas?ts=...&sig=...

Validates the HMAC signature and timestamp, returns a JWT, and redirects to /rx-queue.

3. Magic Link

Sends a one-click login link to the admin's email. The link contains a signed token that is validated on click to issue a session JWT.

Security All three methods result in the same JWT format. The requireAdmin() middleware also accepts an ADMIN_SECRET header for server-to-server calls (e.g., from the Canvas plugin or cron jobs).

Dashboard

The dashboard provides a real-time operational snapshot of the YourEra platform, with metrics that auto-refresh every 60 seconds.

Metrics Cards

Data Source

GET /api/admin/stats

Returns aggregated dashboard statistics including revenue, pending Rx count, shipment statuses, and routing distribution.

RxQueue

The RxQueue is the primary clinical workflow interface. Practitioners review incoming prescriptions, complete History & Physical (H&P) documentation, select dosage options, and approve or deny prescriptions.

Workflow

  1. Tasks are loaded from Canvas FHIR as "Rx Review" tasks, enriched with patient data
  2. Practitioner selects a task to view full patient details and intake data
  3. H&P form is completed inline (no popup modal)
  4. Dosage is selected from available options for the medication
  5. Practitioner approves or denies the prescription
  6. On approval, the orchestrator pipeline is triggered (pharmacy routing, payment, shipping, notifications)

H&P Data

The /api/rx-queue/hp-data/:taskId endpoint returns a comprehensive data package for the practitioner review:

Task Actions

POST /api/task-action

Approve or deny a prescription task. On approval, triggers the 7-step orchestrator pipeline and creates an H&P note in Canvas.

Orchestrator Dependency The Canvas AutoPrescribeOnApproval plugin does NOT fire on FHIR API task updates (only Canvas UI). The RxQueue approve action calls the orchestrator directly, which is the sole production path for prescription fulfillment.

Orders

The Orders page presents a paginated table of all patient orders with joined payment and shipment data. Orders can be filtered by status, date range, medication type, and pharmacy.

Features

GET /api/admin/orders?page=1&limit=25&status=...

Returns paginated orders with payment and shipment data joined.

Customer Service

The Customer Service page provides a comprehensive patient lookup and management interface. Staff can search patients and view a full detail view with tabbed sections.

Patient Search

Search by name, email, phone, or Canvas patient ID. Results are returned from the integration service which queries both Canvas FHIR and the local database.

GET /api/admin/patients?q=search_term

Searches patients across Canvas and the integration service database.

Patient Detail Tabs

TabData SourceDescription
Intake Integration DB Original intake questionnaire responses and submitted data
Payments Stripe Payment history, charges, refunds, and saved payment methods
Prescriptions Canvas FHIR Active and historical prescriptions from Canvas MedicationRequest
Shipments Integration DB All shipments with tracking status and FedEx/Boothwyn details
Refills Integration DB Refill schedule, upcoming refills, and refill history

Actions

Appointments

The Appointments page displays all scheduled telehealth appointments with Zoom meeting links. The list auto-refreshes every 30 seconds to keep the view current.

Features

GET /api/admin/appointments?status=upcoming

Returns telehealth appointments with Zoom meeting details and patient context.

Messenger

The Messenger page integrates with HubSpot's Conversations API to provide an in-app messaging interface. Staff can view conversation threads, send replies, and manage patient communications without leaving the admin portal.

HubSpot Integration

GET /api/admin/conversations?status=open

Returns HubSpot conversation threads with messages, filtered by status.

POST /api/admin/conversations/:threadId/reply

Sends a reply to an existing HubSpot conversation thread.

Sync Logs

The Sync Logs page provides an audit trail for all Canvas-to-PioneerRx integration events. Every prescription sync, patient creation, and pharmacy submission is logged with request/response payloads for debugging and compliance.

Log Entry Fields

GET /api/admin/sync-logs?page=1&limit=50&type=...

Returns paginated sync log entries with optional filtering by event type and status.

API Endpoints

All endpoints require admin authentication via JWT Bearer token or ADMIN_SECRET header. The base URL is the Integration Service: https://api.yourera.com.

Authentication

MethodEndpointDescription
POST /api/admin/auth/send-code Send OTP to @yourera.com email
POST /api/admin/auth/verify Verify OTP and return JWT
GET /api/admin/auth/validate-canvas Validate Canvas HMAC and return JWT

Dashboard & Operations

MethodEndpointDescription
GET /api/admin/stats Dashboard aggregated statistics
GET /api/admin/patients Patient search
GET /api/admin/patients/:id Patient detail with all tabs
GET /api/admin/orders Paginated orders with filters
GET /api/admin/appointments Telehealth appointment list
GET /api/admin/conversations HubSpot conversation threads
POST /api/admin/conversations/:id/reply Reply to conversation thread
GET /api/admin/sync-logs Integration audit trail

Patient Management Actions

MethodEndpointDescription
POST /api/admin/refund Issue full or partial Stripe refund
POST /api/admin/charge-hold Charge a saved payment method
GET /api/admin/prescriptions/:patientId Patient prescriptions from Canvas
GET /api/admin/shipments/:patientId Patient shipment history
GET /api/admin/refills/:patientId Patient refill schedule and history

RxQueue

MethodEndpointDescription
GET /api/tasks List Rx Review tasks with patient enrichment
GET /api/rx-queue/hp-data/:taskId H&P data package for practitioner review
POST /api/task-action Approve or deny prescription (triggers orchestrator)
GET /api/practitioners Canvas practitioner list