Remove obsolete one-off M3/M2 diagnostic scripts (root cause resolved)
This commit is contained in:
parent
fd0d571f9b
commit
9f2460fed9
|
|
@ -1,56 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
use App\Libraries\Abdm\M3HiuWorkflowService;
|
||||
use CodeIgniter\CLI\BaseCommand;
|
||||
use CodeIgniter\CLI\CLI;
|
||||
|
||||
/**
|
||||
* One-off diagnostic: manually call consent_reconcile using an ABDM
|
||||
* consent_request_id (the umbrella id covering potentially multiple linked
|
||||
* HIP facility consent artifacts), to check whether the bridge's
|
||||
* /v1/hiu/consent/status endpoint can expose all artifacts under one
|
||||
* consent request (vs. only a single mapped artifact per local request_id).
|
||||
*
|
||||
* Usage:
|
||||
* php spark abdm:hiu-reconcile-by-request --consent_request_id <id> --abha_address <abha>
|
||||
*/
|
||||
class AbdmHiuReconcileByRequest extends BaseCommand
|
||||
{
|
||||
protected $group = 'ABDM';
|
||||
protected $name = 'abdm:hiu-reconcile-by-request';
|
||||
protected $description = 'Manually run consent_reconcile using an ABDM consent_request_id.';
|
||||
protected $usage = 'abdm:hiu-reconcile-by-request --consent_request_id <id> --abha_address <abha>';
|
||||
protected $options = [
|
||||
'--consent_request_id' => 'ABDM consent_request_id (umbrella id) to reconcile.',
|
||||
'--abha_address' => 'Patient ABHA address, e.g. someone@sbx.',
|
||||
'--hfr_id' => 'Optional HFR id override.',
|
||||
];
|
||||
|
||||
public function run(array $params)
|
||||
{
|
||||
$consentRequestId = trim((string) (CLI::getOption('consent_request_id') ?? ''));
|
||||
$abhaAddress = trim((string) (CLI::getOption('abha_address') ?? ''));
|
||||
$hfrId = trim((string) (CLI::getOption('hfr_id') ?? ''));
|
||||
|
||||
if ($consentRequestId === '' || $abhaAddress === '') {
|
||||
CLI::error('Both --consent_request_id and --abha_address are required.');
|
||||
return;
|
||||
}
|
||||
|
||||
$payload = [
|
||||
'abdm_consent_request_id' => $consentRequestId,
|
||||
'abha_address' => $abhaAddress,
|
||||
];
|
||||
if ($hfrId !== '') {
|
||||
$payload['hfr_id'] = $hfrId;
|
||||
}
|
||||
|
||||
$service = new M3HiuWorkflowService();
|
||||
$result = $service->runOperation('consent_reconcile', $payload);
|
||||
|
||||
CLI::write('=== consent_reconcile result ===', 'yellow');
|
||||
CLI::write(json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
<?php
|
||||
$db = new mysqli('localhost', 'root', '', 'hms_data_ci4');
|
||||
|
||||
$pid = isset($argv[1]) ? (int) $argv[1] : 15;
|
||||
|
||||
echo "=== Patient ===\n";
|
||||
$r = $db->query("SELECT id, p_fname, p_lname, abha_address FROM patient_master WHERE id = {$pid}");
|
||||
$patient = $r ? $r->fetch_assoc() : null;
|
||||
print_r($patient);
|
||||
|
||||
$abhaAddress = $patient['abha_address'] ?? '';
|
||||
|
||||
echo "\n=== abdm_hiu_workflows columns ===\n";
|
||||
$colsResult = $db->query("SHOW COLUMNS FROM abdm_hiu_workflows");
|
||||
$workflowCols = [];
|
||||
while ($c = $colsResult->fetch_assoc()) {
|
||||
$workflowCols[] = $c['Field'];
|
||||
}
|
||||
echo implode(', ', $workflowCols) . "\n";
|
||||
|
||||
echo "\n=== abdm_hiu_workflows (latest 15 for this ABHA / patient) ===\n";
|
||||
$where = $abhaAddress !== '' ? "abha_address = '" . $db->real_escape_string($abhaAddress) . "'" : "1=0";
|
||||
$result = $db->query("
|
||||
SELECT *
|
||||
FROM abdm_hiu_workflows
|
||||
WHERE {$where}
|
||||
ORDER BY id DESC
|
||||
LIMIT 15
|
||||
");
|
||||
if ($result) {
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
print_r($row);
|
||||
}
|
||||
} else {
|
||||
echo "Query failed or table missing: " . $db->error . "\n";
|
||||
}
|
||||
|
||||
echo "\n=== abdm_api_logs (latest 15) ===\n";
|
||||
$result2 = $db->query("SHOW TABLES LIKE 'abdm_api_logs'");
|
||||
if ($result2 && $result2->num_rows > 0) {
|
||||
$cols = $db->query("SHOW COLUMNS FROM abdm_api_logs");
|
||||
$colNames = [];
|
||||
while ($c = $cols->fetch_assoc()) {
|
||||
$colNames[] = $c['Field'];
|
||||
}
|
||||
echo "Columns: " . implode(', ', $colNames) . "\n\n";
|
||||
$result3 = $db->query("SELECT * FROM abdm_api_logs ORDER BY id DESC LIMIT 15");
|
||||
while ($row = $result3->fetch_assoc()) {
|
||||
print_r($row);
|
||||
}
|
||||
} else {
|
||||
echo "abdm_api_logs table not found.\n";
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
$db = new mysqli('localhost', 'root', '', 'hms_data_ci4');
|
||||
|
||||
$requestId = $argv[1] ?? 'REQ-20260728030135-90ee8841';
|
||||
$escaped = $db->real_escape_string($requestId);
|
||||
|
||||
echo "=== abdm_hiu_workflows matching request_id/gateway_request_id/hms_request_id = {$requestId} ===\n";
|
||||
$result = $db->query("
|
||||
SELECT *
|
||||
FROM abdm_hiu_workflows
|
||||
WHERE request_id = '{$escaped}' OR gateway_request_id = '{$escaped}' OR hms_request_id = '{$escaped}'
|
||||
ORDER BY id ASC
|
||||
");
|
||||
if ($result) {
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
print_r($row);
|
||||
}
|
||||
} else {
|
||||
echo "Query failed: " . $db->error . "\n";
|
||||
}
|
||||
|
||||
echo "\n=== abdm_api_logs matching entity_id = {$requestId} ===\n";
|
||||
$result2 = $db->query("SELECT * FROM abdm_api_logs WHERE entity_id = '{$escaped}' ORDER BY id ASC");
|
||||
if ($result2) {
|
||||
while ($row = $result2->fetch_assoc()) {
|
||||
print_r($row);
|
||||
}
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
$db = new mysqli('localhost', 'root', '', 'hms_data_ci4');
|
||||
$rows = $db->query("SELECT s_name, s_value FROM hospital_setting WHERE s_name IN ('EATRIA_BRIDGE_TOKEN','ABDM_HFR_ID')");
|
||||
$settings = [];
|
||||
while ($r = $rows->fetch_assoc()) {
|
||||
$settings[$r['s_name']] = $r['s_value'];
|
||||
}
|
||||
echo "Token present: " . (isset($settings['EATRIA_BRIDGE_TOKEN']) && $settings['EATRIA_BRIDGE_TOKEN'] !== '' ? 'yes (len=' . strlen($settings['EATRIA_BRIDGE_TOKEN']) . ')' : 'NO') . "\n";
|
||||
echo "HFR ID: " . ($settings['ABDM_HFR_ID'] ?? 'NOT SET') . "\n";
|
||||
$db->close();
|
||||
|
|
@ -1,125 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* One-off diagnostic: test the e-Atria bridge's care-context-link endpoint
|
||||
* under two candidate paths to determine which one is actually live, since
|
||||
* app/Libraries/Abdm/Sync/AbdmGatewayPushClient.php::pushCareContextLink()
|
||||
* calls '/api/v1/abdm/gateway/care-context/link' and gets HTTP 404, while
|
||||
* the sibling pushRecord() correctly uses '/api/v3/records/push'.
|
||||
*
|
||||
* Does NOT print the bridge token. Only prints HTTP status codes + short
|
||||
* response bodies so we can see which path (if any) the bridge recognizes.
|
||||
*
|
||||
* Usage: php83 check_care_context_link_endpoint.php
|
||||
* Delete this file after use.
|
||||
*/
|
||||
|
||||
$envPath = __DIR__ . '/.env';
|
||||
$lines = file($envPath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
$env = [];
|
||||
foreach ($lines as $line) {
|
||||
$line = trim($line);
|
||||
if ($line === '' || $line[0] === '#' || strpos($line, '=') === false) {
|
||||
continue;
|
||||
}
|
||||
[$k, $v] = explode('=', $line, 2);
|
||||
$env[trim($k)] = trim($v, " \t\n\r\0\x0B\"'");
|
||||
}
|
||||
|
||||
$host = $env['database.default.hostname'] ?? 'localhost';
|
||||
$db = $env['database.default.database'] ?? '';
|
||||
$user = $env['database.default.username'] ?? '';
|
||||
$pass = $env['database.default.password'] ?? '';
|
||||
$port = (int) ($env['database.default.port'] ?? 3306);
|
||||
|
||||
$mysqli = @new mysqli($host, $user, $pass, $db, $port ?: 3306);
|
||||
if ($mysqli->connect_errno) {
|
||||
fwrite(STDERR, "DB connect failed: " . $mysqli->connect_error . "\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$settings = [];
|
||||
$res = $mysqli->query("SELECT s_name, s_value FROM hospital_setting WHERE s_name IN ('EATRIA_BRIDGE_URL','EATRIA_BRIDGE_TOKEN','ABDM_HFR_ID','H_HFR_ID')");
|
||||
while ($row = $res->fetch_assoc()) {
|
||||
$settings[$row['s_name']] = $row['s_value'];
|
||||
}
|
||||
|
||||
$baseUrl = rtrim($settings['EATRIA_BRIDGE_URL'] ?? '', '/');
|
||||
$token = trim($settings['EATRIA_BRIDGE_TOKEN'] ?? '');
|
||||
$hfrId = trim($settings['ABDM_HFR_ID'] ?? ($settings['H_HFR_ID'] ?? ''));
|
||||
|
||||
echo "Base URL: {$baseUrl}\n";
|
||||
echo "HFR ID: {$hfrId}\n";
|
||||
echo "Token configured: " . ($token !== '' ? 'yes (len=' . strlen($token) . ')' : 'NO') . "\n\n";
|
||||
|
||||
if ($baseUrl === '' || $token === '') {
|
||||
fwrite(STDERR, "Missing bridge URL or token in hospital_setting; aborting.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Sanity check: confirm auth/connectivity works against a known endpoint
|
||||
// before testing the candidate care-context-link paths.
|
||||
$sanityUrl = rtrim($baseUrl, '/') . '/api/v3/gateway/status';
|
||||
$sanityUrl = (string) preg_replace('#/api/api/#', '/api/', $sanityUrl);
|
||||
$ch = curl_init($sanityUrl);
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $token],
|
||||
CURLOPT_TIMEOUT => 15,
|
||||
]);
|
||||
$sanityBody = curl_exec($ch);
|
||||
$sanityCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
echo "=== Sanity check: GET {$sanityUrl} ===\n";
|
||||
echo "HTTP {$sanityCode}\n";
|
||||
echo "Body: " . substr((string) $sanityBody, 0, 300) . "\n\n";
|
||||
|
||||
$paths = [
|
||||
'/api/v1/abdm/gateway/care-context/link',
|
||||
'/api/v3/care-context/link',
|
||||
'/api/v3/records/care-context/link',
|
||||
'/api/v1/hip/care-context/link',
|
||||
'/api/v3/gateway/care-context/link',
|
||||
];
|
||||
|
||||
$payload = json_encode([
|
||||
'hfr_id' => $hfrId,
|
||||
'hospital_id' => 1,
|
||||
'patient' => [
|
||||
'patient_id' => 'TEST-DIAG-0001',
|
||||
'name' => 'Test Diagnostic Patient',
|
||||
'mobile' => '9999999999',
|
||||
'gender' => 'M',
|
||||
'year_of_birth' => 1990,
|
||||
],
|
||||
'care_contexts' => [
|
||||
['reference_number' => 'TEST-CC-0001', 'display' => 'Diagnostic Test Care Context'],
|
||||
],
|
||||
]);
|
||||
|
||||
foreach ($paths as $path) {
|
||||
// Mirror AbdmGatewayPushClient::buildGatewayUrl(), which collapses a
|
||||
// duplicated "/api/api/" segment when $baseUrl already ends in "/api".
|
||||
$url = rtrim($baseUrl, '/') . '/' . ltrim($path, '/');
|
||||
$url = (string) preg_replace('#/api/api/#', '/api/', $url);
|
||||
$ch = curl_init($url);
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $payload,
|
||||
CURLOPT_HTTPHEADER => [
|
||||
'Authorization: Bearer ' . $token,
|
||||
'Content-Type: application/json',
|
||||
],
|
||||
CURLOPT_TIMEOUT => 15,
|
||||
]);
|
||||
$body = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
$err = curl_error($ch);
|
||||
curl_close($ch);
|
||||
|
||||
echo "=== POST {$url} ===\n";
|
||||
echo "HTTP {$httpCode}" . ($err ? " (curl error: {$err})" : '') . "\n";
|
||||
echo "Body: " . substr((string) $body, 0, 400) . "\n\n";
|
||||
}
|
||||
|
||||
$mysqli->close();
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* One-off diagnostic: dumps the request_json and response_json for the most
|
||||
* recent "consent_request" workflow rows, to see the RAW bridge response
|
||||
* behind a generic "HTTP 400" error shown in the New Consent Request modal.
|
||||
*
|
||||
* Usage:
|
||||
* php83 check_consent_request_400.php -> last 5 consent_request rows
|
||||
* php83 check_consent_request_400.php <id> -> full dump for one row id
|
||||
*
|
||||
* Reads DB credentials from the app's own .env (does not print them).
|
||||
*/
|
||||
|
||||
$envPath = __DIR__ . '/.env';
|
||||
if (! is_file($envPath)) {
|
||||
fwrite(STDERR, "Could not find .env at {$envPath}\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$lines = file($envPath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
$env = [];
|
||||
foreach ($lines as $line) {
|
||||
$line = trim($line);
|
||||
if ($line === '' || $line[0] === '#' || strpos($line, '=') === false) {
|
||||
continue;
|
||||
}
|
||||
[$k, $v] = explode('=', $line, 2);
|
||||
$env[trim($k)] = trim($v, " \t\n\r\0\x0B\"'");
|
||||
}
|
||||
|
||||
$host = $env['database.default.hostname'] ?? 'localhost';
|
||||
$db = $env['database.default.database'] ?? '';
|
||||
$user = $env['database.default.username'] ?? '';
|
||||
$pass = $env['database.default.password'] ?? '';
|
||||
$port = (int) ($env['database.default.port'] ?? 3306);
|
||||
|
||||
if ($db === '' || $user === '') {
|
||||
fwrite(STDERR, "Could not resolve DB credentials from .env (looked for database.default.* keys)\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$mysqli = @new mysqli($host, $user, $pass, $db, $port ?: 3306);
|
||||
if ($mysqli->connect_errno) {
|
||||
fwrite(STDERR, "DB connect failed: " . $mysqli->connect_error . "\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo "Connected to DB '{$db}' on {$host}.\n\n";
|
||||
|
||||
$id = (int) ($argv[1] ?? 0);
|
||||
|
||||
if ($id > 0) {
|
||||
$stmt = $mysqli->prepare("SELECT id, operation, workflow_state, status, http_code, is_retryable,
|
||||
consent_id, abha_address, transaction_id, last_error, created_at,
|
||||
request_json, response_json
|
||||
FROM abdm_hiu_workflows WHERE id = ?");
|
||||
$stmt->bind_param('i', $id);
|
||||
$stmt->execute();
|
||||
$row = $stmt->get_result()->fetch_assoc();
|
||||
if (! $row) {
|
||||
echo "No row found for id={$id}\n";
|
||||
exit(0);
|
||||
}
|
||||
foreach (['id', 'operation', 'workflow_state', 'status', 'http_code', 'is_retryable', 'consent_id', 'abha_address', 'transaction_id', 'last_error', 'created_at'] as $col) {
|
||||
echo str_pad($col, 16) . ": " . ($row[$col] ?? '') . "\n";
|
||||
}
|
||||
echo "\n--- request_json ---\n";
|
||||
$reqDecoded = json_decode((string) $row['request_json'], true);
|
||||
echo $reqDecoded !== null ? json_encode($reqDecoded, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) : (string) $row['request_json'];
|
||||
echo "\n\n--- response_json ---\n";
|
||||
$respDecoded = json_decode((string) $row['response_json'], true);
|
||||
echo $respDecoded !== null ? json_encode($respDecoded, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) : (string) $row['response_json'];
|
||||
echo "\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$res = $mysqli->query("SELECT id, operation, workflow_state, status, http_code, is_retryable,
|
||||
consent_id, abha_address, transaction_id, last_error, created_at
|
||||
FROM abdm_hiu_workflows
|
||||
WHERE operation = 'consent_request'
|
||||
ORDER BY id DESC LIMIT 5");
|
||||
if (! $res) {
|
||||
fwrite(STDERR, "Query failed: " . $mysqli->error . "\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo "Last 5 'consent_request' workflow rows:\n";
|
||||
while ($row = $res->fetch_assoc()) {
|
||||
echo "----\n";
|
||||
foreach (['id', 'operation', 'workflow_state', 'status', 'http_code', 'is_retryable', 'consent_id', 'abha_address', 'transaction_id', 'last_error', 'created_at'] as $col) {
|
||||
echo str_pad($col, 16) . ": " . ($row[$col] ?? '') . "\n";
|
||||
}
|
||||
}
|
||||
echo "\nRun 'php83 check_consent_request_400.php <id>' on one of the above ids to see the full raw request/response JSON.\n";
|
||||
|
|
@ -1,116 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* One-off diagnostic: run this from the CI4 project root on the SERVER
|
||||
* (e.g. /var/www/html/hms_etria) to inspect why a "Completed" ABDM data_fetch
|
||||
* produced zero rows in abdm_hiu_documents.
|
||||
*
|
||||
* Usage:
|
||||
* php check_remote_abdm_fetch.php -> shows last 5 data_fetch workflow rows
|
||||
* php check_remote_abdm_fetch.php REQ-xxxxxxxxx -> shows detail for that request_id
|
||||
*
|
||||
* Reads DB credentials from the app's own .env (does not print them).
|
||||
*/
|
||||
|
||||
$envPath = __DIR__ . '/.env';
|
||||
if (! is_file($envPath)) {
|
||||
fwrite(STDERR, "Could not find .env at {$envPath}\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$lines = file($envPath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
$env = [];
|
||||
foreach ($lines as $line) {
|
||||
$line = trim($line);
|
||||
if ($line === '' || $line[0] === '#' || strpos($line, '=') === false) {
|
||||
continue;
|
||||
}
|
||||
[$k, $v] = explode('=', $line, 2);
|
||||
$env[trim($k)] = trim($v, " \t\n\r\0\x0B\"'");
|
||||
}
|
||||
|
||||
$host = $env['database.default.hostname'] ?? 'localhost';
|
||||
$db = $env['database.default.database'] ?? '';
|
||||
$user = $env['database.default.username'] ?? '';
|
||||
$pass = $env['database.default.password'] ?? '';
|
||||
$port = (int) ($env['database.default.port'] ?? 3306);
|
||||
|
||||
if ($db === '' || $user === '') {
|
||||
fwrite(STDERR, "Could not resolve DB credentials from .env (looked for database.default.* keys)\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$mysqli = @new mysqli($host, $user, $pass, $db, $port ?: 3306);
|
||||
if ($mysqli->connect_errno) {
|
||||
fwrite(STDERR, "DB connect failed: " . $mysqli->connect_error . "\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
echo "Connected to DB '{$db}' on {$host}.\n\n";
|
||||
|
||||
$requestId = trim($argv[1] ?? '');
|
||||
|
||||
if ($requestId !== '') {
|
||||
$stmt = $mysqli->prepare("SELECT id, operation, workflow_state, status, http_code, is_retryable, retry_count,
|
||||
consent_id, abdm_consent_artifact_id, abha_address, transaction_id,
|
||||
last_error, created_at, updated_at, completed_at,
|
||||
LENGTH(response_json) AS response_len, LENGTH(request_json) AS request_len
|
||||
FROM abdm_hiu_workflows WHERE request_id = ? ORDER BY id ASC");
|
||||
$stmt->bind_param('s', $requestId);
|
||||
$stmt->execute();
|
||||
$res = $stmt->get_result();
|
||||
if ($res->num_rows === 0) {
|
||||
echo "No abdm_hiu_workflows rows found for request_id={$requestId}\n";
|
||||
}
|
||||
while ($row = $res->fetch_assoc()) {
|
||||
echo "--- workflow id={$row['id']} op={$row['operation']} ---\n";
|
||||
foreach ($row as $k => $v) {
|
||||
echo " {$k}: " . (is_null($v) ? 'NULL' : $v) . "\n";
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
// Try to show a snippet of response_json for the data_fetch op specifically,
|
||||
// to see if the bridge actually returned any careContexts/entries.
|
||||
$stmt2 = $mysqli->prepare("SELECT id, response_json FROM abdm_hiu_workflows WHERE request_id = ? AND operation = 'data_fetch' ORDER BY id DESC LIMIT 1");
|
||||
$stmt2->bind_param('s', $requestId);
|
||||
$stmt2->execute();
|
||||
$r2 = $stmt2->get_result()->fetch_assoc();
|
||||
if ($r2 && $r2['response_json']) {
|
||||
$json = json_decode($r2['response_json'], true);
|
||||
echo "=== data_fetch response_json summary (id={$r2['id']}) ===\n";
|
||||
if (is_array($json)) {
|
||||
echo "Top-level keys: " . implode(', ', array_keys($json)) . "\n";
|
||||
// Common shapes to look for
|
||||
foreach (['careContexts', 'entries', 'records', 'bundles', 'data', 'result'] as $key) {
|
||||
if (isset($json[$key]) && is_array($json[$key])) {
|
||||
echo " {$key}: " . count($json[$key]) . " item(s)\n";
|
||||
}
|
||||
}
|
||||
echo "Raw length: " . strlen($r2['response_json']) . " bytes\n";
|
||||
} else {
|
||||
echo "response_json could not be decoded as JSON. Length: " . strlen($r2['response_json']) . "\n";
|
||||
}
|
||||
} else {
|
||||
echo "No data_fetch response_json stored for this request_id.\n";
|
||||
}
|
||||
|
||||
// Check whether any documents got persisted for this request_id / transaction_id
|
||||
$stmt3 = $mysqli->prepare("SELECT COUNT(*) AS c FROM abdm_hiu_documents WHERE request_id = ?");
|
||||
$stmt3->bind_param('s', $requestId);
|
||||
$stmt3->execute();
|
||||
$c = $stmt3->get_result()->fetch_assoc();
|
||||
echo "\nabdm_hiu_documents rows with this exact request_id: {$c['c']}\n";
|
||||
} else {
|
||||
echo "=== Last 5 data_fetch workflow rows ===\n";
|
||||
$res = $mysqli->query("SELECT id, request_id, workflow_state, status, http_code, last_error, created_at
|
||||
FROM abdm_hiu_workflows WHERE operation = 'data_fetch' ORDER BY id DESC LIMIT 5");
|
||||
while ($row = $res->fetch_assoc()) {
|
||||
print_r($row);
|
||||
}
|
||||
echo "\nTotal abdm_hiu_documents rows: ";
|
||||
print_r($mysqli->query("SELECT COUNT(*) c FROM abdm_hiu_documents")->fetch_assoc());
|
||||
echo "\nRun again with the request_id as an argument for full detail, e.g.:\n";
|
||||
echo " php check_remote_abdm_fetch.php REQ-20260728043833-7c0d9947\n";
|
||||
}
|
||||
|
||||
$mysqli->close();
|
||||
Loading…
Reference in New Issue
Block a user