AI in Healthcare: Patient Identity Verification with Rekognition and DynamoDB

AI in Healthcare: Patient Identity Verification with Rekognition and DynamoDB

Introduction

This project demonstrates how to design and implement a production-grade, serverless pipeline for patient identification using Amazon Rekognition, API Gateway, AWS Lambda, and DynamoDB. The system enables healthcare providers to register patients with facial images at the point of appointment scheduling and later identify them during check-in by matching faces against a secure collection.

Case study & business challenge 

Enterprise Healthcare – Cleveland Medical Center (CMC).  CMC is rolling out a “home-nearby first” model: remote triage, local clinics, and rapid check-in. The current web appointment portal uses numeric appointment IDs; at busy clinics, staff spend time reconciling IDs with the correct patient, risking delays and occasional mismatches. The ask: augment check-in with face-based identification to (a) speed triage, (b) reduce identity mismatches, and (c) link the correct electronic record at first contact. 

Constraints. Health data and biometrics demand strict governance (privacy, consent, auditability). The PoC must avoid lock-in to expensive components, minimize ongoing cost, and prove an architectural path to production (IAM least privilege, encryption, monitoring, throttling, incident traceability). 

Solution sketch.  Patients provide a face image at registration; at arrival, a new face image is captured. We use Amazon Rekognition Face Collections to index faces at registration and SearchFacesByImage to retrieve the closest match at check-in. Patient demographics and non-biometric metadata live in DynamoDB. The interface is a public API fronted by API Gateway (HTTP API) invoking AWS Lambda. Optional S3 stores originals if you want an audit trail or manual review. All under least-privilege IAM and KMS-backed encryption. 

https://github.com/OluwaTossin/rekognition-patient-id

 Architectural Diagram

Executive Summary (TL;DR)

This project shows how AI can simplify patient check-in at hospitals and clinics. Instead of relying on appointment numbers or ID cards, patients are identified instantly by their face. We built a secure, low-cost system on Amazon Web Services (AWS) that:

  • Registers new patients by storing their photo and details.

  • Recognizes returning patients by matching their face to a record with near-perfect accuracy.

  • Uses Amazon Rekognition (AI facial recognition) to analyze images and DynamoDB (cloud database) to store patient details.

  • Runs entirely on a serverless, pay-as-you-go model with Lambda and API Gateway, making it scalable and affordable.

The project proves how cloud AI can improve efficiency, reduce errors, and enhance patient experience in healthcare without expensive infrastructure.

Data model 

DynamoDB table: cmc_patients

  • PK: patient_id (string, your canonical ID)

  • Attributes: appointment_id, name, dob, phone, face_id (from Rekognition), created_at, updated_at

  • GSI: face_id-index (PK = face_id) for fast lookup by match result.

The table is designed so administrators look up patients by their patient_id, while the system can look up patients by face_id returned from Rekognition. 

Phase 0 — Environment bootstrap 

  • Choose a region you already use.

  • Create a project tag you’ll reuse: Project=cmc-reko-lab, Env=dev. 

  • Set shell defaults: 

Phase 1 — Create the Rekognition Face Collection

verify:

Phase 2 — Create DynamoDB table (on-demand, encrypted) 

Phase 3 — Lambda execution role (least privilege) 

create Trust policy (lambda-trust.json):

Create role:

Create Permissions policy (lambda-policy.json):

Attach:

Phase 4 — Lambda functions (Python 3.12) 

A) register_patient (index face + store record)

register_patient.py:

B) identify_patient (search best match + return record)

identify_patient.py:

Create functions:

Phase 5 — API Gateway (HTTP API) + routes

Create API:

Grant invoke to API for both Lambdas:

Create integrations & routes:

Get invoke URL:

Phase 6 — Test calls

Get your API base URL (if $URL isn’t set from previous steps)

Pick a small JPEG, convert to base64 (registration image)

Register (index)

Identify (check-in) — use a fresh photo of the same person

A) Inline method (works for small images)

B) If you see “Argument list too long”, use a file payload

Expected: the DynamoDB record for the matched patient plus a similarity score.

This result shows that the identify Lambda function worked exactly as intended:

  • statusCode: 200 → The Lambda executed successfully and returned a valid response.

  • body → Contains the patient record retrieved from DynamoDB, enriched with the Rekognition similarity score.

The system successfully matched Ada’s check-in photo with her registered record, confirming her identity with near-perfect confidence 99.99999%. This proves the end-to-end pipeline — API Gateway → Lambda → Rekognition → DynamoDB — is functioning correctly.

Conclusion

This project set out to show how artificial intelligence (AI) can make healthcare processes faster, more accurate, and more patient-friendly. Using Amazon Rekognition, DynamoDB, Lambda, and API Gateway, we built a secure system that can recognize patients by their face when they arrive at a clinic or hospital.

Over six phases, we moved step by step:

  1. Foundation – We created the core cloud resources on AWS and set up the tools we would need to run the project.

  2. Data Model – We designed a simple patient record system where each person’s details could be linked to a unique face identifier.

  3. Access Control – We gave our functions the right permissions so they could talk to Rekognition and DynamoDB safely and securely.

  4. Lambdas – We built two small serverless programs: one for registering new patients with their face images, and another for identifying them during check-in.

  5. API Gateway – We connected everything behind a single entry point so patients or staff could use the system easily through a web or mobile app.

  6. Testing – Finally, we tested the full flow. We registered a patient with a photo, then used a different photo to confirm the system could recognize them correctly. The system responded with the patient’s details and an almost perfect match confidence score.

What this means in practice is simple: instead of relying on paper records or appointment numbers, staff can instantly confirm a patient’s identity using their face. The process is fast, secure, and accurate, while keeping costs very low by using AWS’s pay-as-you-go services.

This end-to-end exercise demonstrates how AI and cloud computing can be applied to real-world healthcare challenges. It reduces administrative friction, improves the patient experience, and sets the stage for more advanced digital health solutions in the future.

To view or add a comment, sign in

Explore topics