Documentation ¶
Overview ¶
Package runner implements the main functionality of Simulated Hospital.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIEndpointAndHandler ¶
type APIEndpointAndHandler struct { EndpointAndHandler HTTPMethod string }
APIEndpointAndHandler defines a Simulated Hospital API endpoint and its handler.
type Config ¶
type Config struct { // AdditionalDashboardEndpoints is a slice of endpoints and their handlers. // The root path for these endpoints will be the Simulated Hospital dashboard address. AdditionalDashboardEndpoints []EndpointAndHandler // AuthenticatedAPIConfig is the API config for authenticated endpoints. AuthenticatedAPIConfig APIConfig // AuthenticatedEndpoints is a slice of API endpoints and their handlers. // The root path for these endpoints will be the API root path. AuthenticatedEndpoints []APIEndpointAndHandler // PathwayStarter is a starter of pathways through an endpoint. PathwayStarter *starter.PathwayStarter // PathwaysPerHour indicates how often new pathways are generated. PathwaysPerHour float64 // MaxPathways is the number of pathways to run before stopping. // If negative, Simulated Hospital will keep running pathways indefinitely. MaxPathways int // DashboardURI is the base URI path at which the simulated hospital dashboard and // endpoints are available, e.g., /simulated-hospital/. Note that this needs to match // the data-path on elements in index.html. DashboardURI string // DashboardAddress is the port on which the simulated hospital is accessible. // The value is expected to be in the form :int, e.g. :8000. DashboardAddress string // DashboardStaticDir is the directory for static assets for the dashboard. DashboardStaticDir string // MetricsAddress is the address for the /metrics endpoint. MetricsAddress string // SleepFor represents the interval at which the queues are checked. SleepFor time.Duration // Clock is the clock for the hospital. Clock clock.Clock }
Config contains optional configuration options for Simulated Hospital Runner used to extend the main functionality.
type EndpointAndHandler ¶
type EndpointAndHandler struct { Endpoint string Handler func(http.ResponseWriter, *http.Request) }
EndpointAndHandler defines a Simulated Hospital endpoint and its handler.
type Hospital ¶
type Hospital struct {
// contains filtered or unexported fields
}
Hospital wraps the hospital.Hospital and implements the run functionality.
func (*Hospital) Close ¶
Close closes resources held by the Hospital. Should be called if the Hospital is no longer needed or at the program exit.
func (*Hospital) ProcessMessages ¶
ProcessMessages processes (e.g. sends) the HL7 messages. Returns an error if the context is Done.
func (*Hospital) Run ¶
Run starts the Simulated Hospital. It starts multiple servers including the Simulated Hospital dashboard. The following happens in parallel and continuously while Simulated Hospital is running:
- Start pathways, which create events (e.g., patients are admitted in the hospital, test results, etc.).
- Run those events at the appropriate time, which generates HL7 messages.
- Process HL7 messages at the appropriate time.
The processing of pathways, events and messages can finish if Hospital.maxPathways is negative, otherwise Run() runs forever. When the creation of pathways finishes, we can stop processing events after all our current events are processed. When processing events finishes, we can stop processing messages after all our current messages are processed. If this happens, all servers are stopped and this method returns.
Directories ¶
Path | Synopsis |
---|---|
Package authentication provides functionality for authentication.
|
Package authentication provides functionality for authentication. |