Skip to content

mjkubba/edi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

EDI Parser and Processor for Healthcare X12 Formats in Rust

This project provides a robust Electronic Data Interchange (EDI) parser and processor specifically designed for healthcare X12 formats. It supports multiple transaction sets including 835 (Payment/Remittance Advice), 999 (Implementation Acknowledgment), 270/271 (Eligibility), 276/277 (Claim Status), 278 (Health Care Services Review), 837P/I/D (Claims), and 820 (Health Insurance Exchange Related Payments).

Project Status

πŸ“Š Current Status: See VALIDATION_REPORT.md for comprehensive testing results and current system validation
πŸ“š Implementation Details: See AmazonQ.md for detailed development history and technical architecture

Transaction Set Status Description
EDI835 (Payment/Remittance Advice) βœ… Complete Fully functional with minor formatting differences in output (missing empty fields in SVC segments)
EDI270 (Health Care Eligibility Benefit Inquiry) βœ… Complete Fully functional with line breaks in generated output, all segments correctly processed
EDI271 (Health Care Eligibility Benefit Response) βœ… Complete Fully functional with line breaks in generated output, all segments correctly processed including LS/LE
EDI999 (Implementation Acknowledgment) βœ… Complete Fully functional with special CTX segment handling for both standard and special formats
EDI276/277 (Health Care Claim Status) βœ… Functional Functional with differences in output, core functionality working correctly including TRN and STC segments
EDI278 (Health Care Services Review) βœ… Functional Functional with correct handling of AR/HS prefixes in UM segment, some segments missing in output (DTP, SV2, PRV)
EDI837P (Health Care Claim Professional) βœ… Functional Functional with differences in output, core functionality working correctly but missing several segments
EDI837I (Health Care Claim Institutional) βœ… Functional Functional with specialized handling for CL1 segment, missing several segments in output
EDI837D (Health Care Claim Dental) βœ… Functional Functional with specialized handling for TOO segment, core functionality working correctly
EDI820 (Health Insurance Exchange Related Payments) ⚠️ Partial Partially functional with many missing segments in output (N1, ENT, NM1, RMR, DTM)
EDI834 (Benefit Enrollment and Maintenance) ❌ Not Implemented Format not currently recognized by the parser

Repository Structure

edi/
β”œβ”€β”€ src/                         # Source code directory
β”‚   β”œβ”€β”€ edi835/                  # Healthcare Claim Payment/Advice format implementation
β”‚   β”œβ”€β”€ edi999/                  # Functional Acknowledgment format implementation
β”‚   β”œβ”€β”€ edi270/                  # Eligibility Benefit Inquiry format implementation
β”‚   β”œβ”€β”€ edi271/                  # Eligibility Benefit Response format implementation
β”‚   β”œβ”€β”€ edi276/                  # Health Care Claim Status Request implementation
β”‚   β”œβ”€β”€ edi277/                  # Health Care Claim Status Response implementation
β”‚   β”œβ”€β”€ edi278/                  # Health Care Services Review implementation
β”‚   β”œβ”€β”€ edi837/                  # Health Care Claim implementation (Professional, Institutional, Dental)
β”‚   β”œβ”€β”€ edi820/                  # Health Insurance Exchange Related Payments implementation
β”‚   β”œβ”€β”€ helper/                  # Utility functions and shared helpers
β”‚   β”œβ”€β”€ segments/                # EDI segment definitions and processors
β”‚   β”œβ”€β”€ error.rs                 # Error handling module
β”‚   β”œβ”€β”€ transaction_processor.rs # Generic transaction set processor
β”‚   β”œβ”€β”€ segment_config.rs        # Configuration-driven segment definitions
β”‚   β”œβ”€β”€ loop_processor.rs        # Enhanced loop detection and processing
β”‚   β”œβ”€β”€ lib.rs                   # Library exports
β”‚   └── main.rs                  # Application entry point
β”œβ”€β”€ Cargo.toml                   # Rust project configuration and dependencies
└── Cargo.lock                   # Locked dependencies versions

Features

  • Multiple Transaction Set Support: 835, 999, 270/271, 276/277, 278, 837P/I/D, 820
  • Configuration-Driven Architecture: Segment and loop definitions are configurable
  • Robust Error Handling: Comprehensive error types and validation
  • Bidirectional Conversion: EDI to JSON and JSON to EDI
  • Extensible Design: Easy to add new transaction sets and segments
  • Special Format Handling: Support for complex CTX segments and other special formats
  • Variant-Specific Components: Specialized handling for format-specific segments like TOO in 837D and CL1 in 837I
  • Prefix Support: Handling for special prefixes like AR/HS in UM segments for 278 transaction sets

Usage Instructions

Prerequisites

  • Rust toolchain (1.56.0 or later)
  • Cargo package manager
  • Environment with logging capabilities for debug output

Installation

# Clone the repository
git clone [repository-url]
cd edi

# Build the project
cargo build --release

# Run tests
cargo test

Command Line Options

-f <file>     Input file path (EDI or JSON)
-o <file>     Output file path
-w            Write mode (convert JSON to EDI)
-j            Specify input is JSON
-h, --help    Show help information

Examples

# Convert EDI to JSON
cargo run -- -f input.edi -o output.json

# Convert JSON to EDI
cargo run -- -f input.json -o output.edi -w -j

Testing Methodology

  • Parse EDI files to JSON and verify structure
  • Generate EDI files from JSON and verify structure
  • Compare original and generated EDI files
  • Identify unprocessed segments and structural differences
# Parse EDI to JSON
cargo run -- -f ./demo/edi835-1.edi -o ./demo/test835-new.json

# Generate EDI from JSON
cargo run -- -f ./demo/test835-new.json -o ./demo/test835-new.edi -w -j

# Compare files
diff ./demo/edi835-1.edi ./demo/test835-new.edi

Documentation

Current System Status & Testing Results

  • Comprehensive validation of all implemented formats
  • Real-time testing results and system health
  • Production readiness assessment
  • Quality assurance methodology and findings

πŸ“š AmazonQ.md

Implementation History & Technical Details

  • Phase-by-phase development process
  • Technical architecture and design decisions
  • Detailed segment and loop structures
  • Development roadmap and next steps

Development Roadmap

πŸ“‹ Status: All items below have been validated through comprehensive testing. See VALIDATION_REPORT.md for current results.

Completed

  • βœ… Fixed CTX segment implementation in 999 format
  • βœ… Improved error handling for malformed input files
  • βœ… Addressed Table 1 content placement issues
  • βœ… Added comprehensive unit tests
  • βœ… Common Infrastructure Updates
    • βœ… Generic transaction set processor
    • βœ… Configuration-driven segment definitions
    • βœ… Enhanced loop detection and processing
    • βœ… Standardized error handling
  • βœ… Transaction Set 270/271 (Health Care Eligibility)
  • βœ… Transaction Set 276/277 (Health Care Claim Status)
    • βœ… Fixed TRN and STC segment handling in 277 format
  • βœ… Transaction Set 278 (Health Care Services Review)
    • βœ… Implemented all loops and segments
    • βœ… Added support for AR/HS prefixes in UM segment
    • βœ… Added facility address handling
    • βœ… Added service provider details
  • βœ… Transaction Set 837P/I/D (Health Care Claim)
    • βœ… Implemented variant-specific components
    • βœ… Added specialized handling for TOO segment in 837D
    • βœ… Added specialized handling for CL1 segment in 837I
  • βœ… Transaction Set 820 (Health Insurance Exchange Related Payments)
    • βœ… Implemented basic structure and segments
    • βœ… Added parsing and generation functionality

Planned

  • Implement EDI834 Format
    • Create directory structure and module organization
    • Implement member-level detail segments (INS, HD, DSB)
    • Implement loop structures for enrollment and maintenance
    • Create controller with TransactionSet trait implementation
  • Improve Incomplete Implementations
    • Enhance the EDI820 implementation to preserve all segments
    • Improve the EDI837P and EDI837I implementations to preserve all segments
    • Fix segment order issues in generated files
  • Code Cleanup
    • Address compiler warnings, particularly unused imports and functions
    • Fix unused variable warnings
    • Improve code organization and documentation
  • Performance Optimization
    • Optimize parsing algorithms for better performance with large files
    • Implement caching for frequently used segments
    • Reduce memory usage for large files
  • Additional Features
    • Add support for custom delimiters
    • Implement pretty printing for output files
    • Add schema validation
    • Create a web interface for EDI processing

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

[Specify your license here]

About

No description or website provided.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages