Force for Health
Pathway RX · Engine Architecture (Internal)
The Force for Health Network · theforce.health
Architecture Skill File v1.0
The FFH Pathway Engine
Master Blueprint
Every node type that can appear on a pathway. The data model that makes it extensible. The skill file that coordinates all modules. The screen mockup of what a real user sees. This is the document we port into the Claude skill system — so every future session starts with full context.
📋 9 Node Type Categories
🗄️ Supabase Data Model
🧩 Extensibility Protocol
🤖 Skill File Ready
🖥️ Screen Mockup
🧩Node Types
🗄️Data Model
🔌Extensibility
🖥️Screen Mockup
🤖Skill File
📖 How to Read This

A pathway node is one step on a person's journey. It can be a piece of content, an action, a referral, an assessment, a community resource, or a civic opportunity. Each node has a type that determines how it renders, what it requires, and what it unlocks. New node types can be added by a Chamber of Health Director or FFH content manager without changing any code — they just populate a new row in the pathway_nodes table with the right type tag and content.

📚Learn It
Education Content Node
A piece of educational content delivered in the format matched to the user's learning style.
Examples:
  • 🎥 Video: "How Blood Pressure Works"
  • 📊 Visual: Infographic — The Diabetes Risk Spectrum
  • 🎵 Audio: Dr. Rob Medical Minutes podcast episode
  • 📖 Reading: Deep-dive article on sleep apnea
  • 🎮 Game: Prevention Bingo condition card
  • 🔬 Sim: 360 Human Explorer 3D body system
  • 🧠 Quiz: Pre/post knowledge assessment
FFH Academy · Content Objects
🏃Live It
Behavior & Habit Node
An active challenge, daily habit, or tracker that the user does in real life and logs back to the platform.
Examples:
  • 🚶 30-day walking challenge with streak tracker
  • ⚖️ Weekly weight check-in
  • 🥗 Nutrition log — 7-day healthy meal streak
  • 😴 Sleep quality journal — 14-night baseline
  • 💊 Medication adherence tracker
  • 🧘 5-minute daily breathing challenge
  • 🩸 After-meal blood sugar awareness walk
Trackers · Streaks · Daily Actions
🌐Ours
Civic & Community Action Node
An action that changes the systems and conditions that shape community health — beyond the individual.
Examples:
  • ⚖️ Contact rep about health legislation
  • ✍️ Sign a community health petition
  • 🙋 Volunteer for a community project
  • 💛 Donate to the FFH Foundation
  • 🏛️ Attend a Chamber of Health meeting
  • 🎤 Submit public comment on a local ordinance
  • 📊 FFH PHIT™ trail day participation
Me → We → Ours Framework
📋Assessment
Deeper Assessment Node
A structured screener or questionnaire that generates new routing decisions — not just a quiz, but a decision point that changes what comes next.
Examples:
  • 🩺 Full STOP-BANG sleep apnea screener
  • 📊 PHQ-9 depression screener (full version)
  • 🥗 Detailed food security / SDOH assessment
  • 💊 Medication adherence deep screener
  • 🏠 Housing stability assessment
  • 💰 Financial stress screener → benefits matching
  • 🧒 Age-appropriate health literacy pre-test
  • 📝 Pre-appointment question builder
Validated Tools · Routing Triggers
🏥Clinical Nav
Clinical Connection Node
A step that connects the user to the healthcare system — not a diagnosis, but a bridge to professional care with the user arriving informed and prepared.
Examples:
  • 🩺 Pre-appointment question list generator
  • 📱 Telemedicine visit booking (partner links)
  • 😴 Sleep study referral checklist
  • 🧪 Lab test explainer (what to ask for)
  • 💉 Vaccination reminder + locator
  • 🦷 Dental clinic locator (oral-heart connection)
  • 👁️ Vision / hearing screening reminder
  • 🤝 CHW (Community Health Worker) assignment
  • 🏥 FQHC / sliding-scale clinic finder
FHIR Ready · HIPAA Aware
📍Resource
Community Resource Node
A real-world local resource — place, program, benefit, or service — matched by ZIP, goal, and situation. Populated and maintained by Chamber of Health Directors.
Examples:
  • 🥦 Farmers market + SNAP Double-Up location
  • 🚶 Walking group meeting time and place
  • 🌱 Community garden plot availability
  • 🏋️ Free / low-cost recreation center
  • 🍱 Meals on Wheels enrollment form
  • 🚌 Medical transportation assistance
  • 🐕 Companion animal programs (loneliness / mental)
  • 📚 Library health literacy programs
  • 🤝 AA / NA / support group meeting
  • 🏘️ Housing application assistance
Director-Managed · ZIP-Tagged
💰Benefits
Benefits & Eligibility Node
A step that helps the user understand and access benefits, programs, and entitlements they may not know they qualify for.
Examples:
  • 🛒 SNAP eligibility check + application link
  • 🏥 Medicaid / marketplace insurance navigator
  • 💊 Medicare Part D drug cost comparison
  • 🏠 Section 8 / housing voucher application guide
  • 📋 Insurance appeal letter template
  • 💰 How to get cheaper insurance (ACA tips)
  • 🎓 Free GED / job training programs
  • 🚗 Reduced-cost transportation to care
  • 👴 Supplemental Security Income (SSI) guide
  • 🍼 WIC program enrollment
SDOH Layer · Benefits Navigator
🔌Custom
Extensible / Future Node
The open slot. Any new node type a Chamber of Health Director, community partner, or FFH team member defines. The system doesn't need to know what it is — it just needs a type tag, content, goal tags, and trigger conditions.
Could become anything:
  • 🎸 Arts therapy referral
  • 🌐 Language-specific culturally adapted content
  • 🦺 Workplace wellness challenge node
  • 🏫 School-based health education module
  • 📡 Wearable device integration prompt
  • 🤖 Dr. Rob AI consultation node
  • 🌍 International / global health resource
  • ⛪ Faith community health program
  • 🧑‍⚕️ Certified Patient milestone node
No-Code Extensible · Director Defined
🗄️
Supabase Data Model
The tables that make the Pathway Engine work. Single source of truth for all modules.
👤 User Profile Table
-- Every user's routing profile. Written once, read everywhere.
CREATE TABLE user_profiles (
  id            uuid PRIMARY KEY,
  org_id        uuid,                     -- white-label tenant
  goals         text[],                  -- ['weight','diabetes','heart']
  learning_styles text[],              -- ['visual','audio','simulation']
  risk_flags    jsonb,                  -- {heart:'moderate', sleep:'high'...}
  situation     jsonb,                  -- {activity:2, diet:3, food_access:'no'}
  zip_code      text,
  coins         integer DEFAULT 0,
  rank          text DEFAULT 'explorer',
  created_at    timestamptz DEFAULT NOW()
);
🧩 Content Objects Table
-- Every piece of content in the ecosystem. Tagged so the engine can route to it.
CREATE TABLE content_objects (
  id            uuid PRIMARY KEY,
  title         text,
  description   text,
  node_type     text,       -- 'learn'|'live'|'share'|'ours'|'assess'|'clinical'|'resource'|'benefit'|'custom'
  content_types text[],     -- ['video','visual','game','audio','reading','social','tracker','simulation']
  health_topics text[],     -- ['heart','diabetes','sleep','mental','lungs','sdoh',...]
  goal_tags     text[],     -- ['weight','diabetes','heart','move','eat','family','community']
  phase         text,       -- 'learn'|'live'|'share'|'ours'
  difficulty    integer,    -- 1–5
  duration_min  integer,    -- estimated completion time
  coins_reward  integer,
  prerequisite_ids uuid[], -- what must be complete before this unlocks
  trigger_conditions jsonb,-- {risk_flag:'high', situation_key:'food_access', value:'no'}
  source_module text,      -- 'bingo_cardiovascular'|'you_do_matter'|'chamber_local'|...
  url           text,
  org_id        uuid,       -- null = global; set = org-specific (white-label)
  active        boolean DEFAULT TRUE,
  created_by    text        -- 'ffh_team'|'director_[id]'|'community_partner'
);
🗺️ Pathway Routes Table
-- The assembled pathway for a specific user. Generated by the routing function, stored here.
CREATE TABLE pathway_routes (
  id            uuid PRIMARY KEY,
  user_id       uuid REFERENCES user_profiles,
  content_id    uuid REFERENCES content_objects,
  position      integer,   -- order on the pathway
  status        text,       -- 'locked'|'available'|'started'|'complete'|'skipped'
  priority_score float,    -- computed by routing function (higher = earlier)
  style_match   float,     -- 0–1: overlap between user learning_styles and content_types
  unlocked_at   timestamptz,
  completed_at  timestamptz,
  coins_earned  integer
);
📍 Community Resources Table
-- Director-managed. A Director logs in and adds local resources. Auto-appears on maps and pathways.
CREATE TABLE community_resources (
  id            uuid PRIMARY KEY,
  name          text,
  resource_type text,     -- 'park'|'food'|'clinic'|'program'|'benefit'|'volunteer'|'event'
  goal_tags     text[],   -- matches content_objects.goal_tags taxonomy
  zip_codes     text[],   -- can serve multiple ZIPs
  lat           float,
  lng           float,
  address       text,
  description   text,
  url           text,
  phone         text,
  hours         text,
  cost          text,     -- 'free'|'sliding_scale'|'low_cost'|'varies'
  sdoh_flags    text[],  -- ['food_access','housing','transportation','insurance']
  director_id   uuid,     -- who added it
  verified      boolean,
  active        boolean DEFAULT TRUE,
  event_dates   jsonb    -- for events: [{date, time, recurring}]
);
🔀 Routing Function (Pseudocode)
-- Runs when a user completes onboarding or updates their profile.
-- Returns ranked list of content_objects for this user.

FUNCTION build_pathway(user_id uuid) RETURNS pathway_routes[]:

  profile = SELECT * FROM user_profiles WHERE id = user_id
  
  candidates = SELECT * FROM content_objects
    WHERE active = true
    AND (org_id IS NULL OR org_id = profile.org_id)
    AND goal_tags && profile.goals          -- array overlap
    AND check_trigger_conditions(node, profile)

  FOR EACH candidate:
    style_match = |content_types ∩ mapped_style_tags(profile.learning_styles)|
                  / |content_types|

    risk_score  = risk_relevance(health_topics, profile.risk_flags)
    goal_score  = |goal_tags ∩ profile.goals| / |goal_tags|
    
    priority = (goal_score * 0.5) + (risk_score * 0.3) + (style_match * 0.2)

  RETURN candidates ORDER BY priority DESC, phase_order ASC
  -- phase_order: assess > learn > live > share > ours
🔌
Extensibility Protocol
How to add a new stepping stone without touching code. The system that never breaks.
🏗️ The Design Principle

A Chamber of Health Director in a small rural town should be able to add "Here is where you can get a CHW assigned to your case" as a pathway node — without calling a developer. A national organization should be able to add "Here is how to get Meals on Wheels" that appears for users over 65 with limited mobility, everywhere in the country. The system accommodates both without code changes.

🟢 Level 1: Content Manager Adds a Node

No code. Log in to the FFH Admin Dashboard, click "Add Content," fill out the form. The node appears on pathways for users whose profile matches the tags.

  • Write a title and description
  • Pick the node type (Learn / Live / Assessment / Clinical / Resource / Benefit / Custom)
  • Tag with health topics, goals, and content types
  • Set trigger conditions (e.g., "only show if food_access = 'no'")
  • Add a URL or action
  • Set coin reward and prerequisite (optional)
  • Publish → appears immediately on matching pathways

🟡 Level 2: Chamber of Health Director Adds Local Resources

A Director logs into their Chamber of Health dashboard and adds local resources for their community. These automatically appear on the pathway maps and resource nodes for users in their ZIP codes.

  • Add a farmers market: name, address, ZIP, hours, SNAP-accepted, goal_tags: ['food','diabetes']
  • Add a walking group: time, location, ZIP, goal_tags: ['move','heart','social']
  • Add a CHW program: phone, eligibility, ZIP range, resource_type: 'clinical'
  • Add a local health event: date, time, location, recurring schedule
  • Add a Meals on Wheels contact: phone, eligibility_conditions: ['age>65','mobility_limited']
  • Add a housing application help service, an insurance navigator, a free clinic night

🔵 Level 3: FFH Team Adds a New Node Type

When a genuinely new kind of step is needed — not just new content but a new behavior — the FFH team defines a new type tag and a rendering template. One developer, one afternoon.

  • Define the new type string (e.g., 'wearable_sync', 'dr_rob_consult', 'certified_patient_milestone')
  • Add rendering logic in the Pathway component (one switch-case)
  • Document the new type in this architecture file
  • All future content tagged with this type renders correctly

⚙️ Trigger Condition Examples

Every node can have zero or more trigger conditions. If conditions exist, the node only appears when all are met. This is what makes the pathway adaptive without rule engines.

  • {"risk_flag": "sleep", "min_level": "moderate"} → only show sleep apnea screening if moderate+ risk
  • {"situation_key": "food_access", "value": "no"} → only show SNAP node if food access was flagged
  • {"goal": "diabetes", "fam_diabetes": "yes"} → prioritize CDC NDPP for family history
  • {"age_min": 65} → show Meals on Wheels only for users 65+
  • {"zip_codes": ["17201","17202"]} → show this local resource only in these ZIPs
  • {"completed_node": "uuid-of-prerequisite"} → unlock after completing another step
  • {"org_id": "uuid-of-partner"} → show only to users of a specific white-label partner
  • {"insurance": "none"} → show insurance navigator only to uninsured users
📋 Things We Haven't Built Yet (But the System Accommodates)
🤖 Dr. Rob AI Consult Node
A conversational consult with Dr. Rob at a decision point. Node type: 'dr_rob_consult'. Trigger: high risk flag or user question. No code change needed once type is defined.
📡 Wearable Sync Node
Terra API integration prompt. "Connect your Apple Watch / Fitbit to auto-log your steps." Node type: 'wearable_sync'. Appears once on the pathway after account creation.
🏅 Certified Patient Node
Dr. Rob's Certified Patient milestone. Completes condition-specific curriculum, generates FHIR-reportable score. Node type: 'certified_patient'. Unlocks after all condition Learn + Live steps.
🌍 Language / Culture Node
Culturally adapted content in 30+ languages. Node type: 'localized_content'. Trigger: user locale. The routing function selects the localized version of any content node automatically.
🏠 Housing Application Guide
Step-by-step guide to Section 8 / HUD application with document checklist and question prep. Node type: 'benefit'. Trigger: situation.housing = 'unstable'. No code change.
🧑‍⚕️ CHW Assignment Node
Request a Community Health Worker. Submits intake to local CHW program. Node type: 'clinical'. Trigger: high SDOH score + zip_code in CHW program coverage area.
👁️ What a User Actually Sees

This is Maria, 44. She selected goals: lose weight, understand diabetes (dad has it), reduce stress. Learning style: videos and games. Food access: limited. The pathway below was assembled by the routing function from those inputs. Every node type from the inventory is represented.

Maria's Living Wellness Pathway
Personalized · 14 steps · ~6 weeks · Up to 820 coins
👩
Maria · Health Explorer
🎯 Weight Loss 🩸 Diabetes (Dad) 🧠 Stress 🎥 Video Learner 🎮 Games 🛒 Food Access Challenge
45
Coins
📋
Deeper Diabetes Risk Assessment
Assessment
🎯 Diabetes Prevention · Triggered by: Dad's diagnosis
⏱ 4 min🔓 Now available
🔬 Screener ★ Simulation
🪙 30 coins
🎥
Pre-Diabetes: The Window of Opportunity
Learn It
🎯 Diabetes Prevention
⏱ 6 min📍 FFH Academy
★ 🎥 Video ★ 📊 Visual 🏆 Game
🪙 50 coins
💰
You May Qualify for SNAP + Double Up Food Bucks
Benefit
🎯 Food Access · Triggered by: Limited food access flagged
⏱ 3 min🔓 Unlocked by your situation
📖 Guide 🔗 App Link
🪙 25 coins
📍
Riverside Farmers Market — SNAP Accepted + Double Up
Resource
🎯 Healthy Food Access · Added by: Your Chamber of Health Director
📅 Sat 8am–1pm📍 0.8 mi from your ZIP💰 Free to shop
📍 Local 🛒 SNAP
🪙 15 coins
🏃
30-Day Movement Challenge — Start Where You Are
Live It
🎯 Weight Loss · Activity
🔥 Daily check-in📊 Activity Tracker
★ 🎮 Game 📊 Tracker 🤝 Social
🪙 60 coins
🩺
Get Ready for Your Doctor Appointment
Clinical Nav
🎯 All Goals · Pre-visit preparation
⏱ 5 min📋 Question builder
📋 Tool 📖 Guide
🪙 35 coins
🤝
Request a Community Health Worker for Your Case
Custom
🎯 All Goals · Triggered by: Multiple SDOH flags + high complexity
📍 Your county has a CHW program💰 Free
🔗 Referral 📍 Local
🪙 25 coins
📣
Share Your Pathway · Invite 3 People
Share It
🎯 Community Impact
🔒 Complete 5 more steps to unlock
🔒 Locked — keep going🪙 150 coins
8 of 14 steps shown · Each node type is represented · ★ = matched to your learning style
🤖
The FFH Pathway Engine Skill File
Port this into the Claude skill system so every future session starts with full context. No more rebuilding from scratch.

This is the SKILL.md file to install in the CoWork / Claude skill system. It gives any future Claude session — building any FFH module — complete context on the Pathway Engine: the node types, the data model, the tagging taxonomy, the routing logic, and the extensibility rules. When this skill is active, Claude never builds a one-off page again. Every new module plugs into the ecosystem correctly.

📄 SKILL.md — ffh-pathway-engine
---
name: ffh-pathway-engine
description: >
  The FFH Pathway Engine architecture, data model, node type taxonomy, content
  tagging system, routing logic, and extensibility protocol for the Force for
  Health Network. TRIGGER THIS SKILL for ANY conversation involving the Living
  Wellness Pathway, individual pathway steps, content recommendations, community
  resource matching, learning style routing, goal-based content filtering, or
  adding new stepping stones to the pathway. Also trigger for: "what goes on a
  pathway," "add a new node," "how does content get matched," "tagging content,"
  "routing users to content," "community resources on the pathway," "extensible
  pathway," or any reference to the Me/We/Ours framework in a technical context.
  This skill coordinates all other FFH skills — it is the connective layer.
---

# FFH Pathway Engine — Master Architecture

## What This Is

The Pathway Engine is the adaptive routing layer that assembles a personalized
route through the FFH ecosystem for each user. It is NOT a page or a module.
It is the data model + routing function that connects every module.

Every piece of content in the FFH ecosystem must be registered as a
content_object in Supabase with the correct tag arrays. The routing
function reads those tags against the user's profile and returns a ranked,
sequenced pathway. Adding new content = adding a row to the table. No code.

## The Nine Node Types

Every pathway step is one of these types. New types can be added
by defining a type string and a rendering template — no schema change.

learn      — Education content (video, visual, audio, game, reading, simulation)
live       — Behavior challenge, tracker, daily habit, streak
share      — Social sharing, referral, community multiplier
ours       — Civic action, volunteer, donation, legislation
assess     — Deeper validated screener that changes routing
clinical   — Doctor prep, telemedicine, CHW, clinic finder, referral
resource   — Director-managed local resource (park, market, program, clinic)
benefit    — SNAP, Medicaid, insurance, housing, transportation, WIC
custom     — Any new type defined by Director or FFH team. Open slot.

## Content Tagging Taxonomy

Every content_object row MUST have:
  content_types  — video | visual | audio | simulation | reading | social | game | tracker
  health_topics  — heart | diabetes | sleep | mental | lungs | sdoh | weight | ...
  goal_tags       — weight | diabetes | heart | sleep | stress | move | eat | family | community
  node_type       — one of the nine types above
  trigger_conditions — jsonb — optional conditions that must be met for node to appear

Learning style → content_type mapping:
  visual     → [video, visual]
  audio      → [audio]
  simulation → [simulation, game]
  social     → [social]
  reading    → [reading]

## Routing Priority Formula

priority = (goal_score * 0.5) + (risk_score * 0.3) + (style_match * 0.2)

goal_score  = overlap between content goal_tags and user.goals
risk_score  = relevance of health_topics to user risk_flags  
style_match = overlap between content_types and user learning_styles

## Extensibility Rules (NEVER BREAK THESE)

1. New content = new row in content_objects. Never hardcode.
2. New local resource = Director adds via dashboard. ZIP + goal_tags required.
3. New node type = new type string + rendering case. One dev, one afternoon.
4. Trigger conditions = jsonb on each row. No rule engine needed.
5. White-label org_id isolation is mandatory on every query.

## Key Supabase Tables

user_profiles       — goals[], learning_styles[], risk_flags jsonb, situation jsonb
content_objects     — node_type, content_types[], goal_tags[], trigger_conditions jsonb
pathway_routes      — assembled pathway per user, status, priority_score
community_resources — Director-managed, zip_codes[], goal_tags[], event_dates jsonb

## The Me / We / Ours Framework

Every pathway exists in three rings:
  Me    — individual health check, education, trackers, clinical navigation
  We    — family pathway, shared activities, family tracker and report
  Ours  — civic action, community projects, legislation, volunteer, donate

The pathway engine routes users through all three rings based on their
goals and engagement level. A user who selects 'community' as a goal gets
Ours nodes earlier. A user who selects 'family' gets We nodes earlier.

## What Claude Should Do With This Skill

When building ANY new FFH page or module:
- Register new content as content_objects with correct tags
- Never hardcode resource lists — they belong in community_resources
- Every new page should expose its content to the pathway engine via tags
- Use the nine node types as the vocabulary for all pathway decisions
- When a user describes a new stepping stone ("CHW assignment", "Meals on Wheels",
  "cheaper insurance guide") — identify the node_type, define trigger_conditions,
  and describe the content_objects row — don't build a one-off page

## Reference Files

Load these when needed:
  references/node-types.md       — Full inventory with examples per type
  references/supabase-schema.sql — Complete table definitions
  references/routing-function.sql — Full routing pseudocode + SQL
  references/content-taxonomy.md — Complete tag vocabulary
  references/director-guide.md   — How Directors add/manage resources
🔗 How This Coordinates All Other Skills
🎮
ffh-game-maker + ffh-jeopardy-maker
All games are registered as content_objects with node_type='learn', content_types=['game','simulation']. The pathway engine serves them to users with simulation learning style. Games are now discoverable pathway steps, not just standalone pages.
📊
ffh-academy-dev (Prevention Bingo)
Each Bingo condition card is a content_object: node_type='learn', health_topics=['cardiovascular'], content_types=['game','visual']. Users with heart risk goal see these on their pathway. Bingo becomes a routed destination, not just a standalone experience.
🏛️
ffh-crm (Chamber of Health Directors)
CRM Directors have a "Resources" tab in their dashboard. Anything they add populates community_resources with their zip_codes and goal_tags. It appears automatically on pathways in their community. CRM and pathway share the same data layer.
🤖
ffh-coach-lucy + Dr. Rob
AI coaches are node_type='custom' content_objects with content_types=['audio','social']. The pathway engine routes users to Coach Lucy for social learners and Dr. Rob for clinical navigation nodes. The personas become pathway destinations.
📋
ffh-lesson-plan-maker
Every lesson plan generates a set of content_objects: the reading (node_type='learn', content_types=['reading']), the video version (content_types=['video']), the quiz (content_types=['game']). One lesson = multiple pathway-routable content objects, each reaching the right learner.