hl7ids

package
v0.0.0-...-e69eef7 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package hl7ids contains utilities to get identifiers from HL7v2 messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllMRNs

func GetAllMRNs(pid *hl7.PID) []hl7.CX

GetAllMRNs returns all MRNs from the PID, using the default options.

func GetAllMRNsWithOptions

func GetAllMRNsWithOptions(pid *hl7.PID, opts *Options) []hl7.CX

GetAllMRNsWithOptions returns all MRNs from the PID, using the provided options.

func GetMRNNumber

func GetMRNNumber(pid *hl7.PID) string

GetMRNNumber retrieves the primary MRN number from the provided PID segment using the default options.

func GetMRNNumberWithOptions

func GetMRNNumberWithOptions(pid *hl7.PID, opts *Options) string

GetMRNNumberWithOptions retrieves the primary MRN number from the provided PID segment using the provided options.

func GetNHSNumber

func GetNHSNumber(pid *hl7.PID) string

GetNHSNumber retrieves the primary MRN number from the provided PID segment using the default options.

func GetNHSNumberWithOptions

func GetNHSNumberWithOptions(pid *hl7.PID, opts *Options) string

GetNHSNumberWithOptions retrieves the primary MRN number from the provided PID segment using the provided options.

func HasKeywordInAnyField

func HasKeywordInAnyField(cx hl7.CX, keyword string) bool

HasKeywordInAnyField returns whether an identifier of type CX contains "keyword" in its Identifier Type Code, Assigning Facility, Assigning Authority or Code Identifying The Check Digit Scheme Employedfields.

func NHSNumberIsValid

func NHSNumberIsValid(nhs string) bool

NHSNumberIsValid returns whether the given NHS Number is valid. An explanation of this algorithm can be found here: http://www.datadictionary.nhs.uk/version2/data_dictionary/data_field_notes/n/nhs_number_de.asp?shownav=0

Types

type Options

type Options struct {
	// The PID fields to look for, in this order, to find the MRNs. Values other than 2, 3 or 4 are ignored.
	MRNFrom []int
	// The function to apply to hl7.CX elements to check whether the item is a valid MRN.
	IsValidMRN func(hl7.CX) bool
	// The PID fields to look for, in this order, to find the NHS number. Values other than 2, 3 or 4 are ignored.
	NHSFrom []int
	// The function to apply to hl7.CX elements to check whether the item is a valid MRN.
	IsValidNHS func(hl7.CX) bool
}

Options contains the configuration for getting identifiers.

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions returns the default options.

Jump to

Keyboard shortcuts

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