MindFlow is designed to meet India's ABDM (Ayushman Bharat Digital Mission) requirements as both a Health Information Provider (HIP) and Health Information User (HIU). All health record sharing requires patient-initiated consent and is logged immutably.
Patients (from the portal) or staff (from the patient record) can create a new 14-digit ABHA number using Aadhaar-based or mobile-OTP verification. The flow calls the official NHA ABDM v3 API via api/abha_auth.php.
Patients with an existing ABHA number can link it to their clinic record. The link is stored in the patients table (abha_id column) and in abha_health_records for the fetched profile data.
abha_otp_sessions tracks in-progress ABHA verification sessions (transaction ID, mobile, expiry) — required because the ABDM API is multi-step and the session state must be maintained server-side between steps.
abha_audit_log records every ABDM API call made on behalf of a patient (action, transaction ID, ABHA address, timestamp, staff user ID). Queryable by clinic admins for compliance review.
abha_consents stores each consent artefact (consent ID, grant/revoke status, purpose, date range, data types consented, expiry). Consent grant triggers a health record fetch (HIU role); consent revoke immediately stops any further sharing.
On a valid consent, includes/abdm_client.php (or the newer includes/eka_abha_client.php for ABDM v3) fetches FHIR bundles from the patient's other registered facilities and stores them in abha_fetched_records. Fetched records are visible in the patient's record in the main app.
When a patient consents to share their records from this clinic to another facility, the FHIR builder (includes/fhir_builder.php) constructs a FHIR Bundle of the relevant records and posts it to the PHR system.
api/abdm_v3_bridge.php handles the newer ABDM v3 callback events (Discovery, LinkConfirm, NotifyOnAddContexts) that differ from the v1/v2 flow. api/abdm_v3_bridge.php also provides a local webhook receiver for the sandbox testing environment.
abdm_v3_callback_log records every inbound ABDM callback for debugging and compliance — especially useful for HIP notifications that must be acknowledged within 7 seconds.
FHIR R4 (4.0.1) — the version required by ABDM's HL7 FHIR Implementation Guide for India.
includes/fhir_builder.php can generate: Patient, Practitioner, Organization, Encounter, Condition (with ICD-11 coding), Observation (vitals, assessment scores), MedicationRequest, DiagnosticReport (lab), AllergyIntolerance, and Bundle. The export page (pages/fhir_export.php) lets admins download a full patient record as a FHIR Bundle JSON.
Diagnoses stored with WHO ICD-11 codes are exported as FHIR Condition resources with coding.system set to the official WHO linearisation URI, as required by the ABDM IG.
abha_hip_keys stores the facility's HIP certificate and private key issued by NHA, encrypted at rest. These are loaded at runtime for signing ABDM API calls. Key rotation is handled via the admin UI without downtime.
includes/abdm_client.php reads ABDM_ENV from .env to switch between sandbox (sbx.abdm.gov.in) and production (abdm.gov.in) base URLs. No code changes are needed to promote from sandbox to production.
The demo has real sample data — appointments, patients, prescriptions — so you can explore freely.