ABDM OPD Queue (today): - New EAtriaBridgeConnector: opdQueueFetch/opdTokenCreate/opdTokenUpdateStatus + patch() helper - New AbdmOpdQueue controller: index/list/fetchQueue/createToken/updateTokenStatus/processScannedToken - fetchQueue syncs gateway tokens into abdm_opd_tokens (local DB) and enriches with HMS patient data - processScannedToken auto-finds/creates patient_master record from ABHA scan data, marks token CALLED - New migration: abdm_opd_tokens table (gateway_token_id, source, status, patient_id, opd_id, processed_at) - New view: abdm/opd_queue.php - reception screen with auto-refresh 30s, HMS Patient column (green row when OPD registered) - Sidebar: ABDM OPD Queue nav link added - Routes: AbdmOpdQueue with abdmPermFilter ABHA Register tab (earlier this session): - New Abha controller: initiate/verifyOtp/communication/verifyCommOtp/validateAbha/card + autoCreateOrFindPatient - New views: abha/card.php, partials/abha_create_panel.php, partials/abha_otp_modal.php - Patient_V.php: ABHA Register tab with 4-method wizard (ABHA number, QR scan, facility QR, mobile OTP) Patient ABHA search fix: - Patient::search() now detects ABHA column (abha_id/abha_no/abha/abha_address) and searches by it ABDM Bridge infrastructure: - EAtriaBridgeConnector: new connector for e-atria.in ABDM bridge gateway - AbdmConnectorFactory/Interface updated - AbdmGatewaySettings controller + view - SNOMED/CSNOTK terminology service skeleton - Finance payout OPD consult views - Migration: AddAbdmPushFieldsToOpdAndPatient, CreateSnomedCoreTables - Docs: abdm/ API specs, architecture, gateway guides
11 KiB
ABDM Sandbox Integration - HMS Setup Guide
Date: May 12, 2026
Status: Sandbox Approved
Client ID: SBXID_033661
Integration Mode: DreamSoft Middleware Gateway
1. Overview
This HMS application integrates with ABDM (Ayushman Bharat Digital Mission) sandbox environment to support:
- ABHA (Ayushman Bharat Health Account) linking and validation
- Health Information exchange and consent management
- FHIR R4 bundle creation for OPD, Lab, and Discharge records
- Direct prescription/report sharing with ABDM ecosystem
The integration supports two modes:
- DreamSoft (Current): Routes through middleware gateway (csnotk.e-atria.in)
- Direct ABDM: Direct API calls to NHA ABDM M3 (future/testing)
2. Sandbox Credentials
Client ID: SBXID_033661
Client Secret: 656f79f1-ef99-495f-9f37-713219ecbbcf
Mode: DreamSoft Middleware Gateway
Middleware URL: https://csnotk.e-atria.in
Credential Storage
- Production: Store in secure vault/secrets manager
- Sandbox: Currently in
.env(do NOT commit to source control) - CI/CD: Use environment variables or secret management system
3. Configuration Details
3.1 .env File Setup
# ABDM Connector Mode
abdm.connector = dreamsoft
# Direct ABDM M3 API (for future direct mode)
abdm.directClientId = SBXID_033661
abdm.directClientSecret = 656f79f1-ef99-495f-9f37-713219ecbbcf
abdm.directBaseUrl = https://dev.abdm.gov.in/api/v3
abdm.directTimeoutSec = 30
# DreamSoft Middleware Gateway
BRIDGE_SYNC_URL = https://csnotk.e-atria.in/api/bridge
BRIDGE_SYNC_TOKEN = <your-bearer-token-here>
BRIDGE_SOURCE_CODE = SBXID_033661
BRIDGE_SYNC_TIMEOUT = 20
BRIDGE_SYNC_PROVIDER = bridge
# SNOMED CT Terminology Service
snomed.csnotk.baseUrl = https://csnotk.e-atria.in/csnoserv
snomed.csnotk.enabled = true
snomed.csnotk.timeoutSec = 10
# ABDM Sandbox Test Users
ABDM_SANDBOX_USERNAME = <your-sandbox-username>
ABDM_SANDBOX_PASSWORD = <your-sandbox-password>
ABDM_HFR_ID = <health-facility-registry-id>
ABDM_NPI_ID = <national-practitioner-identifier>
3.2 Config File: app/Config/AbdmConnector.php
Located at: app/Config/AbdmConnector.php
class AbdmConnector extends BaseConfig
{
public string $connector = 'dreamsoft'; // or 'direct_abdm'
public string $dreamsoftBridgeUrl = ''; // Loaded from .env
public string $dreamsoftBridgeToken = '';
public string $dreamsoftSourceCode = '';
public int $dreamsoftTimeoutSec = 20;
// Direct ABDM settings
public string $directAbdmBaseUrl = 'https://dev.abdm.gov.in/api/v3';
public string $directAbdmClientId = '';
public string $directAbdmClientSecret = '';
}
4. Available ABDM API Endpoints
All ABDM endpoints require permission: abdm.access, abdm.taskboard.access, or abdm.gateway.use
4.1 ABHA Validation
POST /AbdmGateway/abha_validate
Purpose: Validate and link an ABHA number/address to a patient record.
Request:
{
"patient_id": 12345,
"abha_number": "14-0061-0000-0001",
"abha_address": "patient123@abdm"
}
Response:
{
"update": 1,
"message": "ABHA linked successfully",
"patient_abha_id": "14-0061-0000-0001"
}
4.2 Consent Request
POST /AbdmGateway/consent_request
Purpose: Initiate consent request with a patient to share their health records.
Request:
{
"patient_id": 12345,
"consent_purpose": "treatment",
"hi_types": ["OPConsultRecord", "PrescriptionRecord"],
"date_range_from": "2024-01-01",
"date_range_to": "2026-05-12"
}
Response:
{
"update": 1,
"consent_request_id": "REQ-2026-001",
"consent_url": "https://sandbox.abdm.gov.in/consent/REQ-2026-001"
}
4.3 Share Prescription Bundle (OPD Consult)
POST /AbdmGateway/share_prescription_bundle
Purpose: Push OPD prescription/consult record to ABDM in FHIR format.
Request:
{
"opd_id": 5678,
"patient_id": 12345,
"consent_id": "CST-2026-001"
}
Response:
{
"update": 1,
"bundle_id": "2c49bc31-b79f-43c7-838f-e5c8c61f50df",
"status": "pushed",
"timestamp": "2026-05-12T10:30:00Z"
}
4.4 Share Lab Report Bundle (Diagnostic)
POST /AbdmGateway/share_diagnosis_report_bundle
Purpose: Push lab/diagnostic reports to ABDM.
Request:
{
"lab_report_id": 9012,
"patient_id": 12345,
"consent_id": "CST-2026-001"
}
4.5 Share Discharge Summary (IPD)
POST /AbdmGateway/share_ipd_discharge_bundle
Purpose: Push IPD discharge summary to ABDM.
5. Sandbox Testing Workflow
Step 1: Register Patient with ABHA
- Go to OPD → Consult Form
- Enter patient details
- In "ABHA Link" section, enter test ABHA number (e.g.,
14-0061-0000-0001) - Click "Validate ABHA"
- System connects to ABDM sandbox via middleware to link ABHA
Step 2: Create OPD Consult
- Fill in OPD consult form with:
- Complaints
- Diagnosis (with SNOMED CT codes)
- Vital signs (BP, pulse, temp, SpO2)
- Prescriptions
- Investigations
- Click "Save & Submit"
- System auto-generates FHIR bundle locally
Step 3: Initiate Consent Request
- Patient record loaded → "ABDM Actions" panel
- Click "Request Consent"
- Select HI types (OPConsultRecord, PrescriptionRecord)
- Choose date range
- System sends consent request to ABDM sandbox
- Patient receives consent link (sandbox email/SMS)
Step 4: Patient Grants Consent (Sandbox Only)
- Patient logs into ABDM sandbox (https://sandbox.abdm.gov.in)
- Accepts the consent request from your HMS
- Consent status changes to "GRANTED" in system
Step 5: Push Records to ABDM
- After consent granted, click "Share Records"
- Select records to push (OPD, Lab, Discharge)
- System creates FHIR bundle and pushes via middleware
- Receive bundle ID and push timestamp confirmation
6. Database Schema Requirements for ABDM
The following fields must exist in respective tables:
opd_prescription table
ALTER TABLE opd_prescription ADD COLUMN (
abha_id VARCHAR(50),
abha_address VARCHAR(100),
encounter_id VARCHAR(100),
care_provider_npi VARCHAR(50),
hfr_id VARCHAR(50),
fhir_bundle_id VARCHAR(100),
abdm_push_status INT DEFAULT 0, -- 0=pending, 1=pushed, 2=failed
abdm_push_timestamp DATETIME,
diagnosis_snomed_id VARCHAR(50),
diagnosis_snomed_term VARCHAR(255),
complaint_onset VARCHAR(100),
complaint_duration_days INT,
complaint_severity VARCHAR(50)
);
patient_master table
ALTER TABLE patient_master ADD COLUMN (
abha_number VARCHAR(50) UNIQUE,
abha_address VARCHAR(100) UNIQUE,
abha_linked_at DATETIME,
abha_link_status VARCHAR(20) -- pending, confirmed, failed
);
New: abdm_consent table
CREATE TABLE abdm_consent (
id INT PRIMARY KEY AUTO_INCREMENT,
patient_id INT,
consent_request_id VARCHAR(100) UNIQUE,
consent_id VARCHAR(100),
purpose VARCHAR(100),
hi_types JSON,
date_from DATE,
date_to DATE,
status VARCHAR(20), -- pending, granted, denied, expired
requested_at DATETIME,
granted_at DATETIME,
expires_at DATETIME,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (patient_id) REFERENCES patient_master(id)
);
7. FHIR Bundle Structure
The system generates FHIR R4 bundles for:
OPConsultRecord Bundle
- Composition: Document wrapper
- Bundle: Contains multiple resources
- Encounter: OPD visit details
- Patient: Demographics
- Practitioner: Doctor info
- Observation: Vitals, physical exam
- Condition: Complaints, diagnosis
- AllergyIntolerance: Drug allergies
- ServiceRequest: Investigations
- MedicationRequest: Prescriptions
PrescriptionRecord Bundle
- Composition: Prescription document
- MedicationRequest: Each medicine prescribed
- Dosage: Strength, frequency, route
- Performer: Dispensing info (if available)
8. Middleware Gateway Integration
CSNOtk.e-atria.in Gateway
Purpose: Acts as bridge between HMS and ABDM sandbox.
Key Features:
- ABHA validation proxy
- Consent request relay
- FHIR bundle routing
- SNOMED CT terminology service
Authentication:
- Bearer token required in
BRIDGE_SYNC_TOKEN - Source code (HFR/Client ID) in headers
- TLS 1.2+ required
Endpoints Exposed:
POST /api/bridge/abha/validate
POST /api/bridge/consent/request
POST /api/bridge/consent/status
POST /api/bridge/bundle/push
GET /api/bridge/bundle/{bundleId}/status
GET /csnoserv/search/suggest?term=<query>
9. Testing Credentials (Sandbox)
Contact ABDM Sandbox Support:
- Website: https://sandbox.abdm.gov.in
- Portal: Login with your organization credentials
- Test Patients: Available in sandbox portal
- Test ABHA Numbers: Examples provided in portal
Sample Test ABHA Numbers
14-0061-0000-0001 (Patient A)
14-0061-0000-0002 (Patient B)
14-0061-0000-0003 (Patient C)
10. Permissions & Access Control
User roles required for ABDM operations:
'abdm.access' => 'Can view ABDM module',
'abdm.taskboard.access' => 'Can access ABDM task board',
'abdm.gateway.use' => 'Can run ABDM gateway actions',
Recommended Role: Admin, Doctor, ABDM Coordinator
11. Troubleshooting
Issue: ABHA Validation Fails
Cause: Middleware unreachable or credentials invalid Fix:
- Check
BRIDGE_SYNC_URLis correct - Verify
BRIDGE_SYNC_TOKENwith middleware provider - Check firewall/proxy allows outbound HTTPS
Issue: Consent Request Stuck in "Pending"
Cause: Patient hasn't accepted in sandbox portal Fix:
- Log into ABDM sandbox portal
- Navigate to "Consent Requests"
- Manually accept request for testing
- System polls for status updates
Issue: FHIR Bundle Rejected
Cause: Missing required SNOMED codes or invalid structure Fix:
- Ensure diagnosis has SNOMED ID (not just text)
- Ensure vitals in proper FHIR units (mmHg, BPM, etc.)
- Check bundle in
/logsfor validation errors
12. Next Steps
- Set Bearer Token: Contact ABDM/middleware provider to get
BRIDGE_SYNC_TOKEN - Configure HFR/NPI IDs: Update
.envwith your facility identifiers - Create Test User: Register test user in ABDM sandbox portal
- Test ABHA Linking: Use test ABHA from sandbox portal
- Run Consent Flow: Test full consent → push workflow
- Verify FHIR Bundles: Check generated bundles in database logs
13. Reference Documentation
- ABDM Official Docs: https://sandbox.abdm.gov.in/sandbox/v3/new-documentation
- FHIR R4 Spec: http://hl7.org/fhir/R4
- NHA Integration Guide: https://nha.gov.in/abdm/guidelines
- Local Implementation: app/Controllers/AbdmGateway.php
Last Updated: May 12, 2026
Maintained By: HMS Development Team