clinical-reasoning
clinical-reasoning copied to clipboard
$apply produces invalid references
In the resulting CarePlan that is produced from the $apply operation there are potentially a number of contained resources that are produced and included in the CarePlan. These resources may also have a need to reference other contained resources in the CarePlan. Currently, when this occurs invalid references are generated. Below is an example of the output I received in the contained RequestGroup in the CarePlan that was generated from a PlanDefinition. The action makes reference to another contained RequestGroup with the id EN-1-EN-1. This should be #EN-1-EN-1.
Per the fhir specification: When a contained resource references its container or another contained resource within its container, it must always be a local relative reference (i.e. it must be or start with '#')
"action": [
{
"id": "EN-1",
"title": "Enrollment",
"description": "Initial enrollment visit for patient screening and inclusion",
"relatedAction": [
{
"actionId": "EN-1",
"relationship": "concurrent",
"offsetDuration": {
"value": 0,
"system": "http://unitsofmeasure.org",
"code": "mo"
}
}
],
"resource": {
"reference": "EN-1-EN-1"
}
},