Enter Password

Incorrect password. Please try again.
← Back to Home

Healthcare Workflow System

Complete System Architecture & Data Flow Documentation

System Overview

SprkzDoc Healthcare Workflow System is a comprehensive platform for managing patient enrollment and document workflows in healthcare settings.

The system consists of multiple specialized applications working together to create seamless, role-based form completion workflows.

1️⃣ FormMan
PDF Configuration & Field Management
2️⃣ JourneyMan
Workflow Template Creation
3️⃣ JourneyGuide
Journey Instance Management
4️⃣ Actions API
Notification & Magic Link System
5️⃣ Participants
Patients, Medical Staff, Providers
🔧 Sourdough API
Core Backend Services

Complete System Flow

This diagram shows the complete end-to-end flow from PDF configuration to journey completion, including all system components and their interactions.

graph TB Start([Admin User]) --> FormMan subgraph FormMan["1️⃣ FormMan - PDF Configuration"] FM1[Upload PDF Template] FM2[Place QR Codes & eRx Stickers] FM3[Assign Fields to Roles] FM4[Generate JSON Config] FM1 --> FM2 --> FM3 --> FM4 end FormMan --> |PDF + Config| Sourdough1[(Sourdough API
S3 + DynamoDB)] Sourdough1 --> JourneyMan subgraph JourneyMan["2️⃣ JourneyMan - Workflow Templates"] JM1[Select FormMan PDF] JM2[Define Workflow Steps] JM3[Configure Viewer Settings] JM4[Set Message Templates] JM5[Add Webhook Steps] JM1 --> JM2 --> JM3 --> JM4 --> JM5 end JourneyMan --> |Journey Template| Sourdough2[(Sourdough API
DynamoDB)] Sourdough2 --> JourneyGuideCreate subgraph JourneyGuideCreate["3️⃣ JourneyGuide - Create Instance"] JG1[Select Template] JG2[Enter Patient Details] JG3[Enter Participant Contact Info] JG4[Customize Workflow if needed] JG5[Create Journey Instance] JG1 --> JG2 --> JG3 --> JG4 --> JG5 end JourneyGuideCreate --> |Journey Instance| Sourdough3[(Sourdough API
DynamoDB)] Sourdough3 --> ActionsAPISend subgraph ActionsAPISend["4️⃣ Actions API - Send Notification"] A1[Generate 22-char nanoid] A2[Create Magic Link:
baseURL/nanoid] A3[Substitute Variables
in Message Template] A4[Send via Email/SMS/Fax] A5[Store Action Record] A1 --> A2 --> A3 --> A4 --> A5 end ActionsAPISend --> |Action Record| MySQL1[(MySQL
actions table)] ActionsAPISend --> |Email/SMS| Participant subgraph Participant["5️⃣ Participant Receives Message"] P1[📧 Email Notification] P2[📱 SMS Notification] P3[📠 Fax Notification] P4[Click Magic Link] P1 --> P4 P2 --> P4 P3 --> P4 end Participant --> |Click Link| ActionsAPITrack subgraph ActionsAPITrack["6️⃣ Actions API - Track Access"] AT1[Extract nanoid from URL] AT2[Query MySQL for Action] AT3[Validate Magic Link
not expired, status='sent'] AT4[Log Access
IP, User Agent, Timestamp] AT5[Get stepId & journeyId] AT1 --> AT2 --> AT3 --> AT4 --> AT5 end ActionsAPITrack --> |Access Log| MySQL2[(MySQL
magic_link_access)] ActionsAPITrack --> |stepId, journeyId| JourneyGuideViewer subgraph JourneyGuideViewer["7️⃣ JourneyGuide - Fastpass Viewer"] JGV1[Load Journey Context] JGV2[Determine Role
Patient/Med-Staff/Provider] JGV3[Apply Viewer Config] JGV4[Render PDF with
Role-Specific Fields] JGV5[Participant Completes Fields] JGV6[Upload Attachments if Required] JGV7[Validate Required Fields] JGV8[Submit Completion] JGV1 --> JGV2 --> JGV3 --> JGV4 --> JGV5 --> JGV6 --> JGV7 --> JGV8 end JourneyGuideViewer --> |Form Data + Attachments| Sourdough4[(Sourdough API
S3 + DynamoDB)] Sourdough4 --> NextStep subgraph NextStep["8️⃣ Next Step Triggered"] NS1[Mark Step as Completed] NS2[Update Journey Status] NS3{More Steps?} NS4[Get Next Step] NS5{Step Type?} NS6[User Step:
Trigger Next Participant] NS7[Webhook Step:
Execute HTTP Request] NS8[Mark Journey Complete] NS1 --> NS2 --> NS3 NS3 -->|Yes| NS4 --> NS5 NS5 -->|User| NS6 NS5 -->|Webhook| NS7 NS6 --> ActionsAPISend NS7 --> NS3 NS3 -->|No| NS8 end NS8 --> End([Journey Complete 🎉]) style FormMan fill:#667eea,stroke:#333,stroke-width:2px,color:#fff style JourneyMan fill:#f093fb,stroke:#333,stroke-width:2px,color:#fff style JourneyGuideCreate fill:#4facfe,stroke:#333,stroke-width:2px,color:#fff style ActionsAPISend fill:#43e97b,stroke:#333,stroke-width:2px,color:#fff style Participant fill:#fa709a,stroke:#333,stroke-width:2px,color:#fff style ActionsAPITrack fill:#30cfd0,stroke:#333,stroke-width:2px,color:#fff style JourneyGuideViewer fill:#ff9a9e,stroke:#333,stroke-width:2px,color:#fff style NextStep fill:#a8edea,stroke:#333,stroke-width:2px,color:#333

Simplified Flow (High-Level)

A condensed view of the workflow showing the main stages and decision points.

flowchart LR A[FormMan
Configure PDF] --> B[JourneyMan
Create Template] B --> C[JourneyGuide
Launch Instance] C --> D[Actions API
Send Notification] D --> E[Participant
Receives Message] E --> F[Actions API
Track Click] F --> G[JourneyGuide
Complete Form] G --> H{More
Steps?} H -->|Yes| D H -->|No| I[Complete] style A fill:#667eea,stroke:#333,stroke-width:2px,color:#fff style B fill:#f093fb,stroke:#333,stroke-width:2px,color:#fff style C fill:#4facfe,stroke:#333,stroke-width:2px,color:#fff style D fill:#43e97b,stroke:#333,stroke-width:2px,color:#fff style E fill:#fa709a,stroke:#333,stroke-width:2px,color:#fff style F fill:#30cfd0,stroke:#333,stroke-width:2px,color:#fff style G fill:#ff9a9e,stroke:#333,stroke-width:2px,color:#fff style I fill:#98fb98,stroke:#333,stroke-width:2px,color:#333

Data Flow Architecture

System architecture showing frontend applications, backend services, data storage, and external integrations.

graph TB subgraph Frontend["Frontend Applications (React + S3/CloudFront)"] FormMan[FormMan] JourneyMan[JourneyMan] JourneyGuide[JourneyGuide] end subgraph Backend["Backend Services"] Sourdough[Sourdough API
API Gateway + Lambda] Actions[Actions API
Bun + Elysia] end subgraph Storage["Data Storage"] S3[(S3
PDF Files)] DynamoDB[(DynamoDB
Journeys, Templates, Steps)] MySQL[(MySQL
Actions, Magic Links)] end subgraph External["External Services"] SES[Amazon SES
Email] Twilio[Twilio
SMS] Webhooks[External APIs
EMR, CRM, etc.] end FormMan --> Sourdough JourneyMan --> Sourdough JourneyGuide --> Sourdough JourneyGuide --> Actions Sourdough --> S3 Sourdough --> DynamoDB Actions --> MySQL Actions --> SES Actions --> Twilio Actions --> Webhooks DynamoDB -.->|Query| JourneyGuide MySQL -.->|Lookup| JourneyGuide style FormMan fill:#667eea,stroke:#333,stroke-width:2px,color:#fff style JourneyMan fill:#f093fb,stroke:#333,stroke-width:2px,color:#fff style JourneyGuide fill:#4facfe,stroke:#333,stroke-width:2px,color:#fff style Sourdough fill:#8B5CF6,stroke:#333,stroke-width:2px,color:#fff style Actions fill:#43e97b,stroke:#333,stroke-width:2px,color:#fff

Technology Stack

Frontend: React.js hosted on S3/CloudFront for global delivery

Backend: Sourdough API (Lambda/API Gateway) + Actions API (Bun/Elysia)

Storage: S3 (files), DynamoDB (NoSQL), MySQL (relational)

External: Amazon SES (email), Twilio (SMS), Webhook integrations

Sequence Diagram - Patient Enrollment Flow

Detailed sequence of interactions during a typical patient enrollment journey.

sequenceDiagram participant Admin participant FormMan participant JourneyMan participant JourneyGuide participant Actions participant Patient participant Viewer as JourneyGuide Viewer participant DB as Sourdough API Admin->>FormMan: 1. Upload & Configure PDF FormMan->>DB: Store PDF + Field Config Admin->>JourneyMan: 2. Create Workflow Template JourneyMan->>DB: Store Journey Template Admin->>JourneyGuide: 3. Launch Patient Journey JourneyGuide->>DB: Create Journey Instance JourneyGuide->>Actions: 4. Trigger Step 1 (Patient) Actions->>Actions: Generate nanoid
(aB3dEf9Gh2...) Actions->>Patient: 5. Send Email with Magic Link Patient->>Actions: 6. Click Magic Link Actions->>Actions: Validate & Log Access Actions->>Viewer: 7. Redirect with nanoid Viewer->>Actions: Lookup nanoid Actions-->>Viewer: Return stepId, journeyId Viewer->>DB: Load Journey Context DB-->>Viewer: Step Details, Role, Fields Patient->>Viewer: 8. Complete Form Fields Viewer->>DB: Submit Form Data DB->>JourneyGuide: Mark Step Complete JourneyGuide->>Actions: Trigger Step 2 (Med-Staff) Note over Actions,Patient: Cycle repeats for each role...

State Diagram - Journey Lifecycle

Journey state transitions from creation to completion or cancellation.

stateDiagram-v2 [*] --> Draft: Create from Template Draft --> InProgress: Start Journey
(Send First Notification) InProgress --> InProgress: Step Completed
(Trigger Next User Step) InProgress --> InProgress: Webhook Executed
(Continue to Next Step) InProgress --> Blocked: Error or Timeout Blocked --> InProgress: Manual Retry
or Issue Resolved Blocked --> Cancelled: Admin Cancellation InProgress --> Completed: All Steps Finished Cancelled --> [*] Completed --> [*] note right of InProgress Active journey cycling through: 1. Send notification 2. Participant completes 3. Trigger next step 4. Repeat until done end note

Component Interaction Matrix

Visual representation of how each component interacts with data stores.

graph LR subgraph Components FM[FormMan] JM[JourneyMan] JG[JourneyGuide] AA[Actions API] end subgraph "Data Stores" S3[(S3)] DB[(DynamoDB)] SQL[(MySQL)] end FM -->|Read/Write| S3 FM -->|Write| DB JM -->|Read| DB JM -->|Write| DB JG -->|Read| DB JG -->|Write| DB JG -->|Trigger| AA AA -->|Write| SQL AA -->|Read| SQL JG -.->|Lookup| SQL style FM fill:#667eea,color:#fff style JM fill:#f093fb,color:#fff style JG fill:#4facfe,color:#fff style AA fill:#43e97b,color:#fff