Skip to main content

Architecture

Components

Prescription Form

  • Purpose: Captures clinical prescription data
  • Technology: React form with validation
  • Service Integration: PrescriptionService
  • Key Functions:
    • Medication selection with dosage
    • Patient health metrics input
    • Clinical pathway tracking

Service Layer Operations

  • Purpose: Business logic and data processing
  • Technology: TypeScript services with Zod validation
  • Service Integration: PrescriptionService
  • Key Functions:
    • Prescription creation via PrescriptionService.create()
    • Order validation and compliance checking
    • Payment processing integration
    • Shipment creation coordination

Edge Function Processing

  • Purpose: Secure server-side operations
  • Technology: clinical-prescription-operations Edge Function
  • Key Functions:
    • Prescription record creation
    • Health metrics storage
    • Audit trail logging
    • Controlled drug compliance monitoring

DHL Integration

  • Purpose: Automated medication delivery
  • Technology: DHL API via ShipmentService
  • Key Functions:
    • Shipment creation with tracking
    • Van pickup scheduling
    • Delivery confirmation handling

Clinical Pathways

New Patient

Patient assessment → titration prescriptions → health monitoring → dosage adjustments.

Stable Patient

Routine 28-day prescriptions → minimal monitoring → automatic renewals.

Titration Patient

Frequent prescriptions → intensive monitoring → dosage optimization.

Service Layer Integration

Frontend to Service

  • PrescriptionService.create() - Creates prescription orders
  • PrescriptionService.getById() - Retrieves prescription details
  • PrescriptionService.update() - Updates prescription status
  • PaymentService.processPayment() - Handles payment processing
  • ShipmentService.createShipment() - Creates DHL shipments

Service to Edge Functions

  • clinical-prescription-operations - Prescription CRUD operations
  • clinical-payment-operations - Payment processing
  • clinical-shipment-operations - Shipment management
  • prescription-notifications - Patient notifications
All prescriptions follow 28-day cycles for controlled drug compliance and are processed through the service layer architecture