Documentation ¶
Overview ¶
Package hardcoded contains features to manage hardcoded messages in Simulated Hospital. Messages are filtered according to a user-supplied regular expression. A single message is selected from the filtered messages, according to a uniform distribution. Its missing fields are filled in, according to user-supplied values and a unique MessageControlID is added, so that the message is considered unique by the downstream processes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager contains all hardcoded messages.
func NewManager ¶
func NewManager(ctx context.Context, messageDir string, headerGenerator *header.MessageControlGenerator) (*Manager, error)
NewManager returns a Manager for the messages contained in the given directory.
func (Manager) Message ¶
func (m Manager) Message(toIncludeRegex string, p *ir.Person, t time.Time) (*message.HL7Message, error)
Message returns a uniformly random hardcoded message from the set of messages with names that match the provided regular expression. If the chosen hardcoded message has a PID segment placeholder, this will be filled in with a PID segment based on the provided Person argument. Otherwise, the PID segment will be left as it is. If there aren't any messages that match the provided regular expression or if the regular expression is malformed, this method returns an error.