Pathways on FHIR Mapping - mcode/pathway-builder GitHub Wiki
Pathways to CPG Mapping
This is an evolving wiki page for mapping the internal data model for pathways into CPG. This page builds off Pathways on FHIR and Pathways on FHIR Resources.
Powerpoint deck of mapping is available for download here.
Overview
Each pathway in the builder will map to a Recommendation Definition. Although the builder supports joining branches again, the CPG exporter will not. Anywhere two branches of the pathway rejoin the CPG representation will have the entire sub-tree copied. Each Action Node will map to only one Activity Definition but the RecommendationDefinition.action may have duplicate entries for the same Action Node. In general the RecommendationDefinition.actions will be all of the Action Nodes as well as any Branch Nodes whose parent is also a Branch Node.
Mapping
Pathway to Recommendation Definition
Mapping the pathway metadata to a Recommendation is very straight forward.

Nodes to RecommendationDefinition.action
Unlike the pathway data model which has a discrete node for both action and branch, the Recommendation Definition only defines a list of actions. Each Action Node will map to its own RecommendationDefinition.action. The Branch Nodes do not become their own action unless their parent is also a branch (nested branch node). Branch Nodes are represented in the Recommendation Definition as the action.condition property of the child transition.
The general mapping of RecommendationDefinition.action is:
{
id: string, // automatically assigned
title: node.label,
description: ("Action for " | "Branch based on ") + node.label,
definitionCanonical?: canonical(ActivityDefinition),
condition?: [{
kind: "applicability",
expression: {
language: "text/cql",
expression: parent.transition.condition
}
}],
relatedAction?: [
{
actionId: string // parent action id,
relationship: "after-end"
},
{
actionId: string // child action id,
relationship: "before-start"
}
],
action?: [ {Action} ] // child actions
}
where:
definitionCanonicalis defined for action nodes, otherwise undefinedconditionis defined when the parent node is a branch, otherwise undefinedactionis defined for nested branch nodes, otherwise undefinedrelatedActiondefines all of the parent and child transitions for Action Nodes only
Action Nodes

Nested Branch Nodes

ActionNode.action to Activity Definition
Even if a single Action Node has multiple RecommendationDefinition.actions they will have the same definitionCanonical to a single ActivityDefinition. The mapping is trivial:
