Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SortEventsByDate ¶
func SortEventsByDate(events []Event)
SortEventsByDate sorts the events by their date
func SortResultsByAsOfDate ¶
func SortResultsByAsOfDate(results []RiskServiceCalculationResult)
SortResultsByAsOfDate sorts the results by their as-of date
Types ¶
type EventStream ¶
EventStream represents a patient and an ordered stream of events
func NewEventStream ¶
func NewEventStream(patient *models.Patient) *EventStream
NewEventStream creates a new EventStream for the given patient, initialized to 0 events
func (*EventStream) Clone ¶
func (es *EventStream) Clone() *EventStream
Clone does a shallow copy of the EventStream. This is most helpful in case plugins modify the event stream.
type NotApplicableError ¶
type NotApplicableError struct {
// contains filtered or unexported fields
}
NotApplicableError indicates that the given algorithm is not applicable for the requested patient. It would be inappropriate to return a score.
func NewNotApplicableError ¶
func NewNotApplicableError(msg string) NotApplicableError
NewNotApplicableError returns a new NotApplicableError with the given message.
func (NotApplicableError) Error ¶
func (e NotApplicableError) Error() string
type Pie ¶
type Pie struct { Id bson.ObjectId `bson:"_id" json:"id"` Slices []Slice `json:"slices"` Patient string `json:"patient"` Created time.Time `json:"created"` }
Pie represents the chart in Intervention Engine. Since the chart can't be represented in FHIR, the RiskAssessment basis will point back to one of these.
func NewPie ¶
NewPie constructs a new pie for the given patient, sets the Create time to now, and generates a new ID. Slices are initially empty.
func (*Pie) Clone ¶
Clone creates a copy of the pie. If generateNewID is true, it will give the clone a new identity. Slices of the clone can be modified without affecting the original.
func (*Pie) TotalValues ¶
TotalValues sums up all the values in the slices.
func (*Pie) UpdateSliceValue ¶
UpdateSliceValue is a convenience function that finds the slice with the given name and updates its value.
type RiskServiceCalculationResult ¶
type RiskServiceCalculationResult struct { AsOf time.Time Score *int ProbabilityDecimal *float64 Pie *Pie }
RiskServiceCalculationResult represents risk assessment info for a given point in time. The Score indicates a raw score from the algorithm (if applicable), while the ProbabilityDecimal represents a percentage probability of the predicted outcome. Since it is a percentage, the value should never exceed 100.
func (*RiskServiceCalculationResult) GetProbabilityDecimalOrScore ¶
func (r *RiskServiceCalculationResult) GetProbabilityDecimalOrScore() *float64
GetProbabilityDecimalOrScore returns the ProbabilityDecimal value if it exists, otherwise it returns the score. This approach preserves backwards compatibility with existing code, but should be reconsidered.
func (*RiskServiceCalculationResult) ToRiskAssessment ¶
func (r *RiskServiceCalculationResult) ToRiskAssessment(patientId string, basisPieURL string, config RiskServicePluginConfig) *models.RiskAssessment
ToRiskAssessment converts the RiskServiceCalculationResult to a FHIR RiskAssessment.
type RiskServicePlugin ¶
type RiskServicePlugin interface { // Config returns the configuration information for the risk service plugin Config() RiskServicePluginConfig // Calculate accepts an EventStream and returns the slice of // RiskServiceCalculationResults that corresponds to the event stream. This // results slice represents risks over time, with the last element being the // most recent risk assessment. Calculate(es *EventStream, fhirEndpointURL string) ([]RiskServiceCalculationResult, error) }
RiskServicePlugin provides the interface that risk service plugins should adhere to. This pertains only to this implementation -- as the only real interface that matters is the FHIR API. But... this provides an easy entry point for Go-based risk services.
type RiskServicePluginConfig ¶
type RiskServicePluginConfig struct { Name string Method models.CodeableConcept PredictedOutcome models.CodeableConcept DefaultPieSlices []Slice RequiredResourceTypes []string SignificantBirthdays []int }
RiskServicePluginConfig represents key information about the risk service plugin.