Skip to content

Commit

Permalink
Fix issue with not populating nested segment groups
Browse files Browse the repository at this point in the history
  • Loading branch information
sameeragunarathne committed Aug 13, 2024
1 parent 1f12b1a commit 454f4c9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hl7v23/hl7_parser.bal
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ class HL7Parser {
hl7v2:SegmentComponent[] segmentGroupArr = <hl7v2:SegmentComponent[]>current[currentSegmentGroupName];
current = <map<anydata>>segmentGroupArr[segmentGroupArr.length() - 1];
} else {
//todo: need to handle creating segment group(s) if not available
current[currentSegmentGroupName] = segmentComponent;
current = <map<anydata>>current[currentSegmentGroupName];
}
}
}
Expand Down
1 change: 1 addition & 0 deletions hl7v23/tests/parser_tests.bal
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,6 @@ function testSegmentGroupsParsing() returns error? {
string hl7MsgStr = string:'join("\r", ...segmentsArr);
hl7:Message parsedMsg = check hl7:parse(hl7MsgStr);
ORM_O01 inOrm = check parsedMsg.ensureType(ORM_O01);
test:assertTrue(inOrm.'order[0].orm_o01_order_detail?.orm_o01_order_detail_segment?.obr?.obr1 == "1", "Segment groups parsing failed");
test:assertTrue(inOrm.patient[0].orm_o01_patient_visit?.pv1?.pv11 == "1", "Segment groups parsing failed");
}

0 comments on commit 454f4c9

Please sign in to comment.