<?php

/** @var \App\Models\Pro $hcpPro */
/** @var \App\Models\Pro $pro */
/** @var \App\Models\Note $note */

if(!@$hcpPro) {
    if(@$note) {
        $hcpPro = $note->hcpPro;
    }
    else {
        $hcpPro = $pro; // should never get here
    }
}

$canvasData = [];
if ($patient->canvas_data) {
    $canvasData = json_decode($patient->canvas_data, true);
    if(!isset($canvasData["lifestyle_rx_update"])) $canvasData["lifestyle_rx_update"] = [];
    if(!isset($canvasData["lifestyle_rx_update"][$hcpPro->id])) $canvasData["lifestyle_rx_update"][$hcpPro->id] = [];
    $canvasData = $canvasData['lifestyle_rx_update'][$hcpPro->id];
}
$contentData = $canvasData;
