testhl7

package
v0.0.0-...-0da26dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package testhl7 contains utility functions and helpers for testing with HL7 messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountStatus

func AccountStatus(t *testing.T, message string) string

AccountStatus returns the PV1.AccountStatus.

func AllAL1

func AllAL1(t *testing.T, message string) []*hl7.AL1

AllAL1 returns all AL1 segments.

func AllDG1

func AllDG1(t *testing.T, message string) []*hl7.DG1

AllDG1 returns all DG1 segments.

func AllOBX

func AllOBX(t *testing.T, message string) []*hl7.OBX

AllOBX returns all OBX segments.

func AllPR1

func AllPR1(t *testing.T, message string) []*hl7.PR1

AllPR1 returns all PR1 segments.

func DeathIndicator

func DeathIndicator(t *testing.T, message string) string

DeathIndicator returns the PatientDeathIndicator.

func DeathTime

func DeathTime(t *testing.T, message string) *time.Time

DeathTime returns the PatientDeathIndicator.

func EVN

func EVN(t *testing.T, message string) *hl7.EVN

EVN returns the message's EVN segment.

func EventDateTime

func EventDateTime(t *testing.T, message string) time.Time

EventDateTime returns the event's date time.

func Fields

func Fields(t *testing.T, messages []string, f func(*testing.T, string) string) []string

Fields computes the given function that returns strings for each message.

func FirstName

func FirstName(t *testing.T, message string) string

FirstName returns the patient first name from the message.

func MRG

func MRG(t *testing.T, message string) *hl7.MRG

MRG returns the message's MRG segment.

func MRN

func MRN(t *testing.T, message string) string

MRN returns the patient identifier.

func MSA

func MSA(t *testing.T, message string) *hl7.MSA

MSA returns the message's MSA segment.

func MSH

func MSH(t *testing.T, message string) *hl7.MSH

MSH returns the message's MSH segment.

func MessageControlIDFromMSA

func MessageControlIDFromMSA(t *testing.T, message string) string

MessageControlIDFromMSA returns the message control ID from the MSA segment.

func MessageControlIDFromMSH

func MessageControlIDFromMSH(t *testing.T, message string) string

MessageControlIDFromMSH returns the message control ID from the MSH segment.

func MessageDateTime

func MessageDateTime(t *testing.T, message string) time.Time

MessageDateTime returns the message's date time.

func MessageType

func MessageType(t *testing.T, message string) string

MessageType returns this message's message type.

func OBR

func OBR(t *testing.T, message string) *hl7.OBR

OBR returns the message's OBR segment.

func OBX

func OBX(t *testing.T, message string) *hl7.OBX

OBX returns the message's OBX segment.

func OBXFields

func OBXFields(t *testing.T, messages []string, f func(*testing.T, *hl7.OBX) string) [][]string

OBXFields applies the function f to all of the OBX segments in the messages.

func OBXFieldsFromOBXs

func OBXFieldsFromOBXs(t *testing.T, obxs []*hl7.OBX, f func(*testing.T, *hl7.OBX) string) []string

OBXFieldsFromOBXs applies the function f to all of the given OBX segments.

func OBXResultStatus

func OBXResultStatus(t *testing.T, obx *hl7.OBX) string

OBXResultStatus returns the observation result status.

func OBXSetID

func OBXSetID(t *testing.T, obx *hl7.OBX) string

OBXSetID returns the OBX's SetID.

func ORC

func ORC(t *testing.T, message string) *hl7.ORC

ORC returns the message's ORC segment.

func ObservationValue

func ObservationValue(t *testing.T, message string) string

ObservationValue returns this message's OBX observation value.

func OrderStatus

func OrderStatus(t *testing.T, message string) string

OrderStatus returns OrderStatus from the ORC segment.

func PID

func PID(t *testing.T, message string) *hl7.PID

PID returns the message's PID segment.

func PV1

func PV1(t *testing.T, message string) *hl7.PV1

PV1 returns the message's PV1 segment.

func PV2

func PV2(t *testing.T, message string) *hl7.PV2

PV2 returns the message's PV2 segment.

func PV2OrNil

func PV2OrNil(t *testing.T, message string) *hl7.PV2

PV2OrNil returns the message's PV2 segment, or nil if there's no PV2 segment.

func Parse

func Parse(t *testing.T, message string) *hl7.Message

Parse parses the given message.

func PatientClass

func PatientClass(t *testing.T, message string) string

PatientClass returns the PV1.PatientClass.

func PlacerNumber

func PlacerNumber(t *testing.T, message string) string

PlacerNumber returns the PlacerOrderNumber.

func PointOfCare

func PointOfCare(t *testing.T, message string) string

PointOfCare returns the point of care from the PV1.AssignedPatientLocation.

func PriorPatientIdentifierList

func PriorPatientIdentifierList(t *testing.T, message string) []string

PriorPatientIdentifierList returns the PriorPatientIdentifierList from the MRG segment.

func SendingApplication

func SendingApplication(t *testing.T, message string) string

SendingApplication returns the message's sending application.

func SendingFacility

func SendingFacility(t *testing.T, message string) string

SendingFacility returns the message's sending facility.

func TXA

func TXA(t *testing.T, message string) *hl7.TXA

TXA returns the message's TXA segment.

func TimeFields

func TimeFields(t *testing.T, messages []string, f func(*testing.T, string) *time.Time) []*time.Time

TimeFields computes the given function that returns times for each message.

func ValueType

func ValueType(t *testing.T, obx *hl7.OBX) string

ValueType returns the OBX's observation value type.

func VisitNumber

func VisitNumber(t *testing.T, message string) string

VisitNumber returns the VisitNumber ID.

Types

type Sender

type Sender struct {
	// contains filtered or unexported fields
}

Sender is an hl7.Sender that saves all sent messages in a list.

func SenderWithError

func SenderWithError(err error) *Sender

SenderWithError returns a Sender that returns the provided error when Send() is invoked.

func (*Sender) Close

func (s *Sender) Close() error

Close is no-op.

func (*Sender) EraseSentHistory

func (s *Sender) EraseSentHistory()

EraseSentHistory erases the history of sent messages.

func (*Sender) GetSentMessages

func (s *Sender) GetSentMessages() []string

GetSentMessages returns the messages sent by this sender.

func (*Sender) Send

func (s *Sender) Send(message []byte) error

Send saves all sent messages to a list if s.err is nil. Otherwise, it returns s.err.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL