Pain Network Builder
A clinical case formulation tool built on interactive network graphs, with an integrated belief propagation engine drawing loosely from Bayesian network theory.
Nodes
Each node represents a factor in the patient's pain experience — a cause, consequence, or maintaining variable. Nodes are categorised as:
- Origin (orange) — the initiating event or trigger
- Pain (red) — the central hub, typically the presenting complaint
- Affect (blue) — downstream factors that Pain influences, or that influence Pain
Node size carries analytical meaning: larger nodes are assigned a higher prior probability — representing the clinician's or patient's assessment that this factor is more significant or prevalent for this individual before any specific evidence is introduced.
Links (Edges)
Links represent directed relationships between nodes. Each link has four properties:
- Type — more (facilitate) or less (inhibit): does this factor increase or decrease the other?
- Direction — unidirectional (→), reverse (←), or bidirectional (↔)
- Thickness — the relative strength of the relationship; thicker links carry more influence in the propagation model
- Curve — a visual property only, used to reduce overlap in complex networks
The distinction between more and less maps onto the clinical concept of facilitatory and inhibitory pathways in pain neuroscience — for example, catastrophising facilitates pain amplification, while social support and physical activity may inhibit it.
Chronic pain is now well understood to be a biopsychosocial phenomenon — not a simple linear input-output system, but a dynamic network of interacting biological, psychological, and social factors. This has important clinical implications that a network model captures naturally:
Feedback loops — pain disrupts sleep, and poor sleep amplifies pain. These bidirectional relationships mean that intervening in one factor can have cascading effects throughout the whole system — sometimes expected, sometimes surprising.
Non-linearity — small changes in one factor can produce disproportionately large effects elsewhere when feedback loops are involved. Conversely, large interventions can appear to have little effect if they are counteracted by other parts of the network.
Multifactorial maintenance — the network approach makes visible how multiple interacting factors can maintain a pain state even after the original injury has resolved. This is particularly relevant in nociplastic pain presentations where central sensitisation, psychological factors, and social context interact.
Case formulation — rather than selecting a single theoretical model, the tool allows clinicians and patients to collaboratively construct a bespoke formulation that reflects the individual's specific experience, with the ability to add, remove, and reconfigure connections as understanding develops over time.
What is a Bayesian Network?
A Bayesian network is a mathematical framework for representing probabilistic relationships between variables. Each node holds a probability — the likelihood that this variable is in an active or elevated state — and these probabilities update based on observed evidence flowing through the network according to Bayes' theorem.
In a fully specified Bayesian network, each node would require a conditional probability table (CPT) — a complete specification of the probability of that node being active given every possible combination of its parent nodes' states. For even a moderately complex pain network this would require hundreds of values, which is neither practical nor clinically meaningful given the current state of evidence. The approach taken here is deliberately simplified.
The Noisy-OR Model
Rather than requiring full CPTs, the tool uses a noisy-OR approximation — a well-established simplification used in medical diagnostic Bayesian networks (including early versions of systems like QMR-DT).
The noisy-OR model rests on a key assumption: each parent node can independently cause the child node to become active. The probability that a child node is not activated is the product of the probabilities that each of its parents individually failed to activate it:
P(child not activated) = ∏ (1 − parent_belief × edge_weight)
P(child activated) = 1 − P(child not activated)
This means that multiple facilitatory inputs compound correctly — two strong facilitatory parents push the child much further than one alone. Conversely, a strong inhibitory input suppresses the child's activation by reducing the effective belief of the incoming signal.
Priors
Every node starts with a prior probability — its baseline likelihood of being active before any specific evidence is introduced. In this tool, the prior is derived from node size, encoding the clinical judgement that a larger node represents a more prevalent or significant factor for this patient. The prior acts as a floor: even with no active inputs, the node sits at its prior level.
Evidence and Observation
When a clinician or patient introduces a signal to a node using the keyboard inputs, that node becomes observed — pinned at its assigned belief level. This is analogous to conditioning on evidence in a Bayesian network: the observed node represents a known fact and the rest of the network updates in response. Observed nodes send signals downstream but do not receive updates from propagation.
Propagation
The model runs 20 iterative passes through the network after each input. This allows belief to travel through chains of connections and allows bidirectional relationships to reach a stable equilibrium. A loop damping factor (0.85) is applied to all edge weights to prevent feedback loops from inflating beliefs without bound.
What the Numbers Mean — and What They Don't
The belief values displayed represent relative influence scores, not calibrated clinical probabilities. A Pain node at 78% does not mean there is a 78% probability of the patient being in pain — it means the network model, given the inputs provided, suggests Pain is substantially elevated relative to its prior.
What is clinically meaningful is:
- The direction of change — did a factor go up or down in response to an intervention?
- The relative magnitude — which factors responded most strongly?
- The pattern of ripple effects — which unexpected nodes were affected?
- The presence of oscillation — does the system hunt around an equilibrium, suggesting competing feedback loops?
When a clinician introduces a facilitatory signal and observes Pain initially drop, then partly recover, then settle at a new lower level — this oscillation reflects a genuine property of tightly coupled feedback systems: interventions in one part of a network have non-linear, time-dependent effects on the whole. This is one of the most important clinical messages the tool conveys.
This is not a diagnostic tool. The network and its analysis cannot determine what is causing a patient's pain, predict outcomes, or guide treatment decisions in any formal sense.
This is not a validated Bayesian network. A true Bayesian network requires empirically derived conditional probabilities, expert elicitation, and validation against clinical data. The parameters here — edge weights, priors, damping factors — reflect clinical judgement and subjective experience, not measured probabilities.
This is not a simulation of neurobiological processes. The propagation model does not represent actual neural signalling, nociceptive processing, or psychological mechanisms. It is a metaphor — a way of making the concept of interconnection and mutual influence visible and explorable.
The analysis is forwards-only. The model propagates evidence from observed nodes downstream. It does not perform backwards inference — it cannot reason from an observed effect (high Pain) back to the most likely causes. Full backwards inference would require a complete Bayesian inference engine, which is beyond the scope of this tool.
Case formulation — collaboratively building the network with the patient makes implicit clinical reasoning explicit and shared. Patients often report that seeing their experience mapped visually helps them feel understood and helps them understand the interconnected nature of their pain.
Psychoeducation — the Analyse feature provides an interactive demonstration of concepts from pain neuroscience — central sensitisation, the role of psychological and social factors, the importance of activity and sleep — without requiring technical language.
Treatment planning — by modelling proposed interventions the tool can support shared decision-making conversations about where to focus treatment effort.
Monitoring — returning to the tool at subsequent appointments and adjusting the network based on the patient's evolving experience can support reflection on progress and treatment response.
The Pain Network Builder combines interactive network visualisation with a simplified Bayesian-inspired propagation model to create a tool that is clinically useful without claiming mathematical precision. It makes visible the interconnected, non-linear nature of chronic pain — and in doing so, communicates one of the most important messages in contemporary pain science: that pain is a system, not a symptom, and that understanding it requires thinking about the whole person.
This tool and text has been built with AI assistance.