https://github.com/hq969/healthcare-data-migration-api
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.
https://github.com/hq969/healthcare-data-migration-api
aws-dynamodb dms dynamodb java-17 mysql openapi postgresql spring-boot-3 swagger-ui
Last synced: about 1 month ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/hq969/healthcare-data-migration-api
- Owner: hq969
- License: mit
- Created: 2025-08-30T10:54:15.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-08-30T11:51:55.000Z (10 months ago)
- Last Synced: 2025-09-27T00:30:03.963Z (9 months ago)
- Topics: aws-dynamodb, dms, dynamodb, java-17, mysql, openapi, postgresql, spring-boot-3, swagger-ui
- Language: Java
- Homepage:
- Size: 63.5 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ฅ 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
```bash
git clone https://github.com/hq969/healthcare-data-migration-api.git
cd healthcare-data-migration-api
````
### 2๏ธโฃ Run Database (Postgres via Docker)
```bash
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:
```bash
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:
```bash
# Default (Postgres)
SPRING_PROFILES_ACTIVE=dev
# MySQL
SPRING_PROFILES_ACTIVE=mysql
```
### 4๏ธโฃ Build & Run
```bash
./mvnw clean package
./mvnw spring-boot:run
```
---
## ๐ API Endpoints
Swagger UI available at:
๐ [http://localhost:8080/swagger-ui/index.html](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**:
```bash
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 --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
---