These diagrams render as interactive dependency graphs in GitHub markdown.
graph TB
subgraph frontend["Frontend (packages/shared-ui)"]
subgraph presentation["Presentation Layer"]
Component["π¨ Components<br/>(_includes/*, js/components/)"]
Page["π Pages<br/>(js/pages/)"]
PageData["π Page Data<br/>(js/page-data/)"]
end
subgraph orchestration["Orchestration Layer"]
App["βοΈ App<br/>(js/app/)"]
Pipeline["π Pipeline<br/>(js/pipeline/)"]
Engine["π§ Engine<br/>(js/biometric-engine/)"]
ProgramEngine["π
Program Engine<br/>(js/program-engine/)"]
Evaluator["π’ Evaluator<br/>(js/biometric-evaluator/)"]
Metrics["π Metrics<br/>(js/metrics/)"]
Schedule["π Schedules<br/>(js/schedules/)"]
end
subgraph service_layer["Service Layer"]
Service["π Services<br/>(js/services/)"]
SharedUtil["π οΈ Utils<br/>(js/utils/)"]
BiometricData["𧬠Biometrics Data<br/>(js/biometrics/)"]
end
end
subgraph content["Content (packages/shared-content)"]
SharedContent["π Content<br/>(layouts, prose)"]
end
subgraph backend["Backend (packages/api)"]
ApiEntry["π Azure Functions<br/>(src/index.ts)"]
Handler["π― Handlers<br/>(src/domain1, 2, 3)"]
ApiService["βοΈ Services<br/>(src/services/)"]
ApiUtil["π οΈ Utils<br/>(src/utils/)"]
end
%% Frontend internal flows (allowed)
Component -->|events bridge| App
Page -->|events bridge| App
PageData -.->|data| Page
App -->|config| Schedule
App -->|run| ProgramEngine
App -->|recalculate| Pipeline
Pipeline -->|facade| Engine
Pipeline -->|format| Metrics
Pipeline -->|evaluate| Evaluator
ProgramEngine -->|validate| ProgramEngine
%% Forbidden flows (marked with β)
Component -->|β FORBIDDEN| Service
Page -->|β FORBIDDEN| Service
PageData -->|β FORBIDDEN| Service
Service -->|β FORBIDDEN| Component
Service -->|β FORBIDDEN| Page
Service -->|β FORBIDDEN| App
Metrics -->|β FORBIDDEN| Pipeline
Evaluator -->|β FORBIDDEN| Pipeline
ProgramEngine -->|β FORBIDDEN| Pipeline
Schedule -->|β FORBIDDEN| Pipeline
%% Content isolation
SharedContent -->|β FORBIDDEN| Component
SharedContent -->|β FORBIDDEN| Service
SharedContent -->|β FORBIDDEN| App
%% Backend flows
ApiEntry --> Handler
Handler --> ApiService
Handler --> ApiUtil
ApiService --> ApiUtil
%% Frontend to backend (via HTTP)
Component -.->|HTTP| ApiEntry
Service -.->|HTTP| ApiEntry
classDef foundation fill:#d4edda,stroke:#28a745,stroke-width:2px
classDef sealed fill:#fff3cd,stroke:#ffc107,stroke-width:3px
classDef forbidden fill:#f8d7da,stroke:#dc3545,stroke-width:2px
classDef public fill:#d1ecf1,stroke:#17a2b8,stroke-width:2px
class Engine sealed
class Component,Page,PageData,Service foundation
class App,Pipeline,ProgramEngine public
graph LR
subgraph Y3["Y=3: Presentation"]
Component["Components<br/>_includes/*<br/>js/components/"]
Page["Pages<br/>js/pages/"]
PageData["Page Data<br/>js/page-data/"]
end
subgraph Y2["Y=2: Orchestration"]
App["App<br/>events.js<br/>app.js"]
Pipeline["Pipeline<br/>calculation<br/>cache"]
ProgramEngine["Program Engine<br/>schedule<br/>eligibility"]
Evaluator["Evaluator<br/>expression<br/>eval"]
end
subgraph Y1["Y=1: Services"]
Service["Services<br/>storage<br/>auth<br/>etc"]
Utils["Utils<br/>helpers"]
end
subgraph Y0["Y=0: Computation"]
Engine["Engine<br/>biometric<br/>calculations<br/>π SEALED"]
end
%% Allowed flows
Component -->|events| App
Page -->|events| App
PageData -->|data| Page
App -->|orchestrate| Pipeline
App -->|run| ProgramEngine
Pipeline -->|facade| Engine
Pipeline -->|format| Evaluator
%% Forbidden flows
Component -->|β| Service
Page -->|β| Service
PageData -->|β| Service
Service -->|β| Component
Service -->|β| App
classDef presentation fill:#e3f2fd,stroke:#1976d2
classDef orchestration fill:#f3e5f5,stroke:#7b1fa2
classDef services fill:#fff3e0,stroke:#e65100
classDef computation fill:#e8f5e9,stroke:#388e3c
classDef sealed fill:#fff3cd,stroke:#ffc107,stroke-width:3px
class Component,Page,PageData presentation
class App,Pipeline,ProgramEngine,Evaluator orchestration
class Service,Utils services
class Engine sealed,computation
graph TD
subgraph Tier3["Tier 3: Entry/Composition"]
AppJs["app.js<br/>β ONLY THIS<br/>IMPORTS BRIDGE"]
Nav["navigation.js"]
Prompts["Prompts<br/>(paywall, pwa)"]
end
subgraph Tier2["Tier 2: Bridge"]
Bridge["bridge.js<br/>π SERVICEβWINDOW<br/>ISOLATED"]
end
subgraph Tier1["Tier 1: Setup/Infrastructure"]
Auth["auth.js"]
Demo["demo.js"]
Guard["guard.js"]
Ready["ready.js"]
end
subgraph Tier0["Tier 0: Foundation (SEALED)"]
Events["events.js<br/>π EVERYTHING<br/>DEPENDS ON IT"]
end
%% Allowed flows
AppJs --> Bridge
Nav --> Events
Prompts --> Events
Auth --> Events
Demo --> Events
Guard --> Events
Ready --> Events
Bridge --> Events
%% Forbidden flows (marked)
Auth -->|β| Bridge
Auth -->|β| AppJs
Demo -->|β| Bridge
Demo -->|β| AppJs
Guard -->|β| Bridge
Guard -->|β| AppJs
Ready -->|β| Bridge
Ready -->|β| AppJs
classDef entry fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef bridge fill:#fff3cd,stroke:#ffc107,stroke-width:3px
classDef setup fill:#e3f2fd,stroke:#1976d2
classDef foundation fill:#f3e5f5,stroke:#7b1fa2,stroke-width:3px
class AppJs,Nav,Prompts entry
class Bridge bridge
class Auth,Demo,Guard,Ready setup
class Events foundation
graph TD
External["π External Code<br/>(components, pages, services)"]
subgraph Public["β
PUBLIC API"]
Singleton["programEngine<br/>SINGLETON<br/>β import only from here"]
end
subgraph Internal["π INTERNAL (Hidden)"]
Collector["schedule-collector.js<br/>Eligibility engine<br/>β Don't import directly"]
Validator["schedule-validation.js<br/>Pure validator<br/>β Don't import directly"]
end
Storage["ποΈ action-log-repository<br/>(services/storage)"]
BiometricEval["π’ expression-evaluator<br/>(biometric-evaluator)"]
Pipeline["π calculation-pipeline<br/>(pipeline)"]
Schedules["π Schedules<br/>(js/schedules/)"]
%% Allowed flows
External -->|β
ONLY THIS| Singleton
Singleton --> Collector
Singleton --> Validator
Collector --> Validator
Collector --> Storage
Collector --> BiometricEval
Collector --> Pipeline
Validator -.->|no imports|External
Singleton --> Schedules
Singleton --> Storage
%% Forbidden flows
External -->|β FORBIDDEN| Collector
External -->|β FORBIDDEN| Validator
Collector -->|β FORBIDDEN| Singleton
classDef public fill:#d1ecf1,stroke:#17a2b8,stroke-width:3px
classDef internal fill:#f8d7da,stroke:#dc3545,stroke-width:2px
classDef forbidden fill:#f8d7da,stroke:#dc3545,stroke-width:2px,stroke-dasharray: 5 5
classDef external fill:#e3f2fd,stroke:#1976d2
class Singleton public
class Collector,Validator internal
class External external
graph TD
Pipeline["π Pipeline<br/>(ONLY ALLOWED IMPORTER)"]
subgraph Engine["π SEALED BIOMETRIC ENGINE"]
Facade["biometric-engine.js<br/>β
PUBLIC FACADE"]
subgraph Tier5["Tier 5: Orchestration"]
Orchestrator["Orchestrator<br/>coordinates all tiers"]
end
subgraph Tier4["Tier 4: Calculators"]
Calc["Risk calculations<br/>disease models<br/>scoring engines"]
end
subgraph Tier3["Tier 3: Domain Helpers"]
Helpers["Cohort comparison<br/>percentile mapping<br/>thresholds"]
end
subgraph Tier2["Tier 2: Data Transform"]
Transform["Normalization<br/>derivation<br/>filtering"]
end
subgraph Tier1["Tier 1: Foundation"]
Foundation["Constants<br/>schemas<br/>registry"]
end
end
External["π Everything Else<br/>(components, services, etc.)"]
%% Allowed flow (ONLY)
Pipeline -->|facade| Facade
Facade --> Orchestrator
%% Internal tier flows
Orchestrator --> Tier4
Tier4 --> Tier3
Tier3 --> Tier2
Tier2 --> Tier1
%% Forbidden flows
External -->|β FORBIDDEN| Facade
External -->|β FORBIDDEN| Tier5
External -->|β FORBIDDEN| Tier4
External -->|β FORBIDDEN| Tier3
External -->|β FORBIDDEN| Tier2
External -->|β FORBIDDEN| Tier1
classDef sealed fill:#fff3cd,stroke:#ffc107,stroke-width:3px
classDef facade fill:#d1ecf1,stroke:#17a2b8,stroke-width:2px
classDef tier fill:#e8f5e9,stroke:#388e3c
classDef forbidden fill:#f8d7da,stroke:#dc3545,stroke-dasharray: 5 5
classDef external fill:#e3f2fd,stroke:#1976d2
class Engine,Facade sealed,facade
class Orchestrator,Calc,Helpers,Transform,Foundation tier
class External external
graph TD
External["HTTP Requests<br/>(from frontend)"]
subgraph APIStack["API STACK (packages/api)"]
Entry["Entry<br/>src/index.ts<br/>(Azure Functions)"]
subgraph Handlers["Handler Layer (Domain-Isolated)"]
H1["Domain 1<br/>src/domain1/**<br/>(handlers)"]
H2["Domain 2<br/>src/domain2/**<br/>(handlers)"]
H3["Domain 3<br/>src/domain3/**<br/>(handlers)"]
end
subgraph ServiceLayer["Service Layer"]
Services["Services<br/>src/services/**<br/>(shared logic)"]
end
subgraph UtilLayer["Util Layer (Leaf)"]
Utils["Utils<br/>src/utils/**<br/>(helpers)"]
end
subgraph ConfigLayer["Config Layer (Leaf)"]
Config["Config<br/>src/config/**<br/>(constants)"]
end
end
%% Allowed flows
External --> Entry
Entry --> H1
Entry --> H2
Entry --> H3
H1 --> Services
H2 --> Services
H3 --> Services
Services --> Utils
Config --> Utils
%% Forbidden flows (cross-domain)
H1 -->|β FORBIDDEN| H2
H1 -->|β FORBIDDEN| H3
H2 -->|β FORBIDDEN| H1
H2 -->|β FORBIDDEN| H3
H3 -->|β FORBIDDEN| H1
H3 -->|β FORBIDDEN| H2
%% Forbidden upward flows
Services -->|β FORBIDDEN| H1
Services -->|β FORBIDDEN| H2
Services -->|β FORBIDDEN| H3
Services -->|β FORBIDDEN| Entry
Utils -->|β FORBIDDEN| Services
Utils -->|β FORBIDDEN| H1
Config -->|β FORBIDDEN| Services
classDef entry fill:#d1ecf1,stroke:#17a2b8,stroke-width:2px
classDef handler fill:#e3f2fd,stroke:#1976d2
classDef service fill:#fff3e0,stroke:#e65100
classDef util fill:#f3e5f5,stroke:#7b1fa2
classDef config fill:#f8d7da,stroke:#dc3545
classDef forbidden fill:#f8d7da,stroke:#dc3545,stroke-dasharray: 5 5
class Entry entry
class H1,H2,H3 handler
class Services service
class Utils util
class Config config
graph TB
Allowed["β
ALLOWED IMPORTS"]
BaseComponents["Base Components<br/>(js/components/)"]
External1["chart.js<br/>(external NPM)"]
External2["External libs"]
App["app layer<br/>(events)"]
Pipeline["pipeline layer<br/>(calculations)"]
Metrics["metrics layer<br/>(formatting)"]
Forbidden["β FORBIDDEN IMPORTS"]
HigherComponents["Higher components<br/>(_includes/components/)"]
Pages["Pages"]
Other["Other modules"]
%% Allowed
BaseComponents -->|β
| External1
BaseComponents -->|β
| External2
BaseComponents -->|β
| App
BaseComponents -->|β
| Pipeline
BaseComponents -->|β
| Metrics
%% Forbidden
BaseComponents -->|β| HigherComponents
BaseComponents -->|β| Pages
BaseComponents -->|β| Other
classDef base fill:#d1ecf1,stroke:#17a2b8,stroke-width:2px
classDef allowed fill:#d4edda,stroke:#28a745
classDef forbidden fill:#f8d7da,stroke:#dc3545
class BaseComponents base
class External1,External2,App,Pipeline,Metrics allowed
class HigherComponents,Pages,Other forbidden
graph LR
subgraph rule1["π Engine Encapsulation"]
A1["Everything else"]
A2["β engine internals"]
A3["β
engine facade"]
A4["Pipeline"]
A1 -->|forbidden| A2
A1 -->|allowed| A3
A3 --> A4
end
subgraph rule2["π« Pipeline Gating"]
B1["metrics/evaluator<br/>program-engine<br/>schedule-config"]
B2["β cannot use"]
B3["pipeline"]
B4["app/component<br/>service/page"]
B5["β
can use"]
B1 -->|forbidden| B3
B4 -->|allowed| B3
end
subgraph rule3["π Service Isolation"]
C1["Components<br/>Pages"]
C2["β direct import"]
C3["Services"]
C4["events bridge<br/>window listener"]
C1 -->|forbidden| C3
C1 -->|allowed| C4
C4 -.-> C3
end
subgraph rule4["π shared-content"]
D1["shared-content"]
D2["β cannot import"]
D3["component/service<br/>page-script<br/>app/metrics"]
D1 -->|forbidden| D3
end
classDef rule fill:#f0f4ff,stroke:#5e7ce0,stroke-width:2px
classDef allowed fill:#d4edda,stroke:#28a745
classDef forbidden fill:#f8d7da,stroke:#dc3545
class rule1,rule2,rule3,rule4 rule
| Symbol | Meaning |
|---|---|
| π | Sealed/Encapsulated module |
| β | Allowed import |
| β | Forbidden import |
| β | Depends on |
| -.-> | Indirect/event-based flow |
--- |
Solid line = direct import |
- - - |
Dashed line = forbidden |