Skip to content

Latest commit

 

History

249 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clinical Data De-Identification Backend

NestJS MySQL AWS Docker

Backend service for clinical document de-identification and synthetic data generation.

The application provides secure document processing, PII detection and anonymization, compliance framework management, synthetic data generation, user authentication, subscription management, and analytics support.

Supported Compliance Frameworks

  • HIPAA (US)
  • EU GDPR
  • UK GDPR
  • Swiss FADP

The platform leverages Microsoft Presidio for automated detection and anonymization of personally identifiable information (PII) within clinical documents.


Technology Stack

Core

  • NestJS
  • TypeScript
  • TypeORM
  • MySQL

Authentication

  • JWT Authentication
  • Google OAuth
  • Microsoft OAuth
  • Magic Link Authentication

Data Privacy

  • Microsoft Presidio

Infrastructure

  • Docker
  • AWS S3
  • Heroku

Documentation

  • Swagger

Database Schema

DB schema


API Documentation

Local

http://localhost:3000/api

Production

https://green-anonymization-be-602a891d18c3.herokuapp.com/api

Project Setup

Install Dependencies

npm install

Set Up .env File

Refer to .env.example


Infrastructure Setup

First Time Setup

Install Docker

Download and install Docker:

https://www.docker.com/get-started/

Ensure Docker is running before proceeding.

Create & Start Infrastructure

npm run infrastructure:up

Run Database Migrations

npm run migration:run

Start the Application

npm run start

Subsequent Setups (Infrastructure Already Exists)

Start Infrastructure

npm run infrastructure:start

Migrations are already in place, no need to run them again.

All data persists from previous sessions.

Start the Application

npm run start

Infrastructure Management

Pause Infrastructure (data persists)

npm run infrastructure:stop

Fully Delete Infrastructure (removes all data)

npm run infrastructure:down

Important Notes

Ensure all ports defined in your .env file are not in use by other processes before starting the infrastructure.

Check your .env file for configured ports:

  • DB_PORT
  • PRESIDIO_ANALYZER_PORT
  • PRESIDIO_ANONYMIZER_PORT

If these ports are already occupied, update both .env and compose.yml.


Compile and Run the Project

Development

npm run start

Watch Mode

npm run start:dev

Production Mode

npm run start:prod

Run Tests

Unit Tests

npm run test

E2E Tests

npm run test:e2e

Test Coverage

npm run test:cov

Main Modules

  • Authentication
  • Users
  • Documents
  • PII Entities
  • Compliance Frameworks
  • Synthetic Data Generation
  • Subscription Plans
  • Contact Messages
  • Analytics

Deployment

Production Environment

  • Heroku
  • AWS S3
  • MySQL

Build

npm run build

Production Start

npm run start:prod

Rate Limiting

All endpoints are protected by rate limiting to prevent abuse.

Global Rules

  • 100 requests per hour per IP address
  • Limits are tracked per IP address

Rate Limit Response

{
  "statusCode": 429,
  "message": "Too Many Requests"
}

Some endpoints may have stricter limits.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages