Skip to content
cic1337xdaPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Cura. HMS Logo

Cura. HMS

Enterprise Hospital Management Information System with Dual-Mode Physical & Digital NFC Card Integration

Architecture Database Hardware Protocol Docker Flutter

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).


πŸ“‘ Language Options / Pilihan Bahasa


πŸ›οΈ High-Level System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                                   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             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”Œ Hardware Circuit & Wiring Schematic

The terminal scanning station utilizes an ESP32-S3 Dev Module interfaced with an Adafruit PN532 NFC/RFID transceiver module over native I2C.

Hardware Circuit Schematic


πŸ“Œ Hardware Pinout Table

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)).


πŸš€ Key Features & Algorithmic Highlights

  1. 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_app via custom ISO-DEP APDU commands (SELECT AID F222222222), retrieving virtual patient identification tokens directly from patient smartphones.
  2. 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.
  3. 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
  4. 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).
  5. Patient Re-Admission Lifecycle:
    • Preserves patient medical history and hardware UID index integrity across multiple hospital stays without generating orphaned or duplicated records.

πŸ“‚ Repository Structure Tree

.
β”œβ”€β”€ 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

⚑ Quick Start Guide

1. Web Application Deployment (Docker)

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 -d

Access clinical terminals:

  • Web Dashboard: http://localhost:8087
  • Interactive API Documentation: http://localhost:8800/docs
  • Default Administrator: admin@mail.com | Password@123

2. Hardware Flashing (ESP32-S3)

  1. Open Arduino IDE and install the Adafruit PN532 library.
  2. Open esp32_nfc/esp32_s3_scanner/esp32_s3_scanner.ino.
  3. Set Tools $\rightarrow$ Board to ESP32S3 Dev Module.
  4. Set Tools $\rightarrow$ USB CDC On Boot to Enabled.
  5. Connect your board via USB and upload the sketch.
  6. Connect the terminal via Google Chrome / Edge on desktop and pair via Settings $\rightarrow$ Connect Scanner.

πŸ“œ License

  • Developed for Educational Purposes Only.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages