Documentation ¶
Overview ¶
Package testhl7 contains utility functions and helpers for testing with HL7 messages.
Index ¶
- Constants
- Variables
- func AccountStatus(t *testing.T, message string) string
- func AllAL1(t *testing.T, message string) []*hl7.AL1
- func AllDG1(t *testing.T, message string) []*hl7.DG1
- func AllOBX(t *testing.T, message string) []*hl7.OBX
- func AllPR1(t *testing.T, message string) []*hl7.PR1
- func DeathIndicator(t *testing.T, message string) string
- func DeathTime(t *testing.T, message string) *time.Time
- func EVN(t *testing.T, message string) *hl7.EVN
- func EventDateTime(t *testing.T, message string) time.Time
- func Fields(t *testing.T, messages []string, f func(*testing.T, string) string) []string
- func FirstName(t *testing.T, message string) string
- func MRG(t *testing.T, message string) *hl7.MRG
- func MRN(t *testing.T, message string) string
- func MSA(t *testing.T, message string) *hl7.MSA
- func MSH(t *testing.T, message string) *hl7.MSH
- func MessageControlIDFromMSA(t *testing.T, message string) string
- func MessageControlIDFromMSH(t *testing.T, message string) string
- func MessageDateTime(t *testing.T, message string) time.Time
- func MessageType(t *testing.T, message string) string
- func OBR(t *testing.T, message string) *hl7.OBR
- func OBX(t *testing.T, message string) *hl7.OBX
- func OBXFields(t *testing.T, messages []string, f func(*testing.T, *hl7.OBX) string) [][]string
- func OBXFieldsFromOBXs(t *testing.T, obxs []*hl7.OBX, f func(*testing.T, *hl7.OBX) string) []string
- func OBXResultStatus(t *testing.T, obx *hl7.OBX) string
- func OBXSetID(t *testing.T, obx *hl7.OBX) string
- func ORC(t *testing.T, message string) *hl7.ORC
- func ObservationValue(t *testing.T, message string) string
- func OrderStatus(t *testing.T, message string) string
- func PID(t *testing.T, message string) *hl7.PID
- func PV1(t *testing.T, message string) *hl7.PV1
- func PV2(t *testing.T, message string) *hl7.PV2
- func PV2OrNil(t *testing.T, message string) *hl7.PV2
- func Parse(t *testing.T, message string) *hl7.Message
- func PatientClass(t *testing.T, message string) string
- func PlacerNumber(t *testing.T, message string) string
- func PointOfCare(t *testing.T, message string) string
- func PriorPatientIdentifierList(t *testing.T, message string) []string
- func SendingApplication(t *testing.T, message string) string
- func SendingFacility(t *testing.T, message string) string
- func TXA(t *testing.T, message string) *hl7.TXA
- func TimeFields(t *testing.T, messages []string, f func(*testing.T, string) *time.Time) []*time.Time
- func ValueType(t *testing.T, obx *hl7.OBX) string
- func VisitNumber(t *testing.T, message string) string
- type Sender
Constants ¶
const ( // https://corepointhealth.com/resource-center/hl7-resources/hl7-msh-message-header // The message type field here is set to a placerholder "%s". Users should set this type based // on the message type they want to parse, e.g. ADT^A01 or ORU_R01. // ┌ Encoding Characters // | ┌ Sending Application // | | ┌ Sending Facility // | | | ┌ Receiving Application // | | | | ┌ Receiving Facility // | | | | | ┌ Date/Time Of Message // | | | | | | ┌ Security // | | | | | | |┌ Message Type // | | | | | | || ┌ Message ControlID // | | | | | | || | ┌ Processing ID // | | | | | | || | | ┌ Version ID // | | | | | | || | | | ┌ Sequence Number // | | | | | | || | | | |┌ Continuation Pointer // | | | | | | || | | | ||┌ Accept Acknowledgment Type // | | | | | | || | | | ||| ┌ Application Acknowledgment Type // | | | | | | || | | | ||| |┌ Country Code // | | | | | | || | | | ||| || ┌ Character Set TemplateMSH = "MSH|^~\\&|SAP|SFA|RECEAPPL|RFAC|20141128001635||%s|2014112800163507740000|T|2.3|||AL||44|ASCII" // https://corepointhealth.com/resource-center/hl7-resources/hl7-pv1-patient-visit-information-segment // ┌ ID // │ ┌ Patient Class // │ │ ┌ Assigned Patient Location // │ │ │ ┌ Admission Type // │ │ │ │ ┌ Preadmit Number // │ │ │ │ │┌ Prior Patient Location SegmentPV1 = "PV1|1|INPATIENT|SFA 10 EAST^Bay01^Bed10^SFA RF^^BED^SFA|28b||^^^^^^" + "" + "|C3335432^Jensen^Mark^^^^^^NHSCSLTNBR^PRSNL^^^NONGP^~891257458214^Jensen^Mark^^^^^^DRNBR^PRSNL^^^ORGDR^" + "" + "|C3335432^Jensen^Mark^^^^^^NHSCSLTNBR^PRSNL^^^NONGP^~891257458214^Jensen^Mark^^^^^^DRNBR^PRSNL^^^ORGDR^" + "" + "||361||||19||||INPATIENT|6153479^^^^VISITID|||||||||" + "" + "|||||||||||SFA RF||ACTIVE|||20141127180000" // https://corepointhealth.com/resource-center/hl7-resources/hl7-obr-segment // ┌ ID // │ ┌ Placer Order Number // │ │ ┌ Filler Order Number // │ │ │┌ Universal Service ID // │ │ ││ ┌ Priority // │ │ ││ │ ┌ Requested Date/Time // │ │ ││ │ │ ┌ Observation Date/Timer // │ │ ││ │ │ │ ┌ Observation End Date/Time // │ │ ││ │ │ │ │ ┌ Collection Volume // │ │ ││ │ │ │ │ │┌ Collector Identifier // │ │ ││ │ │ │ │ ││┌ Specimen Action Code // │ │ ││ │ │ │ │ │││┌ Danger Code // │ │ ││ │ │ │ │ ││││┌ Relevant Clinical Info. // │ │ ││ │ │ │ │ │││││┌ Specimen Received Date/Time // │ │ ││ │ │ │ │ ││││││┌ Specimen Source // │ │ ││ │ │ │ │ │││││││ ┌ Ordering Provider // │ │ ││ │ │ │ │ │││││││ │ ┌ Order Callback Phone Number // │ │ ││ │ │ │ │ │││││││ │ │┌ Placer Field 1 // │ │ ││ │ │ │ │ │││││││ │ ││┌ Placer Field 2 // │ │ ││ │ │ │ │ │││││││ │ │││┌ Filler Field 1 // │ │ ││ │ │ │ │ │││││││ │ ││││┌ Filler Field 2 // │ │ ││ │ │ │ │ │││││││ │ │││││┌ Results Rpt/Status Chng - Date/Time // │ │ ││ │ │ │ │ │││││││ │ ││││││ ┌ Charge to Practice // │ │ ││ │ │ │ │ │││││││ │ ││││││ │┌ Diagnostic Serv Sect ID // │ │ ││ │ │ │ │ │││││││ │ ││││││ ││ ┌ Result Status SegmentOBR = "" /* 145-byte string literal not displayed */ // http://hl7-definition.caristix.com:9010/Default.aspx?version=HL7+v2.3.1&segment=ORC // ┌ ID // │ ┌ Placer Order Number // │ │ ┌ Filler Order Number // │ │ │ ┌ Placer Group Number // │ │ │ │┌ Order status // │ │ │ ││ ┌ Response Flag // │ │ │ ││ │┌ Quantity/Timing // │ │ │ ││ ││┌ Parent Order // │ │ │ ││ │││┌ Transaction Date/Time SegmentORC = "ORC|1|20060307110114|XXYYZZ||A||||20060307110114" // http://hl7-definition.caristix.com:9010/HL7%20v2.3.1/segment/AL1 // ┌ Allergy Type // │ // │ ┌ Allergy Identifier, Description and Coding System // │ │ ┌ Allergy Severity // │ │ │ ┌ Allergy Reaction // │ │ │ │ ┌ Allergy Identification Date // │ │ │ │ │ SegmentAL1 = "AL1|1|DRUG|##NOMEN##,AL1,ceStruct,allergy,1234,1234567^penicillin^ALLERGY|SEVERE|rash|20180428000000" // http://hl7-definition.caristix.com:9010/HL7%20v2.3.1/segment/OBX // ┌ Value Type // │ ┌ Observation Identifier // │ │ ┌ Observation Sub-ID // │ │ │┌ Observation Value // │ │ ││ ┌ Units // │ │ ││ │ ┌ Reference Range // │ │ ││ │ │ ┌ Abnormal Flags // │ │ ││ │ │ │ ┌ Probability // │ │ ││ │ │ │ │┌ Nature of Abnormal // │ │ ││ │ │ │ ││┌ Observation Result Status // │ │ ││ │ │ │ │││ ┌ Date Last Obs Normal Values // │ │ ││ │ │ │ │││ │┌ User Defined Access Checks // │ │ ││ │ │ │ │││ ││┌ Date/Time of the Observation // │ │ ││ │ │ │ │││ │││┌ Producer's ID // │ │ ││ │ │ │ │││ ││││┌ Responsible Observer // │ │ ││ │ │ │ │││ │││││ SegmentOBX = "OBX|1|NM|lpdc-2012^Creatinine^WinPath||112|UMOLL^UMOLL|66 - 112|A|||F|||||" SegmentOBX2 = "OBX|2|ST|testcode^^system||text content||||||F|||||" SegmentOBX3 = "OBX|3|DT|testcode^name of testcode^system||20130707||||||F|||||" SegmentOBX4 = "OBX|4|TS|testcode^name of testcode^system||20121201120200||||||F|||||" SegmentOBX5 = "OBX|5|NM|lpdc-2012^Creatinine^WinPath||[12.0]|UMOLL^UMOLL|66 - 112|A|||F|||||" SegmentOBX6 = "OBX|6|ST|testcode^name of testcode^system||text content~||||||F|||||" SegmentOBX7 = "OBX|7|NM|lpdc-2012^Creatinine^WinPath|| [12.0] |UMOLL^UMOLL|66 - 112|A|||F|||||" // http://hl7-definition.caristix.com:9010/HL7%20v2.3.1/segment/NTE // ┌ Source of Comment // │ ┌ Comment // │ │ ┌ Comment Type SegmentNTE = "NTE|1|L|NOTE: Submission of serum|" // https://corepointhealth.com/resource-center/hl7-resources/hl7-pid-segment SegmentPID = "" /* 365-byte string literal not displayed */ // ┌ Reason ID // │ ┌ Reason Text // │ │ ┌ Reason Code System SegmentPV2 = "PV2||1|reasonID^reasonText^reasonCodeSystem||||||||||||||||||||^^718004" SegmentEVN = "EVN|A01|20151127180000|||216865551019^ZZZDOCTOR^Foo^Bar Baz^^^^^DRNBR^PRSNL^^^ORGDR^" SegmentNK11 = "" /* 141-byte string literal not displayed */ SegmentNK12 = "" /* 132-byte string literal not displayed */ // ┌ Order discipline SegmentZCM = "ZCM|1|discipline||||" )
Variables ¶
var SegmentMSH = fmt.Sprintf(TemplateMSH, "ADT^A01")
SegmentMSH is an arbitrary MSH segment, for when the type does not matter.
Functions ¶
func AccountStatus ¶
AccountStatus returns the PV1.AccountStatus.
func DeathIndicator ¶
DeathIndicator returns the PatientDeathIndicator.
func EventDateTime ¶
EventDateTime returns the event's date time.
func MessageControlIDFromMSA ¶
MessageControlIDFromMSA returns the message control ID from the MSA segment.
func MessageControlIDFromMSH ¶
MessageControlIDFromMSH returns the message control ID from the MSH segment.
func MessageDateTime ¶
MessageDateTime returns the message's date time.
func MessageType ¶
MessageType returns this message's message type.
func OBXFieldsFromOBXs ¶
OBXFieldsFromOBXs applies the function f to all of the given OBX segments.
func OBXResultStatus ¶
OBXResultStatus returns the observation result status.
func ObservationValue ¶
ObservationValue returns this message's OBX observation value.
func OrderStatus ¶
OrderStatus returns OrderStatus from the ORC segment.
func PatientClass ¶
PatientClass returns the PV1.PatientClass.
func PlacerNumber ¶
PlacerNumber returns the PlacerOrderNumber.
func PointOfCare ¶
PointOfCare returns the point of care from the PV1.AssignedPatientLocation.
func PriorPatientIdentifierList ¶
PriorPatientIdentifierList returns the PriorPatientIdentifierList from the MRG segment.
func SendingApplication ¶
SendingApplication returns the message's sending application.
func SendingFacility ¶
SendingFacility returns the message's sending facility.
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.
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 ¶
SenderWithError returns a Sender that returns the provided error when Send() is invoked.
func (*Sender) EraseSentHistory ¶
func (s *Sender) EraseSentHistory()
EraseSentHistory erases the history of sent messages.
func (*Sender) GetSentMessages ¶
GetSentMessages returns the messages sent by this sender.