Skip to content

As part of solving data modernization challenges in healthcare, I designed and implemented a complete migration & API system that brings legacy patient data into the cloud with AWS services while enabling hospital operations through a robust API layer.

License

Notifications You must be signed in to change notification settings

hq969/Healthcare-Data-Migration-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

πŸ₯ Healthcare Data Migration & API

This project demonstrates healthcare data migration from a legacy SQL Server database to AWS RDS (PostgreSQL) and DynamoDB using AWS DMS, along with a Spring Boot REST API for managing hospital operations.

It provides:

  • Data Migration templates (aws-dms/) for SQL Server ➝ AWS RDS & DynamoDB.
  • RESTful APIs for Patient Registration, Appointments, and Billing.
  • Audit Logging in DynamoDB for migration and API activity.
  • Database setup with schema + seed data.

πŸš€ Features

  • Spring Boot 3 + Java 17 backend
  • JPA + Hibernate with PostgreSQL/MySQL support
  • AWS SDK v2 (DynamoDB Enhanced Client)
  • Data Migration via AWS DMS (full load + CDC)
  • Swagger/OpenAPI documentation
  • Pre-seeded DB data (schema.sql, data.sql)

πŸ“‚ Project Structure


healthcare-data-migration-api/
│── src/main/java/com/healthcare/
β”‚ β”œβ”€β”€ Application.java # Main Spring Boot entrypoint
β”‚ β”œβ”€β”€ domain/ # Entities: Patient, Appointment, Billing
β”‚ β”œβ”€β”€ dto/ # DTO classes for requests/responses
β”‚ β”œβ”€β”€ repository/ # Spring Data JPA repositories
β”‚ β”œβ”€β”€ service/ # Business services + DynamoDB Audit service
β”‚ β”œβ”€β”€ controller/ # REST controllers
β”‚ β”œβ”€β”€ config/ # AWS DynamoDB config
β”‚ β”œβ”€β”€ dynamodb/ # DynamoDB models (AuditLog)
β”‚ β”œβ”€β”€ exception/ # Exception handling
β”‚ └── mapper/ # DTO ↔ Entity mappers
β”‚
│── src/main/resources/
β”‚ β”œβ”€β”€ application.yml # Spring Boot configuration
β”‚ β”œβ”€β”€ schema.sql # (Optional) Schema definitions
β”‚ └── data.sql # Seed data
β”‚
│── aws-dms/
β”‚ β”œβ”€β”€ dms-endpoints.json # Example source/target endpoint config
β”‚ β”œβ”€β”€ dms-task-settings.json # Example migration task (Full load + CDC)
β”‚ └── aws-cli-example.md # CLI usage examples
β”‚
│── pom.xml # Maven dependencies
│── README.md # Project documentation


πŸ› οΈ Tech Stack

  • Java 17, Spring Boot 3
  • Spring Data JPA
  • PostgreSQL / MySQL (RDS target DB)
  • AWS DynamoDB (Audit logs)
  • AWS DMS (Data Migration Service)
  • Swagger UI (OpenAPI)

βš™οΈ Setup Instructions

1️⃣ Clone Repo

git clone https://github.com/hq969/healthcare-data-migration-api.git
cd healthcare-data-migration-api

2️⃣ Run Database (Postgres via Docker)

docker run --name healthcare-db -e POSTGRES_USER=healthcare -e POSTGRES_PASSWORD=healthcare -e POSTGRES_DB=healthcare -p 5432:5432 -d postgres:15

For MySQL instead:

docker run --name healthcare-mysql -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=healthcare -e MYSQL_USER=healthcare -e MYSQL_PASSWORD=healthcare -p 3306:3306 -d mysql:8

3️⃣ Configure Application

Edit src/main/resources/application.yml to set DB credentials and AWS region/table.

Switch DB profiles:

# Default (Postgres)
SPRING_PROFILES_ACTIVE=dev

# MySQL
SPRING_PROFILES_ACTIVE=mysql

4️⃣ Build & Run

./mvnw clean package
./mvnw spring-boot:run

πŸ“– API Endpoints

Swagger UI available at: πŸ‘‰ http://localhost:8080/swagger-ui/index.html

Method Endpoint Description
GET /api/patients Get all patients
POST /api/patients Create new patient
GET /api/appointments Get all appointments
POST /api/appointments Schedule appointment
GET /api/billings Get billing records
POST /api/billings Create new billing entry

☁️ AWS DMS Setup

  1. Create replication instance in AWS DMS.

  2. Configure endpoints:

    • aws-dms/dms-endpoints.json
    • Update hostnames, ports, usernames, and passwords.
  3. Create replication task using:

    • aws-dms/dms-task-settings.json
  4. Run with CLI:

aws dms create-endpoint --cli-input-json file://aws-dms/dms-endpoints.json
aws dms create-replication-task --cli-input-json file://aws-dms/dms-task-settings.json
aws dms start-replication-task --replication-task-arn <TASK_ARN> --start-replication-task-type start-replication

Detailed commands are in aws-dms/aws-cli-example.md.


πŸ”Ž Verification

  • Connect to RDS PostgreSQL and check patients, appointments, billings tables.
  • Check DynamoDB audit logs for migration activity.
  • Test REST APIs with Swagger UI.

πŸ§ͺ Example DB Seed

After startup, DB is preloaded with:

  • Patient: Asha Verma (MRN1001)
  • Appointment: Cardiology with Dr. Smith
  • Billing: β‚Ή1200.50 pending

πŸ“Œ Next Steps

  • Add authentication & JWT security
  • Extend modules: pharmacy, lab results
  • Set up CI/CD pipeline for AWS deployment

πŸ‘¨β€πŸ’» Author

Harsh Sonkar AWS Engineer | Data Engineer | Full-Stack Developer


About

As part of solving data modernization challenges in healthcare, I designed and implemented a complete migration & API system that brings legacy patient data into the cloud with AWS services while enabling hospital operations through a robust API layer.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages