Documentation
¶
Index ¶
- Variables
- func CreateToken(user primitive.ObjectID) string
- func GetAuthToken(identityType string, roomName string) (map[string]string, error)
- func GetCredentials(data string) (username, password string, err error)
- func ImageAU(imgFilename string, outputDirectory string) (map[string]float64, error)
- func ImageMetrics(imgFilename string) (map[string]string, error)
- func NewResultChannel() chan ResultStruct
- func NewSalt() string
- func OpenConnection() *mongo.Client
- func RunCommand(cmd exec.Cmd) error
- func TextSentiment(text string) (float64, error)
- func VerifyLogin(data, userType string) (*primitive.ObjectID, error)
- type APIKeys
- type Aggregator
- type BlankSession
- type BlankUser
- type Entity
- type FrameMetrics
- type Grant
- type IntouchClient
- func (ic *IntouchClient) AddLink(id primitive.ObjectID, link string) error
- func (ic *IntouchClient) AssociatePatient(proID primitive.ObjectID, patID primitive.ObjectID) error
- func (ic *IntouchClient) AuthenticateUser(username string, password string, flag Entity) (*primitive.ObjectID, error)
- func (ic *IntouchClient) DeleteEntity(id primitive.ObjectID, flag Entity) error
- func (ic *IntouchClient) DeleteSessionMetric(id primitive.ObjectID, duration time.Duration) error
- func (ic *IntouchClient) DissociatePatient(proID primitive.ObjectID, patID primitive.ObjectID) error
- func (ic *IntouchClient) FindLatestSession(proUsername string, patUsername string) (*Session, error)
- func (ic *IntouchClient) FindPatient(filter bson.D) (*Patient, error)
- func (ic *IntouchClient) FindPatientByID(id primitive.ObjectID) (*Patient, error)
- func (ic *IntouchClient) FindProvider(filter bson.D) (*Provider, error)
- func (ic *IntouchClient) FindProviderByID(id primitive.ObjectID) (*Provider, error)
- func (ic *IntouchClient) FindSession(filter bson.D) (*Session, error)
- func (ic *IntouchClient) FindSessionByHexString(hexString string) (*Session, error)
- func (ic *IntouchClient) FindSessionByID(id primitive.ObjectID) (*Session, error)
- func (ic *IntouchClient) FindSessionByLink(link string) (*Session, error)
- func (ic *IntouchClient) FindSessionByUserID(id primitive.ObjectID, flag Entity) (*Session, error)
- func (ic *IntouchClient) FindSessions(filter bson.D) ([]Session, error)
- func (ic *IntouchClient) InsertFrameMetric(id primitive.ObjectID, metric FrameMetrics) error
- func (ic *IntouchClient) InsertSession(created int64, patient *UserRef, provider *UserRef) (*primitive.ObjectID, error)
- func (ic *IntouchClient) InsertTextMetric(id primitive.ObjectID, metric TextMetrics) error
- func (ic *IntouchClient) InsertUser(name string, username string, password string, flag Entity) (*primitive.ObjectID, error)
- func (ic *IntouchClient) IsLinkInUse(link string) bool
- func (ic *IntouchClient) IsUsernameInUse(username string) bool
- func (ic *IntouchClient) UpdateSessionSummary(session *Session) error
- func (ic *IntouchClient) UpdateUsername(id primitive.ObjectID, newusername string, flag Entity) error
- type LoginHandler
- type MyGrant
- type Patient
- type Provider
- type ResultStruct
- type Session
- type TextMetrics
- type TimestampMetrics
- type Twilio
- type UserCache
- type UserRef
- type WorkerHandler
Constants ¶
This section is empty.
Variables ¶
var AUTHRESHOLD = 3.75
Functions ¶
func CreateToken ¶
func GetAuthToken ¶
func GetCredentials ¶
func NewResultChannel ¶
func NewResultChannel() chan ResultStruct
func OpenConnection ¶
OpenConnection opens connection to mongo server and returns client
func RunCommand ¶
func TextSentiment ¶
Types ¶
type Aggregator ¶
type Aggregator struct {
// contains filtered or unexported fields
}
func AggregatorFromSession ¶
func AggregatorFromSession(session *Session) (*Aggregator, error)
type BlankSession ¶
BlankSession for inserting new document with random id rather than our own
type FrameMetrics ¶
type IntouchClient ¶
type IntouchClient struct { ProCol *mongo.Collection PatCol *mongo.Collection SesCol *mongo.Collection }
IntouchClient will add methods for easy transactions with db
func CreateIntouchClient ¶
func CreateIntouchClient(db string, client *mongo.Client) *IntouchClient
CreateIntouchClient uses mongo client to create collections for running queries
func (*IntouchClient) AddLink ¶
func (ic *IntouchClient) AddLink(id primitive.ObjectID, link string) error
func (*IntouchClient) AssociatePatient ¶
AssociatePatient adds patient to provider's list of patients, as well as provider to target patient's list of providers returns error, nil if ok
func (*IntouchClient) AuthenticateUser ¶
func (ic *IntouchClient) AuthenticateUser(username string, password string, flag Entity) (*primitive.ObjectID, error)
AuthenticateUser checks for a user (specify patient or provider with flag) with given username and password if result found, returns _id else nil and error
func (*IntouchClient) DeleteEntity ¶
func (ic *IntouchClient) DeleteEntity(id primitive.ObjectID, flag Entity) error
DeleteEntity deletes given entity with id (patient, provider, session, etc. based on flag), doesn't check if exists will also update references to deleted entity returns error, nil if ok
func (*IntouchClient) DeleteSessionMetric ¶
DeleteSessionMetric deletes a TimeStamp metric based on sentiment string from Session returns error, nil if ok
func (*IntouchClient) DissociatePatient ¶
func (ic *IntouchClient) DissociatePatient(proID primitive.ObjectID, patID primitive.ObjectID) error
DissociatePatient will remove patient and provider from each other's list returns error, nil if ok
func (*IntouchClient) FindLatestSession ¶
func (ic *IntouchClient) FindLatestSession(proUsername string, patUsername string) (*Session, error)
func (*IntouchClient) FindPatient ¶
func (ic *IntouchClient) FindPatient(filter bson.D) (*Patient, error)
FindPatient uses filter to find a patient matching the filter returns nil and err if it fails
func (*IntouchClient) FindPatientByID ¶
func (ic *IntouchClient) FindPatientByID(id primitive.ObjectID) (*Patient, error)
FindPatientByID helper for finding patient by id easily
func (*IntouchClient) FindProvider ¶
func (ic *IntouchClient) FindProvider(filter bson.D) (*Provider, error)
FindProvider uses filter to find a provider matching the filter returns nil and err if it fails
func (*IntouchClient) FindProviderByID ¶
func (ic *IntouchClient) FindProviderByID(id primitive.ObjectID) (*Provider, error)
FindProviderByID helper for finding provider by id easily
func (*IntouchClient) FindSession ¶
func (ic *IntouchClient) FindSession(filter bson.D) (*Session, error)
FindSession uses filter to find a session matching the filter returns nil and err if it fails
func (*IntouchClient) FindSessionByHexString ¶
func (ic *IntouchClient) FindSessionByHexString(hexString string) (*Session, error)
func (*IntouchClient) FindSessionByID ¶
func (ic *IntouchClient) FindSessionByID(id primitive.ObjectID) (*Session, error)
FindSessionByID helper for finding session by id easily
func (*IntouchClient) FindSessionByLink ¶
func (ic *IntouchClient) FindSessionByLink(link string) (*Session, error)
FindSessionByLink helper for finding session by link easily
func (*IntouchClient) FindSessionByUserID ¶
FindSessionByUserID helper for finding session by user id easily
func (*IntouchClient) FindSessions ¶
func (ic *IntouchClient) FindSessions(filter bson.D) ([]Session, error)
FindSessions uses filter to find sessions matching the filter returns nil and err if it fails
func (*IntouchClient) InsertFrameMetric ¶
func (ic *IntouchClient) InsertFrameMetric(id primitive.ObjectID, metric FrameMetrics) error
InsertSessionMetric adds a TimeStamp metric to a Session returns error, nil if ok
func (*IntouchClient) InsertSession ¶
func (ic *IntouchClient) InsertSession(created int64, patient *UserRef, provider *UserRef) (*primitive.ObjectID, error)
InsertSession inserts a session with link, created time, patient, and provider returns nil id and error if problems arise, else id and nil
func (*IntouchClient) InsertTextMetric ¶
func (ic *IntouchClient) InsertTextMetric(id primitive.ObjectID, metric TextMetrics) error
InsertSessionMetric adds a TimeStamp metric to a Session returns error, nil if ok
func (*IntouchClient) InsertUser ¶
func (ic *IntouchClient) InsertUser(name string, username string, password string, flag Entity) (*primitive.ObjectID, error)
InsertUser inserts a user with name, username, password and checks if username is valid uses flag to decide whether to insert patient or provider returns nil id and error if problems arise, else id and nil
func (*IntouchClient) IsLinkInUse ¶
func (ic *IntouchClient) IsLinkInUse(link string) bool
IsLinkInUse checks if link is already assigned to a session returns true if so, false otherwise
func (*IntouchClient) IsUsernameInUse ¶
func (ic *IntouchClient) IsUsernameInUse(username string) bool
IsUsernameInUse checks if username is already assigned to someone returns true if so, false otherwise
func (*IntouchClient) UpdateSessionSummary ¶
func (ic *IntouchClient) UpdateSessionSummary(session *Session) error
func (*IntouchClient) UpdateUsername ¶
func (ic *IntouchClient) UpdateUsername(id primitive.ObjectID, newusername string, flag Entity) error
UpdateUsername checks if submitted username is in use, if not then updates user of the type set in flag and (patient/provider) and session references to original username. returns error, nil if ok
type LoginHandler ¶
func NewLoginHandler ¶
func NewLoginHandler() LoginHandler
func (LoginHandler) AddLogin ¶
func (lh LoginHandler) AddLogin(user primitive.ObjectID, token, userType string) error
func (LoginHandler) Exists ¶
func (lh LoginHandler) Exists(token string) bool
func (LoginHandler) RemoveLogin ¶
func (lh LoginHandler) RemoveLogin(token string) error
func (LoginHandler) Size ¶
func (lh LoginHandler) Size() int
type Patient ¶
type Patient struct { ID primitive.ObjectID `bson:"_id"` Name string Username string Providers []UserRef // contains filtered or unexported fields }
Patient if referenced by Provider or Session then Salt, password, and Patients have no values
type Provider ¶
type Provider struct { ID primitive.ObjectID `bson:"_id"` Name string Username string Patients []UserRef // contains filtered or unexported fields }
Provider if referenced by Patient or Session then Salt, password, and Patients have no values
type ResultStruct ¶
type ResultStruct struct { Result interface{} Err error }
type Session ¶
type Session struct { ID primitive.ObjectID `bson:"_id"` Link string CreatedTime int64 Patient UserRef Provider UserRef TextMetrics []TextMetrics `bson:"text_metrics"` ImageMetrics []FrameMetrics `bson:"frame_metrics"` Summary map[string]interface{} }
Session will reference patient and provider by _id, name and username
type TextMetrics ¶
type TimestampMetrics ¶
type UserRef ¶
UserRef for appending user as a reference in a different doc user ToRef of Provider or Patient to create UserRef
type WorkerHandler ¶
type WorkerHandler struct { Workers chan bool // contains filtered or unexported fields }
func NewWorkerHandler ¶
func NewWorkerHandler(numWorkers int) *WorkerHandler
func (*WorkerHandler) SubmitJob ¶
func (wh *WorkerHandler) SubmitJob(resultChan chan ResultStruct, f func(idx int) (interface{}, error)) error