generator

package
v0.0.0-...-d424132 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package generator implements functionality to generate various patient related information, including, but not limited to: - person information, ie: name, surname, ethnicity, address, etc., - patient type and class, - orders and test results, - allergies, - diagnosis, - procedures.

The data is generated based on information provided in the pathway.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Clock            clock.Clock
	HL7Config        *config.HL7Config
	Header           *config.Header
	AddressGenerator person.AddressGenerator
	MRNGenerator     id.Generator
	PlacerGenerator  id.Generator
	FillerGenerator  id.Generator

	NotesGenerator   order.NotesGenerator
	DateGenerator    codedelement.DateGenerator
	Data             *config.Data
	Doctors          *doctor.Doctors
	MsgCtrlGenerator *header.MessageControlGenerator
	OrderProfiles    *orderprofile.OrderProfiles
	// contains filtered or unexported fields
}

Config contains the configuration for Generator.

type Generator

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

Generator implements functionality to generate various patient related information based on the information provided in the pathway.

func NewGenerator

func NewGenerator(cfg Config) *Generator

NewGenerator creates a new Generator.

func (Generator) AddAllergies

func (g Generator) AddAllergies(patientInfo *ir.PatientInfo, allergies []pathway.Allergy)

AddAllergies adds allergies specified in the pathway to the patientInfo:

  • If there are any allergies specified in the pathways, they are always added to existing allergies on the patientInfo.
  • If the allergies were not specified in the pathway (ie. allergies is nil) and the allergies on the patientInfo have not been initialised yet (ie are also nil), initialise them to an empty slice (to make sure we'll not make an attempt to generate them on the next ADT-like event, as that would increase the likelihood of the patient having allergies), and then generate them.
  • If the allergies from the pathway are explicitly set to empty slice, the allergies on the patient info are also set to empty slice.

func (Generator) NewDoctor

func (g Generator) NewDoctor(c *pathway.Consultant) *ir.Doctor

NewDoctor returns a new doctor based on the Consultant information from the pathway. If consultant is not specified, it returns a random doctor. Otherwise, it attempts to lookup an existic doctor basd on consultant ID. If any doctor is found, it returns it. Othwerise creates a new doctor from Consultant information, with the default speciality defined in messageConfig.HospitalService.

func (Generator) NewDocument

func (g Generator) NewDocument(eventTime time.Time, d *pathway.Document) *ir.Document

NewDocument returns a NewDocument for MDM^T02 messages.

func (*Generator) NewHeader

func (g *Generator) NewHeader(step *pathway.Step) *message.HeaderInfo

NewHeader returns a new header for the given step.

func (Generator) NewOrder

func (g Generator) NewOrder(o *pathway.Order, eventTime time.Time) *ir.Order

NewOrder returns a new order based on order information from the pathway and eventTime.

func (Generator) NewPatient

func (g Generator) NewPatient(person *ir.Person, doctor *ir.Doctor) *state.Patient

NewPatient returns a new patient based on Person information and a doctor provided.

func (Generator) NewPerson

func (g Generator) NewPerson(pathwayPerson *pathway.Person) *ir.Person

NewPerson returns a new person based on pathway.Person.

func (Generator) NewRegistrationPatientClassAndType

func (g Generator) NewRegistrationPatientClassAndType() *config.PatientClassAndType

NewRegistrationPatientClassAndType returns a PatientClassAndType for a patient newly registered.

func (Generator) NewVisitID

func (g Generator) NewVisitID() uint64

NewVisitID generates a new visit identifier.

func (Generator) OrderWithClinicalNote

func (g Generator) OrderWithClinicalNote(ctx context.Context, o *ir.Order, n *pathway.ClinicalNote, eventTime time.Time) (*ir.Order, error)

OrderWithClinicalNote creates an order with a Clinical Note based on the pathway.

func (Generator) ResetPatient

func (g Generator) ResetPatient(p *state.Patient) *state.Patient

ResetPatient returns a Patient based on the given Patient. Medical History (Orders, Encounters) and general information is kept, but other information is cleared as if the patient was a new patient.

func (Generator) SetResults

func (g Generator) SetResults(o *ir.Order, r *pathway.Results, eventTime time.Time) (*ir.Order, error)

SetResults sets results on an existing Order based on the results information from the pathway. If order is nil, this also creates an Order using details in pathway.Result. Returns an error of the retults cannot be created.

func (Generator) UpdateDocumentContent

func (g Generator) UpdateDocumentContent(dm *ir.Document, dp *pathway.Document) error

UpdateDocumentContent updates the given document for MDM^T02 messages.

func (Generator) UpdateFromPathway

func (g Generator) UpdateFromPathway(patientInfo *ir.PatientInfo, updatePerson *pathway.UpdatePerson)

UpdateFromPathway updates PatientInfo with information from pathway. It Updates: - person information - diagnoses - procedures - allergies

Directories

Path Synopsis
Package address contains functionality to generate addresses.
Package address contains functionality to generate addresses.
Package codedelement contains functionality to generate Coded Elements that have a Code and a Description.
Package codedelement contains functionality to generate Coded Elements that have a Code and a Description.
Package document contains functions needed to generate a ir.Document object.
Package document contains functions needed to generate a ir.Document object.
Package header contains functionality to generate headers.
Package header contains functionality to generate headers.
Package id provides the functionality to generate identifiers.
Package id provides the functionality to generate identifiers.
Package names provides functionality to generate names for humans.
Package names provides functionality to generate names for humans.
Package notes contains functions needed to generate a ir.ClinicalNote object given the pathway.ClinicalNote object.
Package notes contains functions needed to generate a ir.ClinicalNote object given the pathway.ClinicalNote object.
Package order provides functionality to generate order and set results.
Package order provides functionality to generate order and set results.
Package person provides functionality to generate a person.
Package person provides functionality to generate a person.
Package text contains functions needed to generate random sentences.
Package text contains functions needed to generate random sentences.

Jump to

Keyboard shortcuts

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