From 5c1542428079bb78439af3797bd29c74c52e35d6 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Tue, 28 Jul 2026 02:26:19 +0530 Subject: [PATCH] Promote granted consent status in snapshot ranking --- app/Controllers/Patient.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/Controllers/Patient.php b/app/Controllers/Patient.php index 49c59e6..9dcb772 100644 --- a/app/Controllers/Patient.php +++ b/app/Controllers/Patient.php @@ -3067,6 +3067,14 @@ class Patient extends BaseController $decoded = []; } + $rawConsentStatus = strtoupper(trim((string) ( + $decoded['consent']['status'] + ?? $decoded['consent_status'] + ?? $decoded['status'] + ?? $decoded['data']['consent']['status'] + ?? '' + ))); + $requestId = trim((string) ( $row['gateway_request_id'] ?? $row['request_id'] @@ -3103,6 +3111,12 @@ class Patient extends BaseController if (($operation === 'DATA_FETCH' || $operation === 'HI_DATA_PUSH_CALLBACK') && $status === 'SUCCESS') { $phase = 'COMPLETED'; $priority = 500; + } elseif (in_array($rawConsentStatus, ['GRANTED', 'APPROVED', 'ACTIVE'], true)) { + $phase = 'GRANTED'; + $priority = 430; + } elseif (in_array($rawConsentStatus, ['REVOKED', 'DENIED', 'EXPIRED'], true)) { + $phase = 'DENIED'; + $priority = 310; } elseif (in_array($state, ['DATA_RECEIVED'], true)) { $phase = 'COMPLETED'; $priority = 480;