Documentation ¶
Index ¶
- Constants
- func Marshal(m *Message, it interface{}) ([]byte, error)
- func Split(buf []byte) [][]byte
- type ACK
- type Component
- type Decoder
- type Delimeters
- type Encoder
- type Field
- type Location
- type Message
- func (m *Message) AllSegments(s string) ([]*Segment, error)
- func (m *Message) Find(loc string) (string, error)
- func (m *Message) FindAll(loc string) ([]string, error)
- func (m *Message) Get(l *Location) (string, error)
- func (m *Message) GetAll(l *Location) ([]string, error)
- func (m *Message) Info() (MsgInfo, error)
- func (m *Message) IsValid(val []Validation) (bool, []Validation)
- func (m *Message) ScanSegments() bool
- func (m *Message) Segment(s string) (*Segment, error)
- func (m *Message) Set(l *Location, val string) error
- func (m *Message) String() string
- func (m *Message) Unmarshal(it interface{}) error
- type MessageScanner
- type MsgInfo
- type Segment
- func (s *Segment) AllFields(i int) ([]*Field, error)
- func (s *Segment) Field(i int) (*Field, error)
- func (s *Segment) Get(l *Location) (string, error)
- func (s *Segment) GetAll(l *Location) ([]string, error)
- func (s *Segment) GetNumFields() int
- func (s *Segment) Set(l *Location, val string, seps *Delimeters) error
- func (s *Segment) String() string
- type SubComponent
- type VCheck
- type Validation
Constants ¶
const ( HasValue = iota SpecificValue )
VCheck values
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ACK ¶
type ACK struct { Code string `hl7:"MSA.1"` OrgControlID string `hl7:"MSA.2"` ErrMsg string `hl7:"MSA.3"` }
ACK is struct for an ack message
type Component ¶
type Component struct { SubComponents []SubComponent Value []rune }
Component is an HL7 component
func (*Component) Set ¶
func (c *Component) Set(l *Location, val string, seps *Delimeters) error
Set will insert a value into a message at Location
func (*Component) SubComponent ¶
func (c *Component) SubComponent(i int) (*SubComponent, error)
SubComponent returns the subcomponent i
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder reades hl7 messages from a stream
func NewDecoder ¶
NewDecoder returns a new Decoder that reades from from stream r Assumes one message per stream
type Delimeters ¶
type Delimeters struct { DelimeterField string Field rune Component rune Repetition rune Escape rune SubComponent rune Truncate rune LFTermMsg bool }
Delimeters holds the list of hl7 message delimeters
func NewDelimeters ¶
func NewDelimeters() *Delimeters
NewDelimeters returns the default set of HL7 delimeters
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder writes hl7 messages to a stream
func NewEncoder ¶
NewEncoder returns a new Encoder that writes to stream w
type Field ¶
Field is an HL7 field
func (*Field) NumSubFields ¶
type Location ¶
Location specifies a value or values in an Message
func NewLocation ¶
NewLocation creates a Location struct based on location string syntax
type Message ¶
type Message struct { Segments []Segment Value []rune Delimeters Delimeters }
Message is an HL7 message
func Acknowledge ¶
Acknowledge generates an ACK message based on the MsgInfo struct st can be nil for success or to send an AE code
func NewMessage ¶
NewMessage returns a new message with the v byte value
func StartMessage ¶
StartMessage returns a Message with an MSH segment based on the MsgInfo struct
func (*Message) AllSegments ¶
AllSegments returns the first matching segmane with name s
func (*Message) Find ¶
Find gets a value from a message using location syntax finds the first occurence of the segment and first of repeating fields if the loc is not valid an error is returned
func (*Message) FindAll ¶
FindAll gets all values from a message using location syntax finds all occurences of the segments and all repeating fields if the loc is not valid an error is returned
func (*Message) IsValid ¶
func (m *Message) IsValid(val []Validation) (bool, []Validation)
IsValid checks a message for validity based on a set of criteria it returns valid and any failed validation rules
func (*Message) Unmarshal ¶
Unmarshal fills a structure from an HL7 message It will panic if interface{} is not a pointer to a struct Unmarshal will decode the entire message before trying to set values it will set the first matching segment / first matching field repeating segments and fields is not well suited to this for the moment all unmarshal target fields must be strings
type MessageScanner ¶
type MessageScanner struct {
// contains filtered or unexported fields
}
func NewMessageScanner ¶
func NewMessageScanner(r io.Reader) *MessageScanner
NewMessageScanner returns a new scanner that returns hl7 messages from an io.Reader
func (*MessageScanner) Err ¶
func (ms *MessageScanner) Err() error
func (*MessageScanner) Message ¶
func (ms *MessageScanner) Message() *Message
func (*MessageScanner) Scan ¶
func (ms *MessageScanner) Scan() (gotOne bool)
type MsgInfo ¶
type MsgInfo struct { SendingApp string `hl7:"MSH.3"` SendingFacility string `hl7:"MSH.4"` ReceivingApp string `hl7:"MSH.5"` ReceivingFacility string `hl7:"MSH.6"` MsgDate string `hl7:"MSH.7"` // if blank will generate MessageType string `hl7:"MSH.9"` // Required example ORM^001 ControlID string `hl7:"MSH.10"` // if blank will generate ProcessingID string `hl7:"MSH.11"` // default P VersionID string `hl7:"MSH.12"` // default 2.4 }
MsgInfo describes the basic message fields
func NewMsgInfo ¶
func NewMsgInfo() *MsgInfo
NewMsgInfo returns a MsgInfo with controlID, message date, Processing Id, and Version set Version = 2.4 ProcessingID = P
func NewMsgInfoAck ¶
NewMsgInfoAck returns a MsgInfo ACK based on the MsgInfo passed in
type Segment ¶
Segment is an HL7 segment
func (*Segment) GetNumFields ¶
type Validation ¶
type Validation struct { Location string // Query syntax VCheck VCheck // What to check Value string // Matching value for SpecificValue Err error // error to use }
Validation contains information to validate a message value
func NewValidMSH24 ¶
func NewValidMSH24() []Validation
NewValidMSH24 is the validation for the MSH segment for version 2.4
func NewValidODS24 ¶
func NewValidODS24() []Validation
NewValidODS24 is the validation for the ODS segment for version 2.4
func NewValidORC24 ¶
func NewValidORC24() []Validation
NewValidORC24 is the validation for the ORC segment for version 2.4
func NewValidORMDietaryOrder24 ¶
func NewValidORMDietaryOrder24() []Validation
NewValidORMDietaryOrder24 is an example of validating a ORM^001 message
func NewValidPID24 ¶
func NewValidPID24() []Validation
NewValidPID24 is the validation for the PID segment for version 2.4
func NewValidPV124 ¶
func NewValidPV124() []Validation
NewValidPV124 is the validation for the PV1 segment for version 2.4