org.vmdb.hl7
Class ORDER_OBSERVATIONLoop

java.lang.Object
  |
  +--org.vmdb.hl7.HL7Object
        |
        +--org.vmdb.hl7.HL7SegmentContainer
              |
              +--org.vmdb.hl7.HL7Loop
                    |
                    +--org.vmdb.hl7.ORDER_OBSERVATIONLoop

public class ORDER_OBSERVATIONLoop
extends HL7Loop

ORDER_OBSERVATION Loop.

Description: HL7 Network Connectivity For VMDB.

Copyright: Copyright (c) 2002-2003.

Company: Veterinary Medical Database (VMDB).

The XML representation of HL7 2.x introduces the concepts of groups and lists that, while present in the construction rules of delimited HL7, are not explicitly named or labelled in the messages themselves. This class follows the XML version with explicitly constructed groups and lists which we've combined under the general term (borrowed from X12) of "loop."

Most of the repetion and grouping facilitated by this "loop" logic is not used in the VMDB version of the ORU message but is maintained to retain full standard compliance and to allow extending this model without fear of losing interoperability.

Loop and Segment Nesting: The outline below shows how the loops and minimum required segments nest. {OBX} indicates that any number of OBX segments may appear at this location.

MSH
PATIENT_RESULT
    PATIENT
      PID
      PATIENT_VISIT
        PV1
    ORDER_OBSERVATION
     [ORC]
      OBR
        OBSERVATION
          OBX

Besides maintaining the structure of the XML representation, this loop handles the task of keeping track of set id's and sub id's for the OBX segments (OBSERVATION Loops) contained within it.


Constructor Summary
ORDER_OBSERVATIONLoop()
           
 
Method Summary
 OBXSegment addOBX()
          Add an OBX segment that should be located in this loop.
 java.util.Iterator findOBXModifiers(OBXSegment obxIn)
          Find all OBX segments whos subId indicates they modify this OBX.
 java.util.Iterator findOBXSegments(CEElement ceObsId)
          Find all OBX segments with a given Observation Identifier as defined by a predefined CEElement object.
 OBRSegment getOBR()
          Get the OBR segment that should be located in this loop.
 OBSERVATIONLoop getOBSERVATION()
          Get the OBSERVATIONLoop loop that should be located in this loop.
 ORCSegment getORC()
          Get the ORC segment that should be located in this loop.
 java.lang.String nextModifierSubId(OBXSegment obxIn)
          Create the sub id to be assigned the next modifier of the OBXSegment provided.
 
Methods inherited from class org.vmdb.hl7.HL7Loop
getLoopClass, getName, isLoop, messageComplete
 
Methods inherited from class org.vmdb.hl7.HL7SegmentContainer
findSegment, listsSegments, setSeparators, toString, toXML
 
Methods inherited from class org.vmdb.hl7.HL7Object
getRule
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ORDER_OBSERVATIONLoop

public ORDER_OBSERVATIONLoop()
Method Detail

getOBSERVATION

public OBSERVATIONLoop getOBSERVATION()
Get the OBSERVATIONLoop loop that should be located in this loop. If the loop does not exist, take the necessary steps to create it in the appropriate location.

Returns:
OBSERVATIONLoop object from the correct location.

getOBR

public OBRSegment getOBR()
Get the OBR segment that should be located in this loop. If it does not exist, take the necessary steps to create it.

Note: The semantics here only work correctly for segments that exist singly in a message. We break with generic HL7 here in that only under VMDB are we restricted to a single patient per message. If we drop this limitation we will need to create more complex (addOBR) semantics.

Returns:
OBRSegment object located at the appropriate place in the loop.

getORC

public ORCSegment getORC()
Get the ORC segment that should be located in this loop. If it does not exist, take the necessary steps to create it.

Note: The semantics here only work correctly for segments that exist singly in a message. We break with generic HL7 here in that only under VMDB are we restricted to a single patient per message. If we drop this limitation we will need to create more complex (addOBR) semantics.

Returns:
OBRSegment object located at the appropriate place in the loop.

addOBX

public OBXSegment addOBX()
Add an OBX segment that should be located in this loop. If the loop does not exist, take the necessary steps to create it.
Note: Adding an OBX really means adding a whole OBSERVATION but since we usually omit the NTE segment, it is much more intuitive to add directly to the ORDER_OBSERVATION. If we add support for the NTE, it will need a method for locating the OBX it goes with.

Returns:
OBXSegment object newly created.

findOBXSegments

public java.util.Iterator findOBXSegments(CEElement ceObsId)
Find all OBX segments with a given Observation Identifier as defined by a predefined CEElement object.
Note: This implementation only works because Java is garbage collected. A C++ port is going to have to find a better way to hold the collection of matched segment or perhaps create a specific derived Iterator class to walk the collection as the iterator is incremented.

Parameters:
ceObsId - CEElement with specific observation identifier. Almost always using a predefined constant from the Loinc class.
Returns:
Iterator over collection of OBX segments that match on observation identifier value.

nextModifierSubId

public java.lang.String nextModifierSubId(OBXSegment obxIn)
Create the sub id to be assigned the next modifier of the OBXSegment provided.

Based on the input OBX's subId, look for all modifiers and assign the next higher last digit to create the correct subId to assign the next obx that modifies this one.

Parameters:
obxIn - An OBXSegment who's subId field will be used to find all other obx's in this loop that modify it.
Returns:
String to be used as subId for the next modifier added.

findOBXModifiers

public java.util.Iterator findOBXModifiers(OBXSegment obxIn)
Find all OBX segments whos subId indicates they modify this OBX.

Note: This implementation only works because Java is garbage collected. A C++ port is going to have to find a better way to hold the collection of matched segment or perhaps create a specific derived Iterator class to walk the collection as the iterator is incremented.

Parameters:
obxIn - An OBXSegment whos subId field will be used to find all other obx's in this loop that modify it.
Returns:
Iterator over collection of OBX segments that modify the supplied obx.

SourceForge.net Logo