From 54b3fdf54231a69994e938586f55a077aac03d61 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Thu, 8 Oct 2026 12:58:38 +0530 Subject: [PATCH] chore(abdm): add abdm:inspect-patient spark command --- app/Commands/TestAbdmInspect.php | 57 ++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 app/Commands/TestAbdmInspect.php diff --git a/app/Commands/TestAbdmInspect.php b/app/Commands/TestAbdmInspect.php new file mode 100644 index 0000000..d9a39d1 --- /dev/null +++ b/app/Commands/TestAbdmInspect.php @@ -0,0 +1,57 @@ +initController($request, $response, $logger); + + $res = $gateway->hipPatientCareContexts(); + $body = $res->getBody(); + $data = json_decode($body, true); + + if (empty($data['ok'])) { + CLI::error('Error: ' . ($data['error_text'] ?? 'Unknown error')); + return; + } + + $contexts = $data['care_contexts'] ?? []; + CLI::write("Total Care Contexts: " . count($contexts), 'green'); + CLI::newLine(); + + $table = []; + foreach ($contexts as $cc) { + $table[] = [ + 'Reference' => $cc['ref'], + 'HI Type' => $cc['hi_type'], + 'FHIR' => $cc['is_fhir_ready'] ? 'Ready' : 'Draft', + 'Status' => $cc['is_linked'] ? 'LINKED' : 'UNLINKED', + 'Display' => $cc['display'], + ]; + } + + CLI::table($table, ['Reference', 'HI Type', 'FHIR', 'Status', 'Display']); + } +}