Accessing groups and segments with the HL7 Kotlin DSL

Groups and segments can be accessed by name like in a map.

    import ca.uhn.hl7v2.model.Message

    val message: Message = ...

    // Accessing a segment
    val msh   = message["MSH"]

    // Accessing a group
    val group = message["PATIENT_RESULT"]

    // Accessing a segment nested within groups
    val pid   = message["PATIENT_RESULT"]["PATIENT"]["PID"]

In case the structure is repeating, this simple syntax only returns the first repetition