model

package
v0.0.0-...-ff699f0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ExerciseAdminRole is the role of the author of an exercise
	ExerciseAdminRole = "admin"
	// TrainerRole is the role for a trainer
	TrainerRole = "trainer"
	// RolePlayManagerRole is the role for an role play manager
	RolePlayManagerRole = "role play manager"
	// MakeUpCenterRole is the role for a make up center
	MakeUpCenterRole = "make-up center"
)

Functions

This section is empty.

Types

type Exercise

type Exercise struct {
	ID              primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	Author          LimitedUser        `json:"author" bson:"author"`
	CreatedAt       time.Time          `json:"createdAt" bson:"createdAt"`
	EditedAt        time.Time          `json:"editedAt" bson:"editedAt"`
	Title           string             `json:"title" bson:"title"`
	StartTime       time.Time          `json:"startTime" bson:"startTime"`
	EndTime         time.Time          `json:"endTime" bson:"endTime"`
	Teams           []ExerciseTeam     `json:"teams" bson:"teams"`
	RoleplayManager []LimitedUser      `json:"roleplayManager" bson:"roleplayManager"`
	MakeupCenter    []MakeupCenter     `json:"makeupCenter" bson:"makeupCenter"`
}

Exercise is a played exercise with different roles and injects

func (*Exercise) Validate

func (e *Exercise) Validate() (err error)

Validate validates an exercise if all necessary fields are filed. (title, start and end time, teams, role-play manager and make-up center)

type ExerciseShort

type ExerciseShort struct {
	ID        primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	Title     string             `json:"title" bson:"title"`
	StartTime time.Time          `json:"startTime" bson:"startTime"`
	EndTime   time.Time          `json:"endTime" bson:"endTime"`
}

ExerciseShort describes the short version of an exercise

type ExerciseTeam

type ExerciseTeam struct {
	Team    Team        `json:"team" bson:"team"`
	Trainer LimitedUser `json:"trainer" bson:"trainer"`
}

ExerciseTeam is the combination of team and trainer

type Expectations

type Expectations struct {
	Foe               string `json:"foe" bson:"foe"`
	TreatmentExpected string `json:"treatmentExpected" bson:"treatmentExpected"`
}

Expectations are the expected treatment for a vital sign

type Inject

type Inject struct {
	ID                primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	Author            LimitedUser        `json:"author" bson:"author"`
	Editor            LimitedUser        `json:"editor" bson:"editor"`
	CreatedAt         time.Time          `json:"createdAt" bson:"createdAt"`
	EditedAt          time.Time          `json:"editedAt" bson:"editedAt"`
	ExerciseID        primitive.ObjectID `json:"exerciseID" bson:"exerciseID"`
	Status            string             `json:"status" bson:"status"`
	StartTime         time.Time          `json:"startTime" bson:"startTime"`
	MakeupCenterTitle string             `json:"makeupCenterTitle" bson:"makeupCenterTitle"`
	Team              Team               `json:"team" bson:"team"`
	Roleplayer        struct {
		Fullname    string `json:"fullName" bson:"fullName"`
		Gender      string `json:"gender" bson:"gender"`
		Age         int    `json:"age" bson:"age"`
		Nationality string `json:"nationality" bson:"nationality"`
	} `json:"roleplayer" bson:"roleplayer"`
	MedicalCase MedicalCase `json:"medicalCase" bson:"medicalCase"`
}

Inject describes an medical inject of the exercise

func (*Inject) Validate

func (inject *Inject) Validate() (err error)

Validate validates an inject for its completeness

type InjectList

type InjectList struct {
	Count   int64         `json:"count"`
	Injects []InjectShort `json:"injects"`
}

InjectList is a list response of inject

type InjectQuery

type InjectQuery struct {
	ExerciseID        primitive.ObjectID `query:"exerciseId"`
	Author            string             `query:"author"`
	TeamID            string             `query:"teamId"`
	MakeupCenterTitle string             `query:"makeupCenterTitle"`
	Status            string             `query:"status"`
	Page              int                `query:"page"`
	PageSize          int                `query:"limit"`
}

InjectQuery is the query fields for the getter

type InjectShort

type InjectShort struct {
	ID                primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	Author            LimitedUser        `json:"author" bson:"author"`
	Editor            LimitedUser        `json:"editor" bson:"editor"`
	CreatedAt         time.Time          `json:"createdAt" bson:"createdAt"`
	EditedAt          time.Time          `json:"editedAt" bson:"editedAt"`
	ExerciseID        primitive.ObjectID `json:"exerciseID" bson:"exerciseID"`
	Status            string             `json:"status" bson:"status"`
	StartTime         time.Time          `json:"startTime" bson:"startTime"`
	MakeupCenterTitle string             `json:"makeupCenterTitle" bson:"makeupCenterTitle"`
	Team              Team               `json:"team" bson:"team"`
	Roleplayer        Roleplayer         `json:"roleplayer" bson:"roleplayer"`
	MedicalCase       MedicalCaseShort   `json:"medicalCase" bson:"medicalCase"`
}

InjectShort describes a minimal inject to display it in a list

type LimitedUser

type LimitedUser struct {
	ID       primitive.ObjectID `json:"id" form:"id" bson:"_id" query:"id"`
	Username string             `json:"username" form:"password" bson:"username" query:"username"`
	Email    string             `json:"email" form:"email" bson:"email" query:"email"`
	Code     string             `json:"code" form:"code" bson:"code,omitempty"`
}

LimitedUser describes a User with none vulnerable information

type MakeupCenter

type MakeupCenter struct {
	Title   string      `json:"title" bson:"title"`
	Account LimitedUser `json:"account" bson:"account"`
}

MakeupCenter is doing the makeup for the roleplayer

type MedicalCase

type MedicalCase struct {
	ID        primitive.ObjectID `json:"id" form:"id" bson:"_id,omitempty"`
	Author    LimitedUser        `json:"author" form:"author" bson:"author"`
	Editor    LimitedUser        `json:"editor" form:"editor" bson:"editor"`
	CreatedAt time.Time          `json:"createdAt" form:"createdAt" bson:"createdAt"`
	EditedAt  time.Time          `json:"editedAt" form:"editedAt" bson:"editedAt"`
	Approved  bool               `json:"approved" form:"approved" bson:"approved"`
	Title     string             `json:"title" form:"title" bson:"title"`
	General   struct {
		Discipline  []string `json:"discipline" form:"discipline" bson:"discipline"`
		Context     []string `json:"context" form:"context" bson:"context"`
		Scenario    []string `json:"scenario" form:"scenario" bson:"scenario"`
		PreHospital bool     `json:"preHospital" form:"preHospital" bson:"preHospital"`
		Medevac     bool     `json:"medevac" form:"medevac" bson:"medevac"`
	} `json:"general" form:"general" bson:"general"`
	Patient struct {
		Type   string   `json:"type" form:"type" bson:"type"`
		Triage string   `json:"triage" form:"triage" bson:"triage"`
		Gender []string `json:"gender" form:"gender" bson:"gender"`
		Age    string   `json:"age" form:"age" bson:"age"`
	} `json:"patient" form:"patient" bson:"patient"`
	Medical struct {
		Signs      string `json:"signs" form:"signs" bson:"signs"`
		Allergies  string `json:"allergies" form:"allergies" bson:"allergies"`
		Medication string `json:"medication" form:"medication" bson:"medication"`
		Past       string `json:"past" form:"past" bson:"past"`
		Loi        string `json:"loi" form:"loi" bson:"loi"`
		Events     string `json:"events" form:"events" bson:"events"`
	} `json:"medical" form:"medical" bson:"medical"`
	MakeUp struct {
		MakeUp string `json:"makeup" form:"makeup" bson:"makeup"`
		Acting string `json:"acting" form:"acting" bson:"acting"`
	} `json:"makeup" form:"makeup" bson:"makeup"`
	VitalSigns []NestedVitalSigns `json:"vitalSigns" form:"vitalSigns" bson:"vitalSigns"`
	Files      []MedicalCaseFile  `json:"files" bson:"files"`
}

MedicalCase describes a medical case for the injects

func (*MedicalCase) Validate

func (mc *MedicalCase) Validate() error

Validate validates the medical case

type MedicalCaseFile

type MedicalCaseFile struct {
	ID   primitive.ObjectID `json:"id" bson:"_id"`
	Name string             `json:"name" bson:"name"`
	Size int64              `json:"size" bson:"size"`
}

MedicalCaseFile describes a document stored at a medical case

type MedicalCaseList

type MedicalCaseList struct {
	Count        int64              `json:"count"`
	MedicalCases []MedicalCaseShort `json:"medicalCases"`
}

MedicalCaseList is a list response of medical cases

type MedicalCaseQuery

type MedicalCaseQuery struct {
	Title    string `query:"title"`
	Author   string `query:"author"`
	Page     int    `query:"page"`
	PageSize int    `query:"limit"`
}

MedicalCaseQuery is the query fields for the getter

type MedicalCaseShort

type MedicalCaseShort struct {
	ID       primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	Author   LimitedUser        `json:"author" bson:"author"`
	Title    string             `json:"title" bson:"title"`
	Approved bool               `json:"approved" bson:"approved"`
	General  struct {
		Discipline  []string `json:"discipline" form:"discipline" bson:"discipline"`
		Context     []string `json:"context" form:"context" bson:"context"`
		Scenario    []string `json:"scenario" form:"scenario" bson:"scenario"`
		PreHospital bool     `json:"preHospital" form:"preHospital" bson:"preHospital"`
		Medevac     bool     `json:"medevac" form:"medevac" bson:"medevac"`
	} `json:"general" form:"general" bson:"general"`
	Patient struct {
		Triage string   `json:"triage" form:"triage" bson:"triage"`
		Gender []string `json:"gender" form:"gender" bson:"gender"`
		Age    string   `json:"age" form:"age" bson:"age"`
	} `json:"patient" form:"patient" bson:"patient"`
}

MedicalCaseShort serves as the short Version of medical cases for lists.

type NestedVitalSigns

type NestedVitalSigns struct {
	Title  string             `json:"title" form:"title" bson:"title"`
	Data   VitalSigns         `json:"data" form:"data" bson:"data"`
	Childs []NestedVitalSigns `json:"childs" form:"childs" bson:"childs"`
}

NestedVitalSigns enable evolving cases

type Roleplayer

type Roleplayer struct {
	Fullname    string `json:"fullName" bson:"fullName"`
	Gender      string `json:"gender" bson:"gender"`
	Age         int    `json:"age" bson:"age"`
	Nationality string `json:"nationality" bson:"nationality"`
}

Roleplayer describes the role player who is playing a medical case

type Team

type Team struct {
	ID        primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	Author    LimitedUser        `json:"author" bson:"author"`
	Editor    LimitedUser        `json:"editor" bson:"editor"`
	CreatedAt time.Time          `json:"createdAt" bson:"createdAt"`
	EditedAt  time.Time          `json:"editedAt" bson:"editedAt"`
	Title     string             `json:"title" bson:"title"`
	Type      string             `json:"type" bson:"type"`
	Medivac   bool               `json:"medivac" bson:"medivac"`
}

Team describes a team taking part in the exercises

func (*Team) Validate

func (team *Team) Validate() error

Validate validates a team

type TeamQuery

type TeamQuery struct {
	Title    string `query:"title"`
	Author   string `query:"author"`
	Page     int    `query:"page"`
	PageSize int    `query:"limit"`
}

TeamQuery is the query fields for the getter

type TeamsList

type TeamsList struct {
	Count int64  `json:"count"`
	Teams []Team `json:"teams"`
}

TeamsList is a list response of teams

type Trainer

type Trainer struct {
	*UserRole
	Team Team `json:"team" bson:"team"`
}

Trainer describes a trainer role in an exercise

type User

type User struct {
	ID       primitive.ObjectID `json:"id" form:"id" bson:"_id,omitempty"`
	Username string             `json:"username" form:"username" bson:"username"`
	Email    string             `json:"email" form:"email" bson:"email,omitempty"`
	Password string             `json:"password,omitempty" form:"password" bson:"password"`
	Code     string             `json:"code,omitempty" form:"code" bson:"code,omitempty"`
	Roles    []UserRole         `json:"roles" form:"roles" bson:"roles"`
}

User is the type of a user

func (*User) Authenticate

func (user *User) Authenticate(password string) error

Authenticate checks if the user is matching to the given password.

func (*User) HashPassword

func (user *User) HashPassword() error

HashPassword hashes the users password for storing

func (*User) Validate

func (user *User) Validate() (err error)

Validate validates alle field of the user have a valid form

type UserQuery

type UserQuery struct {
	Username string `query:"username"`
	Email    string `query:"email"`
	Page     int    `query:"page"`
	PageSize int    `query:"limit"`
}

UserQuery describes a query format or the user

type UserRole

type UserRole struct {
	Role     string         `json:"role" bson:"role"`
	Exercise *ExerciseShort `json:"exercise" bson:"exercise"`
}

UserRole describes a management role in an exercise

type VitalSigns

type VitalSigns struct {
	// Onset of symptoms
	OoS                    string       `json:"oos" form:"oos" bson:"oos"`
	AVPU                   string       `json:"avpu" form:"avpu" bson:"avpu"`
	Mobility               string       `json:"mobility" form:"mobility" bson:"mobility"`
	RespiratoryRate        *int         `json:"respiratoryRate" form:"respiratoryRate" bson:"respiratoryRate"`
	Pulse                  *int         `json:"pulse" form:"pulse" bson:"pulse"`
	Temperature            *float32     `json:"temperature" form:"temperature" bson:"temperature"`
	CapillaryRefill        *float32     `json:"capillaryRefill" form:"capillaryRefill" bson:"capillaryRefill"`
	BloodPressureSystolic  *int         `json:"bloodPressureSystolic" form:"bloodPressureSystolic" bson:"bloodPressureSystolic"`
	BloodPressureDiastolic *int         `json:"bloodPressureDiastolic" form:"bloodPressureDiastolic" bson:"bloodPressureDiastolic"`
	OxygenSaturation       *int         `json:"oxygenSaturation" form:"oxygenSaturation" bson:"oxygenSaturation"`
	Expectations           Expectations `json:"expectations" bson:"Expectations"`
}

VitalSigns are describing the vital signs in a medical case

Jump to

Keyboard shortcuts

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