Enterprise Hospital Management Information System with Dual-Mode Physical & Digital NFC Card Integration
Executive Summary:
Cura. HMS is an end-to-end clinical hospital management system engineered to modernize healthcare administration. Featuring an Apple-inspired Liquid Glass user interface, asynchronous microservices architecture, and browser-native dual-mode RFID/NFC hardware connectivity, Cura eliminates manual terminal input by enabling immediate patient identification via physical MyKad/CUID smart cards and Android Host Card Emulation (HCE).
- π¬π§ English Documentation (Current)
- π²πΎ Dokumentasi Bahasa Melayu
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLIENT TIERS & SENSORS β
ββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββ€
β DESKTOP WORKSTATION β MOBILE CLIENTS β
β Google Chrome / Edge (Blink) β Android Chrome β Android Smartphone β
β Web Serial API (USB) β Web NFC (NDEF) β Flutter (cura_app) β
ββββββββββββββββββββ¬ββββββββββββββββββββ΄βββββββββββββββ¬ββββββββββββββ΄βββββββββββ¬ββββββββββ
β β β
βΌ (115200 Baud CDC) βΌ (Direct Tag Poll) β HCE APDU
ββββββββββββββββββββββββββββββββββββββββ β β (AID F222222222)
β ESP32-S3 EMBEDDED CONTROLLER β β β
β Native USB CDC + HID Keyboard β β βΌ
β I2C Bus (SDA: GPIO8, SCL: GPIO9)β β ββββββββββββββββββββ
β β β β β PN532 Transceiverβ
β βΌ β β β (ISO-DEP Reader) β
β Adafruit PN532 Transceiver β β ββββββββββ¬ββββββββββ
β (Mifare CUID Gen1a/2 Block 0 Write)β β β
ββββββββββββββββββββ¬ββββββββββββββββββββ β β
β Raw UID / Token Stream β β
βΌ βΌ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ΄ββββββββββ
β REVERSE PROXY & SECURITY LAYER β
β Nginx Proxy Manager / Frontend Gateway (Port 80/8087) + Strict Permissions β
ββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββ
β REST API (JSON / Axios)
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FASTAPI BACKEND SERVICES β
β FastAPI (Python 3.12, Uvicorn) β’ Request-ID Tracing β’ CORS β’ Async SQLAlchemy 2.0 β
β Auth β’ Patients β’ Doctors β’ Pharmacy β’ Laboratory β’ Clinical Records β’ Operations β
ββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββ
β Asyncpg Pool (Internal DNS: cura_db:5432)
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PERSISTENT DATABASE β
β PostgreSQL 16 Engine β’ UUID Primary Keys β’ Asia/Kuala_Lumpur β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
The terminal scanning station utilizes an ESP32-S3 Dev Module interfaced with an Adafruit PN532 NFC/RFID transceiver module over native I2C.
- π Download Printable Schematic PDF:
Schematic_cura_2026-10-31.pdf - π Detailed Wiring & Pinout Guide:
esp32_nfc/PINOUT_AND_WIRING.md - π Firmware Flashing Guide:
esp32_nfc/FLASHING_AND_SETUP.md
| ESP32-S3 MCU Pin | PN532 Module Pin | Signal Description | Electrical Specifications |
|---|---|---|---|
| GPIO 8 | SDA |
I2C Serial Data Bus | 3.3V Logic Level (Internal Pull-Up) |
| GPIO 9 | SCL |
I2C Serial Clock Bus | 3.3V Logic Level (Internal Pull-Up) |
| GPIO 4 | IRQ |
Hardware Interrupt Request | Active-Low Digital Signal |
| GPIO 5 | RSTPD_N (RST) |
Hardware Reset Line | Active-Low Digital Output |
| 3.3V / 5V | VCC |
Module Main Power Rail | 3.3V DC (Recommended) / 5.0V DC |
| GND | GND |
Common Ground | 0V Reference |
| USB D- (GPIO 19) | Type-C USB Port | USB 2.0 Differential Data Negative | Full-Speed Native USB Controller |
| USB D+ (GPIO 20) | Type-C USB Port | USB 2.0 Differential Data Positive | Full-Speed Native USB Controller |
Important DIP Switch Setting: Set PN532 hardware switches to I2C Mode (SEL0 = 1 (High), SEL1 = 0 (Low)).
- Dual-Mode Identification Architecture:
- Physical Smart Cards: Scans standard 4-byte Mifare UID, CUID cards, and Malaysian Government MyKad RFID chip UIDs (
CF289949). - Android Host Card Emulation (HCE): Interacts with
cura_appvia custom ISO-DEP APDU commands (SELECT AID F222222222), retrieving virtual patient identification tokens directly from patient smartphones.
- Physical Smart Cards: Scans standard 4-byte Mifare UID, CUID cards, and Malaysian Government MyKad RFID chip UIDs (
- CUID Block 0 Programming Engine:
- Universal block zero write routine executing Gen2 backdoor unlock commands with an automatic fallback to Gen1a APDU sequences (
0x40,0x43). - Enables clinicians to write formatted patient identifiers (
C00A0001) onto physical cards straight from the web browser via Web Serial.
- Universal block zero write routine executing Gen2 backdoor unlock commands with an automatic fallback to Gen1a APDU sequences (
- Deterministic Sequential ID Generation:
- Centralized backend ID generator (
core/idgen.py) maintaining synchronous entity prefix spaces:- Patients:
C00A0001-C00A9999 - Medical Practitioners:
C01A0001-C01A9999 - Prescriptions:
C02A0001, Lab:C03A0001, Vitals:C04A0001, Records:C05A0001
- Patients:
- Centralized backend ID generator (
- Device-Aware Operational Gateway:
- Client-side runtime detection (
useDevice.js) ensuring hardware capabilities match terminal operating systems (disabling serial triggers on mobile handsets and locking mobile-only Web NFC sensors on desktop browsers).
- Client-side runtime detection (
- Patient Re-Admission Lifecycle:
- Preserves patient medical history and hardware UID index integrity across multiple hospital stays without generating orphaned or duplicated records.
.
βββ logo.svg # Vector project emblem
βββ favicon.svg # Minimalist C. SVG favicon
βββ favicon.ico # Multi-resolution desktop favicon
βββ og-image.png # Social link preview banner (1200x630)
βββ Schematic_cura_2026-10-31.png # Hardware circuit wiring graphic
βββ Schematic_cura_2026-10-31.pdf # Vector schematic printable document
βββ README.md # Primary system documentation (English)
βββ README_MY.md # Primary system documentation (Bahasa Melayu)
βββ LICENSE # Educational usage agreement
β
βββ cura_web/ # CORE WEB APPLICATION (DOCKER)
β βββ README.md # Web stack technical overview
β βββ README_MY.md # Web stack technical overview (Bahasa Melayu)
β βββ API_DOCUMENTATION.md # Comprehensive REST API specifications
β βββ API_DOCUMENTATION_MY.md # REST API specifications (Bahasa Melayu)
β βββ DOCKER_AND_SERVICES.md # Container topology & deployment guide
β βββ DOCKER_AND_SERVICES_MY.md # Container deployment (Bahasa Melayu)
β βββ SECURITY_AND_ARCHITECTURE.md # Cryptography, auth & security architecture
β βββ SECURITY_AND_ARCHITECTURE_MY.md # Security architecture (Bahasa Melayu)
β βββ docker-compose.yml # 3-tier microservice orchestration
β βββ .env.example # Template environment configuration
β β
β βββ backend/ # FASTAPI APPLICATION (PYTHON 3.12)
β β βββ Dockerfile # Async Python container runtime
β β βββ requirements.txt # Pinned production dependencies
β β βββ app/
β β βββ main.py # API entrypoint, migrations & lifespan
β β βββ core/ # Database engine, security & middleware
β β βββ models/ # SQLAlchemy ORM database schemas
β β βββ routers/ # Domain endpoints (patients, doctors, etc.)
β β βββ schemas/ # Pydantic request/response validation models
β β
β βββ frontend/ # VUE 3 CLIENT DASHBOARD (VITE + NGINX)
β βββ Dockerfile # Multi-stage production Nginx image
β βββ nginx.conf # Gateway config & Web NFC permissions
β βββ vite.config.js # Vite configuration & asset hashing
β βββ index.html # Entry HTML with structured JSON-LD & meta
β βββ public/ # Static icons, robots.txt, sitemap, llms.txt
β βββ src/
β βββ App.vue # Liquid glass layout shell & corner badge
β βββ stores/ # Pinia reactive state (serial, theme)
β βββ composables/ # Reusable sensor & dialog hooks
β βββ components/ # Dual-mode scan bars & write buttons
β βββ views/ # Clinical page components
β
βββ cura_app/ # PATIENT MOBILE APP (FLUTTER)
β βββ README.md # Flutter HCE card emulator guide
β βββ README_MY.md # Flutter HCE guide (Bahasa Melayu)
β βββ lib/ # Dart application source & UI widgets
β βββ android/ # Native Kotlin HostApduService & AID config
β
βββ esp32_nfc/ # HARDWARE TERMINAL FIRMWARE
βββ README.md # Embedded hardware system guide
βββ README_MY.md # Hardware guide (Bahasa Melayu)
βββ PINOUT_AND_WIRING.md # Electrical pinout & schematic analysis
βββ PINOUT_AND_WIRING_MY.md # Electrical pinout (Bahasa Melayu)
βββ FLASHING_AND_SETUP.md # Toolchain installation & flashing guide
βββ FLASHING_AND_SETUP_MY.md # Toolchain guide (Bahasa Melayu)
βββ esp32_s3_scanner/
βββ esp32_s3_scanner.ino # Dual-mode CUID + HCE Arduino C++ firmware
Ensure Docker and Docker Compose are installed on your host system:
# Navigate to web root
cd cura_web
# Create production environment file from template
cp .env.example .env
# Build and start services
docker compose up --build -dAccess clinical terminals:
- Web Dashboard:
http://localhost:8087 - Interactive API Documentation:
http://localhost:8800/docs - Default Administrator:
admin@mail.com|Password@123
- Open Arduino IDE and install the
Adafruit PN532library. - Open
esp32_nfc/esp32_s3_scanner/esp32_s3_scanner.ino. - Set Tools
$\rightarrow$ Board toESP32S3 Dev Module. - Set Tools
$\rightarrow$ USB CDC On Boot toEnabled. - Connect your board via USB and upload the sketch.
- Connect the terminal via Google Chrome / Edge on desktop and pair via Settings
$\rightarrow$ Connect Scanner.
- Developed for Educational Purposes Only.
