An open API service indexing awesome lists of open source software.

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.

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

---