Skip to content

Xuccessor/health-care

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

343 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Insurance Provider Management Portal

A comprehensive insurance provider management portal built with Node.js/Express backend and modern frontend, featuring policy management, claims processing, payment handling, and robust audit logging.

πŸš€ Features

Core Features

  • Policy Management: Create, update, and manage insurance policies
  • Claims Processing: Automated claim validation, assessment, and approval workflows
  • Payment Processing: Integrated Stripe and PayPal payment processing
  • Role-Based Access Control (RBAC): Granular permissions for different user roles
  • Audit Logging: Comprehensive logging of all system activities
  • Queue Management: Bull/Redis-based queue system for claim processing
  • Reporting & Analytics: Data aggregation and reporting APIs
  • Dashboard: Real-time dashboard with metrics and visualizations

Security & Compliance

  • JWT-based authentication
  • Password hashing with bcrypt
  • Rate limiting and security headers
  • PII/PHI access tracking
  • Compliance reporting
  • Fraud detection indicators

Payment Integration

  • Stripe: Credit card processing with PaymentIntents
  • PayPal: PayPal payment gateway integration
  • Multiple Methods: Bank transfers, checks, cash
  • Refund Processing: Automated refund workflows

πŸ“‹ Requirements

System Requirements

  • Node.js 16.x or higher
  • MongoDB 4.4 or higher
  • Redis 6.0 or higher (for queue management)

Environment Variables

Create a .env file based on .env.example:

# Database Configuration
MONGODB_URI=mongodb://localhost:27017/insurance_portal

# JWT Configuration
JWT_SECRET=your_super_secret_jwt_key_here
JWT_EXPIRE=7d

# Stripe Configuration
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key
STRIPE_PUBLISHABLE_KEY=pk_test_your_stripe_publishable_key

# PayPal Configuration
PAYPAL_CLIENT_ID=your_paypal_client_id
PAYPAL_CLIENT_SECRET=your_paypal_client_secret
PAYPAL_MODE=sandbox

# Redis Configuration
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=

# Email Configuration
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_email_password

# Server Configuration
PORT=5000
NODE_ENV=development

πŸ› οΈ Installation

  1. Clone the repository
git clone https://github.com/damzempire/health-care.git
cd health-care
  1. Install dependencies
npm install
  1. Set up environment variables
cp .env.example .env
# Edit .env with your configuration
  1. Set up MongoDB
# Make sure MongoDB is running
mongod
  1. Set up Redis
# Make sure Redis is running
redis-server
  1. Start the application
# Development mode
npm run dev

# Production mode
npm start

The application will be available at http://localhost:5000

πŸ—οΈ Architecture

Backend Architecture

β”œβ”€β”€ models/                 # Mongoose models
β”‚   β”œβ”€β”€ User.js            # User model with RBAC
β”‚   β”œβ”€β”€ Policy.js          # Policy management
β”‚   β”œβ”€β”€ Claim.js           # Claims processing
β”‚   β”œβ”€β”€ Payment.js         # Payment processing
β”‚   └── AuditLog.js        # Audit logging
β”œβ”€β”€ routes/                # API routes
β”‚   β”œβ”€β”€ auth.js           # Authentication routes
β”‚   β”œβ”€β”€ policies.js       # Policy management
β”‚   β”œβ”€β”€ claims.js          # Claims processing
β”‚   β”œβ”€β”€ payments.js        # Payment processing
β”‚   β”œβ”€β”€ reports.js         # Reporting APIs
β”‚   └── audit.js           # Audit log APIs
β”œβ”€β”€ middleware/            # Express middleware
β”‚   β”œβ”€β”€ auth.js           # Authentication & authorization
β”‚   β”œβ”€β”€ auditLogger.js    # Audit logging middleware
β”‚   └── errorHandler.js   # Error handling
β”œβ”€β”€ services/              # Business logic services
β”‚   β”œβ”€β”€ queueService.js   # Queue management
β”‚   └── notificationService.js # Notifications
└── server.js             # Express server setup

Frontend Architecture

β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ index.html        # Main dashboard
β”‚   β”œβ”€β”€ css/
β”‚   β”‚   └── dashboard.css # Custom styles
β”‚   └── js/
β”‚       └── dashboard.js  # Frontend JavaScript

πŸ” User Roles & Permissions

Admin

  • Full system access
  • User management
  • System configuration
  • All permissions

Provider

  • Policy management (CRUD)
  • Claims submission and tracking
  • Payment processing
  • Report generation

Agent

  • Policy creation and reading
  • Claims submission
  • Basic payment access

Processor

  • Claims processing and approval
  • Payment processing
  • Report reading

πŸ“Š API Documentation

Authentication

Login

POST /api/auth/login
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "password123"
}

Register

POST /api/auth/register
Content-Type: application/json

{
  "username": "johndoe",
  "email": "john@example.com",
  "password": "password123",
  "role": "provider",
  "profile": {
    "firstName": "John",
    "lastName": "Doe"
  }
}

Policies

Create Policy

POST /api/policies
Authorization: Bearer <token>
Content-Type: application/json

{
  "policyHolder": {
    "firstName": "Jane",
    "lastName": "Doe",
    "contact": {
      "email": "jane@example.com",
      "phone": "555-0123"
    }
  },
  "policyType": "health",
  "premium": {
    "amount": 250.00,
    "frequency": "monthly"
  },
  "term": {
    "startDate": "2024-01-01",
    "endDate": "2024-12-31"
  }
}

Get Policies

GET /api/policies?page=1&limit=10&status=active
Authorization: Bearer <token>

Claims

Create Claim

POST /api/claims
Authorization: Bearer <token>
Content-Type: application/json

{
  "policy": "policy_id",
  "claimant": {
    "name": "John Doe",
    "contact": {
      "email": "john@example.com",
      "phone": "555-0123"
    }
  },
  "incident": {
    "date": "2024-01-15",
    "type": "Medical",
    "description": "Emergency room visit"
  },
  "claimType": "medical",
  "estimatedAmount": 5000.00
}

Process Claim

POST /api/claims/:id/validate
Authorization: Bearer <token>

Payments

Process Premium Payment

POST /api/payments/process-premium
Authorization: Bearer <token>
Content-Type: application/json

{
  "policyId": "policy_id",
  "amount": 250.00,
  "method": "stripe",
  "paymentMethodId": "pm_stripe_id"
}

Create Stripe Payment Intent

POST /api/payments/stripe/create-intent
Authorization: Bearer <token>
Content-Type: application/json

{
  "amount": 250.00,
  "currency": "usd"
}

Reports

Dashboard Statistics

GET /api/reports/dashboard?period=month
Authorization: Bearer <token>

Claims Report

GET /api/reports/claims?startDate=2024-01-01&endDate=2024-01-31&format=excel
Authorization: Bearer <token>

Performance Report

GET /api/reports/performance?period=quarter
Authorization: Bearer <token>

πŸ”„ Queue Processing

The system uses Bull with Redis for queue-based claim processing:

Claim Processing Workflow

  1. Validation Queue: Validates claim against policy terms
  2. Assessment Queue: Automated assessment and fraud detection
  3. Approval Queue: Auto-approval for low-risk claims
  4. Payment Queue: Process approved claim payments

Queue Management

// Add claim to processing queue
await addClaimToQueue(claimId, 'high');

// Get queue statistics
const stats = await getQueueStats();

// Pause/Resume queues
await pauseQueue('claims');
await resumeQueue('claims');

πŸ“ˆ Reporting System

Available Reports

  • Dashboard: Real-time statistics and metrics
  • Claims: Detailed claims analysis
  • Payments: Payment processing reports
  • Performance: System performance metrics
  • Compliance: Audit and compliance reports

Export Formats

  • JSON (API response)
  • Excel (via excel4node)
  • PDF (via PDFKit)

Data Aggregation

// Example aggregation for dashboard stats
const stats = await Claim.aggregate([
  { $match: { createdAt: { $gte: startDate, $lte: endDate } } },
  {
    $group: {
      _id: '$status',
      count: { $sum: 1 },
      totalAmount: { $sum: '$estimatedAmount' }
    }
  }
]);

πŸ” Audit & Compliance

Audit Logging

All user actions are automatically logged with:

  • User information and role
  • Action performed
  • Resource affected
  • Timestamp and IP address
  • Risk level assessment
  • PII/PHI access tracking

Compliance Features

  • Data access pattern analysis
  • High-risk activity monitoring
  • Retention period management
  • Review workflow for critical actions

Audit API Examples

GET /api/audit/logs?startDate=2024-01-01&endDate=2024-01-31
GET /api/audit/high-risk?riskLevel=critical
GET /api/audit/compliance?startDate=2024-01-01&endDate=2024-01-31

πŸ§ͺ Testing

Run Tests

# Run all tests
npm test

# Run with coverage
npm run test:coverage

# Run specific test file
npm test -- tests/auth.test.js

Test Structure

tests/
β”œβ”€β”€ auth.test.js          # Authentication tests
β”œβ”€β”€ policies.test.js      # Policy management tests
β”œβ”€β”€ claims.test.js        # Claims processing tests
β”œβ”€β”€ payments.test.js      # Payment processing tests
└── reports.test.js       # Reporting tests

πŸš€ Deployment

Docker Deployment

# Build image
docker build -t insurance-portal .

# Run with Docker Compose
docker-compose up -d

Production Setup

  1. Set NODE_ENV=production
  2. Configure production database
  3. Set up SSL certificates
  4. Configure reverse proxy (nginx)
  5. Set up monitoring and logging

Environment Variables for Production

NODE_ENV=production
PORT=443
MONGODB_URI=mongodb://prod-mongo:27017/insurance_portal_prod
JWT_SECRET=your_production_secret

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

Code Style

  • Use ESLint for code formatting
  • Follow JavaScript Standard Style
  • Add comments for complex logic
  • Update documentation

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

For support and questions:

πŸ”„ Version History

v1.0.0 (Current)

  • Initial release
  • Core policy and claims management
  • Payment processing integration
  • Audit logging system
  • Dashboard and reporting

Planned Features

  • Mobile app
  • Advanced analytics
  • Machine learning for fraud detection
  • Multi-tenant support
  • Advanced workflow automation

πŸ“Š Performance Metrics

System Requirements

  • Memory: 512MB minimum, 2GB recommended
  • CPU: 1 core minimum, 2 cores recommended
  • Storage: 10GB minimum
  • Network: 1Gbps recommended for high volume

Benchmarks

  • API Response Time: <200ms average
  • Claim Processing: <5 minutes for standard claims
  • Concurrent Users: 1000+ supported
  • Database: Optimized for 1M+ policies

πŸ”’ Security Considerations

Data Protection

  • All sensitive data encrypted at rest
  • PII/PHI access logging
  • Regular security audits
  • Penetration testing

Network Security

  • HTTPS enforced
  • Rate limiting
  • IP whitelisting available
  • DDoS protection

Access Control

  • Multi-factor authentication (planned)
  • Session management
  • Password policies
  • Account lockout protection

Built with ❀️ by Damz Empire

About

Stellar Health is a healthcare technology company that enables value-based care by connecting payors and providers through real-time notifications and incentive programs. They operate across 37+ states, managing 1.2M+ lives and serving 20,000+ providers.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 81.4%
  • Makefile 8.6%
  • Rust 2.8%
  • CSS 2.1%
  • TypeScript 2.1%
  • PLpgSQL 1.7%
  • Other 1.3%