Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetReport added in v0.6.3

func GetReport(obx []Report) (r entity.Report)

func HandleByMsgType

func HandleByMsgType(store HL7Store, data []byte) (string, int, error)

func New

func New(store HL7Store, client HealthcareClient, debugMode bool) http.Handler

func NewPubSubMessage

func NewPubSubMessage(body io.Reader) (*pubSubMessage, error)

Types

type API

type API struct {
	Store  HL7Store
	Client HealthcareClient
	// contains filtered or unexported fields
}

type CE added in v0.6.3

type CE struct {
	Identifier      string `hl7:"1"`
	Text            string `hl7:"2"`
	CodingSystem    string `hl7:"3"`
	AltIdentifier   string `hl7:"4"`
	AltText         string `hl7:"5"`
	AltCodingSystem string `hl7:"6"`
}

Coded Element

type CM_DICT added in v0.7.6

type CM_DICT struct {
	SubmitDT string `hl7:"1"`
	StartDT  string `hl7:"2"`
	EndDT    string `hl7:"3"`
}

Dictation Times (custom composite)

type CM_MSG added in v0.6.3

type CM_MSG struct {
	Name         string `hl7:"1"`
	TriggerEvent string `hl7:"2"`
}

Messate Type

type CM_NDL added in v0.6.3

type CM_NDL struct {
	ObservingPractitioner XCN    `hl7:"1"`
	ObservationDT         string `hl7:"3"`
}

Observing Practitioner (i.e. radiologist)

type CX added in v0.6.3

type CX struct {
	ID                 string `hl7:"1"`
	CheckDigit         string `hl7:"2"`
	CheckDigitScheme   string `hl7:"3"`
	AssigningAuthority string `hl7:"4"`
	IdentifierTypeCode string `hl7:"5"`
}

Extended Composite ID

type Exam added in v0.6.3

type Exam struct {
	Accession        string `hl7:"ORC.2"`
	FillerOrderNo    string `hl7:"ORC.3"`
	OrderStatus      string `hl7:"ORC.5"`
	OrderDT          string `hl7:"ORC.9"`
	OrderingProvider XCN    `hl7:"ORC.12"`
	Service          CE     `hl7:"OBR.4"`
	Priority         string `hl7:"OBR.5"`
	StatusDT         string `hl7:"OBR.22"`
}

func (*Exam) ToEntity added in v0.6.3

func (e *Exam) ToEntity(site entity.Site) (exam entity.Exam)

type HL7Store added in v0.6.3

type HL7Store interface {
	SaveORM(context.Context, *entity.Order) error
	SaveORU(context.Context, *entity.Observation) error
	// TODO: already, I can see how this will get out of hand
	// think of another design pattern that decouples the storing logic
	// but still allows us to conveniently add handlers
	GetProcedures(context.Context, int32) ([]byte, error)
	UpdateProcedures(context.Context, []byte) (int, int, error)
}

type HealthcareClient

type HealthcareClient interface {
	GetHL7V2Message(string) ([]byte, error)
}

type Hl7Client

type Hl7Client healthcare.Service

func NewHl7Client

func NewHl7Client(ctx context.Context, opts ...option.ClientOption) (*Hl7Client, error)

func (*Hl7Client) GetHL7V2Message

func (h *Hl7Client) GetHL7V2Message(messagePath string) ([]byte, error)

type Message added in v0.6.3

type Message struct {
	FieldSeparator string `hl7:"MSH.1"`
	EncodingChars  string `hl7:"MSH.2"`
	SendingApp     string `hl7:"MSH.3"`
	SendingFac     string `hl7:"MSH.4"`
	ReceivingApp   string `hl7:"MSH.5"`
	ReceivingFac   string `hl7:"MSH.6"`
	DateTime       string `hl7:"MSH.7"`
	MsgType        CM_MSG `hl7:"MSH.9"`
	ControlID      string `hl7:"MSH.10"`
	ProcessingID   string `hl7:"MSH.11"`
	Version        string `hl7:"MSH.12"`
}

type ORM added in v0.6.3

type ORM struct {
	FieldSeparator   string `hl7:"MSH.1"`
	EncodingChars    string `hl7:"MSH.2"`
	SendingApp       string `hl7:"MSH.3"`
	SendingFac       string `hl7:"MSH.4"`
	ReceivingApp     string `hl7:"MSH.5"`
	ReceivingFac     string `hl7:"MSH.6"`
	DateTime         string `hl7:"MSH.7"`
	MsgType          CM_MSG `hl7:"MSH.9"`
	ControlID        string `hl7:"MSH.10"`
	ProcessingID     string `hl7:"MSH.11"`
	Version          string `hl7:"MSH.12"`
	MRN              CX     `hl7:"PID.3"`
	PatientName      XPN    `hl7:"PID.5"`
	DOB              string `hl7:"PID.7"`
	Sex              string `hl7:"PID.8"`
	SSN              string `hl7:"PID.19"`
	VisitNo          string `hl7:"PV1.19"`
	PatientClass     string `hl7:"PV1.2"`
	AssignedLocation PL     `hl7:"PV1.3"`
	Accession        string `hl7:"ORC.2"`
	FillerOrderNo    string `hl7:"ORC.3"`
	OrderStatus      string `hl7:"ORC.5"`
	OrderDT          string `hl7:"ORC.9"`
	OrderingProvider XCN    `hl7:"ORC.12"`
	Service          CE     `hl7:"OBR.4"`
	Priority         string `hl7:"OBR.5"`
	StatusDT         string `hl7:"OBR.22"`
}

func (*ORM) ToOrder added in v0.6.3

func (o *ORM) ToOrder() *entity.Order

type ORU added in v0.6.3

type ORU struct {
	FieldSeparator   string  `hl7:"MSH.1"`
	EncodingChars    string  `hl7:"MSH.2"`
	SendingApp       string  `hl7:"MSH.3"`
	SendingFac       string  `hl7:"MSH.4"`
	ReceivingApp     string  `hl7:"MSH.5"`
	ReceivingFac     string  `hl7:"MSH.6"`
	DateTime         string  `hl7:"MSH.7"`
	MsgType          CM_MSG  `hl7:"MSH.9"`
	ControlID        string  `hl7:"MSH.10"`
	ProcessingID     string  `hl7:"MSH.11"`
	Version          string  `hl7:"MSH.12"`
	MRN              CX      `hl7:"PID.3"`
	PatientName      XPN     `hl7:"PID.5"`
	DOB              string  `hl7:"PID.7"`
	Sex              string  `hl7:"PID.8"`
	SSN              string  `hl7:"PID.19"`
	VisitNo          string  `hl7:"PV1.19"`
	PatientClass     string  `hl7:"PV1.2"`
	AssignedLocation PL      `hl7:"PV1.3"`
	DictationTimes   CM_DICT `hl7:"ORC.7"`
}

func (*ORU) ToObservation added in v0.6.3

func (o *ORU) ToObservation(report entity.Report, exams ...Exam) *entity.Observation

type PL added in v0.6.3

type PL struct {
	PointOfCare         string `hl7:"1"`
	Room                string `hl7:"2"`
	Bed                 string `hl7:"3"`
	Facility            string `hl7:"4"`
	LocationStatus      string `hl7:"5"`
	PersonLocationType  string `hl7:"6"`
	Building            string `hl7:"7"`
	Floor               string `hl7:"8"`
	LocationDescription string `hl7:"9"`
}

Person Location

type Report added in v0.6.3

type Report struct {
	Radiologist      CM_NDL `hl7:"OBR.32"`
	SetID            string `hl7:"OBX.1"`
	ValueType        string `hl7:"OBX.2"`
	Service          CE     `hl7:"OBX.3"`
	ObservationSubID string `hl7:"OBX.4"`
	ObservationValue string `hl7:"OBX.5"`
	ResultStatus     string `hl7:"OBX.11"`
	ObservationDT    string `hl7:"OBX.14"`
}

type XCN added in v0.6.3

type XCN struct {
	IDNumber   string `hl7:"1"`
	LastName   string `hl7:"2"`
	FirstName  string `hl7:"3"`
	MiddleName string `hl7:"4"`
	Suffix     string `hl7:"5"`
	Prefix     string `hl7:"6"`
	Degree     string `hl7:"7"`
}

Extended Composite ID & Name

type XPN added in v0.6.3

type XPN struct {
	LastName   string `hl7:"1"`
	FirstName  string `hl7:"2"`
	MiddleName string `hl7:"3"`
	Suffix     string `hl7:"4"`
	Prefix     string `hl7:"5"`
	Degree     string `hl7:"6"`
}

Extended Person Name

Jump to

Keyboard shortcuts

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