# Intelligent Healthcare Data Interoperability Platform

A cloud-native healthcare interoperability solution built using .NET 8, React, SMART on FHIR, Medplum, PostgreSQL, and AWS.

---

# Table of Contents

1. Introduction
2. Project Overview
3. Business Use Case
4. System Architecture
5. Technology Stack
6. Features
7. Supported Resources
8. Authentication Flow
9. Validation Framework
10. Synchronization Engine
11. AWS Infrastructure
12. Folder Structure
13. Installation
14. Configuration
15. Running the Application
16. API Documentation
17. Security
18. Monitoring and Logging
19. Future Enhancements

---

# Introduction

Healthcare data is often stored across multiple Electronic Health Record systems. This project enables retrieval, validation, normalization, synchronization, and storage of FHIR resources using standard healthcare interoperability protocols.

The platform is designed using modern cloud-native architectural principles to support scalable, secure, and maintainable healthcare integrations.

---

# Project Overview

The application retrieves patient healthcare information from SMART on FHIR compliant EHR systems and synchronizes validated records into Medplum FHIR Server.

The platform supports:

- SMART on FHIR Authorization
- OAuth2 Authentication
- Resource Validation
- Data Normalization
- Medplum Integration
- AWS Deployment
- Audit Logging
- Resource Synchronization

---

# Business Use Case

Healthcare organizations require:

- Centralized patient records
- Standardized healthcare data exchange
- Secure patient data access
- Interoperability between systems
- Improved clinician workflows

This platform addresses each of these requirements.

---

# High-Level Architecture

```text
+------------------------------------------------+
|               EHR Systems                      |
|          Epic / Cerner / Sandbox               |
+----------------------+-------------------------+
                       |
                       |
               SMART on FHIR
                       |
                       |
                       V

+------------------------------------------------+
|              React TypeScript UI               |
+------------------------------------------------+
                       |
                       |
                       V

+------------------------------------------------+
|                .NET 8 API Layer                |
+------------------------------------------------+
             |          |           |
             |          |           |
             V          V           V

     Validation    Sync Engine   Audit Logs
       Service

             |
             |
             V

+------------------------------------------------+
|              Medplum FHIR Server               |
+------------------------------------------------+
                       |
                       |
                       V

+------------------------------------------------+
|                PostgreSQL DB                   |
+------------------------------------------------+

                       |
                       |
                       V

+------------------------------------------------+
|                   AWS Cloud                    |
+------------------------------------------------+
```

---

# Technology Stack

## Frontend

- React
- TypeScript
- Vite
- SMART Client JS

## Backend

- ASP.NET Core .NET 8
- REST APIs
- Dependency Injection
- FluentValidation

## Authentication

- OAuth 2.0
- OpenID Connect
- SMART on FHIR

## Healthcare Standards

- FHIR R4
- SMART on FHIR

## FHIR Server

- Medplum

## Database

- PostgreSQL

## Cloud

- AWS

## Monitoring

- CloudWatch
- Application Logging

---

# Features

## SMART Launch

Launch directly inside EHR systems.

## Authorization Code Flow

Secure OAuth authentication.

## FHIR Resource Retrieval

Retrieve patient healthcare resources.

## Resource Validation

Validate incoming resource data.

## Resource Normalization

Automatically fix supported data issues.

## Medplum Synchronization

Store resources in Medplum.

## Audit Logging

Track all operations.

## Cloud Deployment

Deploy using AWS infrastructure.

---

# Supported FHIR Resources

- Patient
- Observation
- Encounter
- Condition
- Procedure
- MedicationRequest
- AllergyIntolerance
- Immunization
- Practitioner
- Organization
- DiagnosticReport
- CarePlan

---

# SMART on FHIR Authorization Flow

```text
User Launches Application
            |
            V

Smart Launch Context

            |
            V

Authorization Request

            |
            V

User Authentication

            |
            V

Authorization Code

            |
            V

Access Token

            |
            V

FHIR API Access
```

---

# Validation Framework

The validation framework ensures resource quality before persistence.

## Example Validations

### Patient

- Identifier Required
- Name Required
- Gender Validation
- BirthDate Validation

### Observation

- Status Required
- Code Required
- Subject Required

### Encounter

- Status Required

### Condition

- ClinicalStatus Required

### MedicationRequest

- Intent Required
- Status Required

### AllergyIntolerance

- ClinicalStatus Validation

---

# Synchronization Workflow

```text
Fetch Resource

     |
     V

Validate Resource

     |
     V

Normalize Resource

     |
     V

Transform Resource

     |
     V

Sync to Medplum

     |
     V

Persist Result

     |
     V

Generate Audit Log
```

---

# Database Design

## PostgreSQL

Main tables:

- Users
- AuditLogs
- SyncHistory
- ResourceMetadata

## Medplum

Stores:

- FHIR Resources
- Resource History
- Version Records

---

# AWS Infrastructure

## Frontend

- Amazon S3
- Amazon CloudFront

## Backend

- Amazon ECS
- Docker Containers

## Database

- Amazon RDS PostgreSQL

## Security

- IAM
- Secrets Manager

## Monitoring

- CloudWatch

## Networking

- Amazon VPC

---

# Security Features

- OAuth2 Authentication
- SMART Authorization
- JWT Validation
- Secure HTTPS
- Environment-Based Secrets
- Role-Based Access Control
- AWS IAM Security Policies

---

# Project Structure

```text
project-root/

frontend/
│
├── src/
├── pages/
├── components/
├── services/
├── hooks/
├── App.tsx
│
backend/
│
├── Controllers/
├── Services/
├── Validators/
├── Authentication/
├── Repositories/
├── Models/
├── Configurations/
├── Program.cs
│
deployment/
│
├── aws/
├── docker/
├── terraform/
│
documentation/
│
├── architecture
├── diagrams
├── api-docs
│
README.md
```

---

# Prerequisites

- .NET 8 SDK
- Node.js 20+
- PostgreSQL
- Medplum Account
- AWS Account

---

# Installation

## Clone Repository

```bash
git clone <repository-url>
```

## Frontend

```bash
cd frontend
npm install
npm run dev
```

## Backend

```bash
cd backend
dotnet restore
dotnet build
dotnet run
```

---

# Environment Variables

```env
SMART_CLIENT_ID=

SMART_REDIRECT_URI=

FHIR_BASE_URL=

MEDPLUM_BASE_URL=

MEDPLUM_CLIENT_ID=

MEDPLUM_CLIENT_SECRET=

POSTGRES_CONNECTION_STRING=

JWT_SECRET=

AWS_REGION=

AWS_ACCESS_KEY_ID=

AWS_SECRET_ACCESS_KEY=
```

---

# Monitoring

The system includes:

- API Logs
- Validation Logs
- Synchronization Logs
- CloudWatch Metrics
- Health Checks
- Error Tracking

---

# CI/CD Pipeline

```text
GitHub Push
      |
      V

Build Application
      |
      V

Run Tests
      |
      V

Docker Build
      |
      V

Deploy to AWS
```

---

# Future Enhancements

- AI Clinical Recommendations
- Real-Time CDS Hooks
- FHIR Bulk Export
- Event Streaming
- Multi-Tenant Support
- Healthcare Analytics Dashboard
- AWS Bedrock Integration
- Generative AI Assistant

---

# Author

Himanshu Agrawal

Lead Engineer - I

CitiusTech

FHIR Academy Capstone Project

---

# Acknowledgements

- HL7 FHIR Community
- SMART Health IT
- Medplum
- AWS
- CitiusTech
- FHIR Academy

---

# License

This project is developed for educational, research, and healthcare interoperability demonstration purposes.