Skip to content

Redix-International-Inc/redix-client-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Redix Healthcare Data Conversion Platform

Complete Healthcare Data Conversion Platform with REST API Server and Python Client SDK

The Redix Healthcare Data Conversion Platform offers a comprehensive solution for converting healthcare data between EDI X12, HL7, HIPAA, XML, CSV, PDF, and other formats. Built with FastAPI, it includes a production-ready REST API server and a Python client SDK for seamless integration.

πŸ₯ Platform Components

1. FastAPI REST API Server Software

  • Production-ready ASGI application with interactive Swagger UI at /docs
  • Real-time batch processing with SQLite-based job tracking
  • File staging, lifecycle management, and automatic archiving
  • Configurable conversion profiles for different healthcare formats
  • Prometheus metrics integration and comprehensive logging

2. Python Client SDK

  • Full-featured synchronous client library with comprehensive error handling
  • Type hints and extensive documentation for easy integration
  • Support for all server endpoints and healthcare data formats

3. Batch Processing Engine

  • Asynchronous file processing with background task management
  • Real-time progress monitoring and detailed logging
  • Automatic file archiving and error recovery

Note: Redix provides software tools and platforms. Customers deploy and operate their own secure cloud services for processing real healthcare data with full control over data privacy and HIPAA compliance.

πŸš€ Quick Start

Server Installation

# Install the platform
pip install redix-client

# Set up configuration
cp shared/redix_cloud.conf.example redix_cloud.conf
# Edit redix_cloud.conf with your Redix engine path and working directories

# Run the API server
python -m redix_api
# or
uvicorn redix_api:app --host 0.0.0.0 --port 8000

Client SDK Usage

from redix_client import RedixClient

# Initialize client
client = RedixClient(api_url="http://localhost:8000", api_key="your-api-key")

# Upload and convert a file
upload_result = client.upload_to_staging("claim_data.edi")
conversion = client.convert_staging_file(
    staged_filename=upload_result["filename"],
    config_profile="x12_837P_default_profile"
)
print(f"Converted: {conversion['filename_base']}")

# Start batch processing
batch = client.batch_convert_folder(
    input_subfolder="claims_batch",
    config_profile="x12_837P_default_profile"
)

# Monitor progress
status = client.get_batch_status(batch["job_id"])
print(f"Status: {status['status']} - {status['files_processed']}/{status['total_files_found']}")

πŸ“– Interactive API Documentation

Once the server is running, access comprehensive API documentation:

Features include:

  • Complete API reference with try-it-now functionality
  • Request/response examples for all endpoints
  • Authentication testing and parameter validation

πŸ”’ Public Demo vs. Production Use

⚠️ IMPORTANT PRIVACY NOTICE:

  • Demo Site (https://redix.com/docs): For demonstration and testing only. DO NOT submit real HIPAA data or confidential information. Redix is not responsible for data privacy on the demo site.
  • Production Use: Deploy your own secure server using this platform for processing real healthcare data. You maintain full control and responsibility for data privacy and HIPAA compliance.

πŸ›  Installation & Setup

Prerequisites

  • Python 3.9 or higher
  • Redix Engine installed at configured path
  • 2GB+ disk space for processing files

Installation Options

# Install from PyPI
pip install redix-client

# Development installation
git clone https://github.com/Redix-International-Inc/redix-client-py.git
cd redix-client-py
pip install -e .

Configuration

The server requires redix_cloud.conf for configuration. See shared/redix_cloud.conf.example in this repository for a complete example with healthcare-specific conversion profiles.

πŸ”„ Python Client SDK Reference

File Operations

# Upload and manage staging files
upload_result = client.upload_to_staging("path/to/file.edi")
staging_files = client.list_staging_files()
client.delete_from_staging("filename.edi")

# List server files and profiles
server_files = client.list_server_files(path="subfolder")
profiles = client.list_staging_profiles()

Single File Conversion

# Convert staged file with profile
result = client.convert_staging_file(
    staged_filename="input.edi",
    config_profile="x12_837P_default_profile",
    user_data="custom_identifier"
)

# Convert with direct file upload
result = client.convert_file_upload(
    input_file="input.edi",
    ifd_file="format.ifd",
    ofd_file="output.ofd",
    conversion_flag="x",  # X12 format
    warning_level=1       # Continue with warnings
)

Batch Processing

# Start batch job
batch = client.batch_convert_folder(
    input_subfolder="daily_claims",
    config_profile="x12_837P_default_profile",
    output_subfolder="processed_claims"
)

# Monitor batch progress
status = client.get_batch_status(batch["job_id"])

# List and filter batch jobs
jobs = client.list_batch_jobs(
    status="COMPLETED",
    config_profile="x12_837P_default_profile",
    limit=50
)

# Get batch statistics
summary = client.get_batch_jobs_summary(
    start_date="2025-08-01",
    end_date="2025-08-31"
)

# Retrieve batch logs with filtering
logs = client.get_batch_job_logs(
    job_id=batch["job_id"],
    log_level="ERROR",
    limit=100
)

# Get detailed file information
file_detail = client.get_batch_file_detail(
    job_id=batch["job_id"],
    filename="claim_001.edi"
)

File Access and Download

# Download processed files
client.download_generated_file(
    file_type="output",
    filename="converted_file.txt",
    local_path="./downloads/"
)

# View file content
content = client.view_generated_file(
    file_type="output",
    filename="converted_file.txt"
)
print(content["content"])

# Access different file types: input, output, error, ack, ta1, staging, shared, archive

System Information

# Check API health
health = client.health_check()
print(f"Status: {health['status']}, Engine: {health['redix_engine_status']}")

# Get engine and system info
info = client.get_engine_info()
print(f"Platform: {info['platform']}, Base Directory: {info['base_work_dir']}")

# Get form options for UI integration
options = client.get_form_options()
profiles = options["staging_profiles"]

πŸ₯ Healthcare Use Cases

Professional Claims Processing (837P)

# Process 837P professional claims
result = client.convert_staging_file(
    staged_filename="claims_837p.edi",
    config_profile="x12_837P_default_profile"
)

Enrollment Processing (834)

# Process 834 enrollment files
result = client.convert_staging_file(
    staged_filename="enrollment_834.edi",
    config_profile="rmap_834_to_834"
)

Institutional Claims to PDF (837I)

# Convert institutional claims to UB04 PDF format
result = client.convert_staging_file(
    staged_filename="institutional_837i.edi",
    config_profile="837i_to_ub04_pdf"
)

Daily Batch Processing

# Process daily claims batch with monitoring
batch = client.batch_convert_folder(
    input_subfolder="daily_claims_20250802",
    config_profile="x12_837P_default_profile",
    output_subfolder="processed_20250802"
)

# Monitor until completion
while True:
    status = client.get_batch_status(batch["job_id"])
    if status["status"] in ["COMPLETED", "COMPLETED_WITH_ERRORS", "FAILED"]:
        break
    print(f"Progress: {status['files_processed']}/{status['total_files_found']}")
    time.sleep(10)

print(f"Final Status: {status['status']}")
print(f"Successful: {status['successful_files']}, Failed: {status['failed_files']}")

πŸ›‘οΈ Error Handling

from redix_client import RedixAPIError

try:
    result = client.convert_staging_file(
        staged_filename="invalid_file.edi",
        config_profile="x12_837P_default_profile"
    )
except RedixAPIError as e:
    print(f"API Error {e.status_code}: {e.message}")
    
    # Handle specific error scenarios
    if e.status_code == 404:
        print("File not found in staging area")
    elif e.status_code == 400:
        print("Invalid request parameters")
    elif e.status_code == 500:
        print("Server processing error")
except Exception as e:
    print(f"Unexpected error: {e}")

πŸ”§ Server Deployment

For production server deployment, monitoring setup, Docker configuration, and performance tuning, see SERVER_SETUP.md.

πŸ“Š Monitoring & Performance

  • Prometheus Metrics: Automatically exposed at /metrics endpoint
  • Health Monitoring: Built-in health checks and engine status reporting
  • Batch Job Tracking: Real-time progress and detailed logging
  • Performance Features: Asynchronous processing, connection pooling, memory-efficient file handling

πŸ§ͺ Testing

# Run all tests
python -m pytest tests/

# Run with coverage
python -m pytest --cov=redix_client tests/

# Integration tests (requires running server)
python -m pytest tests/integration/

πŸ“‹ Configuration Profiles

The platform supports predefined conversion profiles in redix_cloud.conf:

  • x12_837P_default_profile - Professional claims (837P to HIPAA 5010 A1)
  • rmap_834_to_834 - Enrollment files (834 format conversion)
  • 837i_to_ub04_pdf - Institutional claims to PDF format

Each profile includes conversion flags, rule files, and format-specific parameters.

🀝 Contributing

# Development setup
git clone https://github.com/Redix-International-Inc/redix-client-py.git
cd redix-client-py
pip install -e ".[dev]"

# Run tests and formatting
python -m pytest
black redix_client/
isort redix_client/
mypy redix_client/

πŸ“ž Support

🏒 Data Privacy & Compliance

Redix is a software provider, not a cloud service provider.

  • Your Responsibility: You deploy and operate the Redix software on your own secure infrastructure
  • Data Control: You maintain full control and responsibility for all healthcare data processing
  • HIPAA Compliance: Ensure your deployment meets all regulatory requirements for your use case
  • Demo Limitations: The public demo site is for testing only - never submit real patient data or confidential information

πŸ“„ License

MIT License - see LICENSE file for details.

πŸš€ Roadmap

  • WebSocket support for real-time batch updates
  • GraphQL API endpoint for flexible querying
  • Advanced analytics dashboard with healthcare metrics
  • Multi-tenant support for healthcare organizations
  • Enhanced security features and audit logging

Transform your healthcare data processing today! Start with our interactive documentation at /docs or explore the comprehensive examples above.

Releases

No releases published

Packages

No packages published

Languages