This C++ program is designed to parse EDI (Electronic Data Interchange) files and convert their structured, delimiter-separated content into readable and usable JSON objects. The parser is built to handle EDI 837-like healthcare claims data, with robust segment and element-level mapping.
- EDI lines are split by asterisks (
*) using thesplitAndStorefunction to extract individual elements.
- Each segment (e.g.,
ISA,GS,NM1) is identified and mapped based on its position and context (e.g., loop names like2310A,2010BA).
- The
Map_Elements_GeneralandMap_Elements_Loopfunctions associate raw EDI element positions (likeNM109) with human-readable field names using a predefined map (DataElement_Name_Pairs).
- Handles both Professional and Institutional claims by applying context-specific mappings and flags (e.g.,
_Isuffix).
- The extracted key-value pairs are appended to or written into JSON files, organized by filename, using the
map_to_jsonfunction with pretty printing.
- The mapping logic is modular, allowing new segment identifiers and loops to be added easily without changing the core parsing logic.
This tool is ideal for converting raw EDI healthcare claims into structured formats for downstream data analysis, validation, auditing, or integration into modern systems like databases or web applications.