assessment

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	RiskUnassessed = "unassessed"
	RiskUnknown    = "unknown"
	RiskRed        = "red"
	RiskYellow     = "yellow"
	RiskGreen      = "green"
)

Assessment risk

View Source
const (
	StatusEmpty    = "empty"
	StatusStarted  = "started"
	StatusComplete = "complete"
)

Assessment status

View Source
const (
	AdjusterRed    = 0.5
	AdjusterYellow = 0.98
)

Confidence adjustment

View Source
const (
	MultiplierRed    = 0.6
	MultiplierYellow = 0.95
)

Confidence multiplier.

View Source
const (
	WeightRed     = 1
	WeightYellow  = 80
	WeightGreen   = 100
	WeightUnknown = 70
)

Risk weights

Variables

This section is empty.

Functions

func Confidence

func Confidence(assessments []Assessment) (confidence int)

Confidence returns a total confidence score for a group of assessments.

func PrepareForApplication

func PrepareForApplication(tagResolver *TagResolver, application *model.Application, assessment *model.Assessment)

PrepareForApplication prepares the sections of an assessment by including, excluding, or auto-answering questions based on a set of tags.

func PrepareForArchetype

func PrepareForArchetype(tagResolver *TagResolver, archetype *model.Archetype, assessment *model.Assessment)

PrepareForArchetype prepares the sections of an assessment by including, excluding, or auto-answering questions based on a set of tags.

func Risk

func Risk(assessments []Assessment) (risk string)

Risk returns the single highest risk score for a group of assessments.

Types

type Application

type Application struct {
	*model.Application
	Assessments []Assessment
}

Application represents an Application with its assessments.

func (*Application) With

func (r *Application) With(m *model.Application)

With updates the Application with the db model and deserializes its assessments.

type ApplicationResolver

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

ApplicationResolver wraps an Application model with archetype and assessment resolution behavior.

func NewApplicationResolver

func NewApplicationResolver(m *model.Application, tags *TagResolver, membership *MembershipResolver, questionnaire *QuestionnaireResolver) (a *ApplicationResolver)

NewApplicationResolver creates a new ApplicationResolver from an application and other shared resolvers.

func (*ApplicationResolver) ArchetypeTags

func (r *ApplicationResolver) ArchetypeTags() (tags []model.Tag, err error)

ArchetypeTags returns the list of tags that the application should inherit from the archetypes it is a member of.

func (*ApplicationResolver) Archetypes

func (r *ApplicationResolver) Archetypes() (archetypes []Archetype, err error)

Archetypes returns the list of archetypes the application is a member of.

func (*ApplicationResolver) Assessed

func (r *ApplicationResolver) Assessed() (assessed bool, err error)

Assessed returns whether the application has been fully assessed.

func (*ApplicationResolver) AssessmentTags

func (r *ApplicationResolver) AssessmentTags() (tags []model.Tag)

AssessmentTags returns the list of tags that the application should inherit from the answers given to its assessments or those of its archetypes. Archetype assessments are only inherited if the application does not have any answers to required questionnaires.

func (*ApplicationResolver) Confidence

func (r *ApplicationResolver) Confidence() (confidence int, err error)

Confidence returns the application's overall assessment confidence score.

func (*ApplicationResolver) RequiredAssessments

func (r *ApplicationResolver) RequiredAssessments() (required []Assessment)

RequiredAssessments returns the slice of assessments that are for required questionnaires.

func (*ApplicationResolver) Risk

func (r *ApplicationResolver) Risk() (risk string, err error)

Risk returns the overall risk level for the application based on its or its archetypes' assessments.

type Archetype

type Archetype struct {
	*model.Archetype
	Assessments []Assessment
}

Archetype represents an Archetype with its assessments.

func (*Archetype) With

func (r *Archetype) With(m *model.Archetype)

With updates the Archetype with the db model and deserializes its assessments.

type ArchetypeResolver

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

ArchetypeResolver wraps an Archetype model with assessment-related functionality.

func NewArchetypeResolver

func NewArchetypeResolver(m *model.Archetype, tags *TagResolver, membership *MembershipResolver, questionnaire *QuestionnaireResolver) (a *ArchetypeResolver)

NewArchetypeResolver creates a new ArchetypeResolver.

func (*ArchetypeResolver) Applications

func (r *ArchetypeResolver) Applications() (applications []Application, err error)

Applications returns the archetype's member applications.

func (*ArchetypeResolver) Assessed

func (r *ArchetypeResolver) Assessed() (assessed bool)

Assessed returns whether the archetype has been fully assessed.

func (*ArchetypeResolver) AssessmentTags

func (r *ArchetypeResolver) AssessmentTags() (tags []model.Tag)

AssessmentTags returns the list of tags that the archetype should inherit from the answers given to its assessments.

func (*ArchetypeResolver) Confidence

func (r *ArchetypeResolver) Confidence() (confidence int)

Confidence returns the archetype's overall assessment confidence score.

func (*ArchetypeResolver) RequiredAssessments

func (r *ArchetypeResolver) RequiredAssessments() (required []Assessment)

RequiredAssessments returns the slice of assessments that are for required questionnaires.

func (*ArchetypeResolver) Risk

func (r *ArchetypeResolver) Risk() (risk string)

Risk returns the overall risk level for the archetypes' assessments.

type Assessment

type Assessment struct {
	*model.Assessment
}

Assessment represents a deserialized Assessment.

func (*Assessment) Complete

func (r *Assessment) Complete() bool

Complete returns whether all sections have been completed.

func (*Assessment) Confidence

func (r *Assessment) Confidence() (score int)

Confidence calculates a confidence score based on the answers to an assessment's questions. The algorithm is a reimplementation of the calculation done by Pathfinder.

func (*Assessment) Prepare added in v0.6.0

func (r *Assessment) Prepare(tagResolver *TagResolver, tags Set)

func (*Assessment) Risk

func (r *Assessment) Risk() string

Risk calculates the risk level (red, yellow, green, unknown) for the application.

func (*Assessment) Started

func (r *Assessment) Started() bool

Started returns whether any sections have been started.

func (*Assessment) Status

func (r *Assessment) Status() string

Status returns the started status of the assessment.

func (*Assessment) Tags added in v0.6.0

func (r *Assessment) Tags() (tags []model.CategorizedTag)

func (*Assessment) With

func (r *Assessment) With(m *model.Assessment)

With updates the Assessment with the db model and deserializes its fields.

type MembershipResolver

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

MembershipResolver resolves archetype membership.

func NewMembershipResolver

func NewMembershipResolver(db *gorm.DB) (m *MembershipResolver)

NewMembershipResolver builds a MembershipResolver.

func (*MembershipResolver) Applications

func (r *MembershipResolver) Applications(m Archetype) (applications []Application, err error)

Applications returns the list of applications that are members of the given archetype.

func (*MembershipResolver) Archetypes

func (r *MembershipResolver) Archetypes(app Application) (archetypes []Archetype, err error)

Archetypes returns the list of archetypes that the application is a member of.

type QuestionnaireResolver

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

QuestionnaireResolver resolves questionnaire logic.

func NewQuestionnaireResolver

func NewQuestionnaireResolver(db *gorm.DB) (a *QuestionnaireResolver, err error)

NewQuestionnaireResolver builds a QuestionnaireResolver.

func (*QuestionnaireResolver) Assessed

func (r *QuestionnaireResolver) Assessed(assessments []Assessment) (assessed bool)

Assessed returns whether a slice contains a completed assessment for each of the required questionnaires.

func (*QuestionnaireResolver) Required

func (r *QuestionnaireResolver) Required(id uint) (required bool)

Required returns whether a questionnaire is required.

type Set

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

Set is an unordered collection of uints with no duplicate elements.

func NewSet

func NewSet() (s Set)

NewSet builds a new Set.

func (Set) Add

func (r Set) Add(members ...uint)

Add a member to the set.

func (Set) Contains

func (r Set) Contains(element uint) bool

Contains returns whether an element is a member of the set.

func (Set) Intersects

func (r Set) Intersects(other Set) bool

Intersects tests whether this set and the other have at least one element in common.

func (Set) Members

func (r Set) Members() []uint

Members returns the members of the set as a slice.

func (Set) Size

func (r Set) Size() int

Size returns the number of members in the set.

func (Set) Subset

func (r Set) Subset(other Set, strict bool) bool

Subset tests whether every element of this set is in the other.

func (Set) Superset

func (r Set) Superset(other Set, strict bool) bool

Superset tests whether every element of other is in the set.

type TagResolver

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

TagResolver resolves CategorizedTags to Tag models.

func NewTagResolver

func NewTagResolver(db *gorm.DB) (t *TagResolver, err error)

NewTagResolver builds a TagResolver.

func (*TagResolver) Assessment

func (r *TagResolver) Assessment(assessment Assessment) (tags []model.Tag)

Assessment returns all the Tag models that should be applied from the assessment.

func (*TagResolver) Resolve

func (r *TagResolver) Resolve(category string, tag string) (t *model.Tag, found bool)

Resolve a category and tag name to a Tag model.

Jump to

Keyboard shortcuts

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