Documentation
¶
Index ¶
- Variables
- type Claims
- type CrowdSourcedUser
- type DBStudy
- type DBStudyTask
- type DBUser
- type FeedbackQuestionnaireResponse
- type HTTPStatus
- type MapStringInterface
- type Organization
- type ParticipantData
- type SliceMapStringInterface
- type Study
- type StudyTask
- type StudyUser
- type StudyUserSummary
- type Task
- type User
Constants ¶
This section is empty.
Variables ¶
var CrowdSourcedUserSchema = `` /* 387-byte string literal not displayed */
var FeedbackQuestionnaireResponseSchema = `` /* 407-byte string literal not displayed */
StudySchema defines the SQL table schema for this model
var OrganizationSchema = `` /* 185-byte string literal not displayed */
OrganizationSchema defines the SQL table schema for this model
var ParticipantDataSchema = `` /* 448-byte string literal not displayed */
ParticipantDataSchema defines the SQL table schema for this model
var StudySchema = `` /* 610-byte string literal not displayed */
StudySchema defines the SQL table schema for this model
var StudyTaskSchema = `` /* 332-byte string literal not displayed */
StudyTaskSchema defines the SQL table schema for this model Composite primary key between studyId and taskOrder
var StudyUserSchema = `` /* 528-byte string literal not displayed */
StudyUserSchema defines the SQL table schema for this model
var TaskSchema = `` /* 444-byte string literal not displayed */
TaskSchema defines the SQL table schema for this model * NOTE: a task is defined as a thing within the study that the participant must do/see at a specific index * (can be psych task, info slide, questionnaire, etc)
var UserSchema = `` /* 547-byte string literal not displayed */
UserSchema defines the SQL table schema for this model
Functions ¶
This section is empty.
Types ¶
type Claims ¶
type Claims struct {
UserID string
Email string
Role string
jwt.StandardClaims
}
Claims represents a model for JWT
type CrowdSourcedUser ¶
type DBStudy ¶
type DBStudy struct {
ID uint `json:"id"`
OwnerId uint `json:"ownerId"`
CreatedAt time.Time `json:"createdAt"`
DeletedAt sql.NullTime `json:"deletedAt"`
InternalName string `json:"internalName"`
ExternalName string `json:"externalName"`
Started bool `json:"started"`
CanEdit bool `json:"canEdit"`
ConsentId uint `json:"consentId"`
Description string `json:"description"`
Config MapStringInterface `json:"config"`
Snapshots MapStringInterface `json:"snapshots"`
}
DBStudy is the database representation of a study
type DBStudyTask ¶
type DBStudyTask struct {
StudyID uint `json:"studyId"`
TaskID uint `json:"taskId"`
TaskOrder int `json:"taskOrder"`
Config MapStringInterface `json:"config"`
}
DBStudyTask is the database representation of a study task
type DBUser ¶
type DBUser struct {
ID uint `json:"id"`
Name string `json:"name"`
OrganizationId sql.NullInt32 `json:"organizationId"` // this can potentially be null in the db
Email string `json:"email"`
Password string `json:"password"`
Role string `json:"role"`
CreatedAt time.Time `json:"createdAt"`
ChangePasswordRequired bool `json:"changePasswordRequired"`
Lang string `json:"lang"`
}
internal DB representation of user
type FeedbackQuestionnaireResponse ¶
type FeedbackQuestionnaireResponse struct {
StudyId uint `json:"studyId"`
UserID string `json:"userId"`
IssuesEncountered string `json:"issuesEncountered"`
AdditionalFeedback string `json:"additionalFeedback"`
SubmittedAt time.Time `json:"submittedAt"`
Browser string `json:"browser"`
ParticipantType string `json:"participantType"`
}
FeedbackQuestionnaireResponse represents the feedback given by participants about the experiment
type HTTPStatus ¶
HTTPStatus represents the model for a HTTP response
type MapStringInterface ¶
type MapStringInterface map[string]interface{}
we define this type in order to allow for flexible json in golang
func (*MapStringInterface) Scan ¶
func (m *MapStringInterface) Scan(src interface{}) error
reads json columns from mysql and parses them into mapstringinterface The data stored in a JSON field is returned as a []uint8
type Organization ¶
type ParticipantData ¶
type ParticipantData struct {
UserID string `json:"userId"`
StudyID uint `json:"studyId"`
TaskOrder int `json:"taskOrder"`
ParticipantType string `json:"participantType"`
SubmittedAt time.Time `json:"submittedAt"`
Metadata MapStringInterface `json:"metadata"`
Data SliceMapStringInterface `json:"data"`
}
ParticipantData represents a model for storing all participant data including psych task responses and questionnaires. Will make manually defining structs for each task obsolete (aka all of the above structs)
type SliceMapStringInterface ¶
type SliceMapStringInterface []MapStringInterface
func (*SliceMapStringInterface) Scan ¶
func (s *SliceMapStringInterface) Scan(src interface{}) error
reads json columns from mysql and parses them into mapstringinterface The data stored in a JSON field is returned as a []uint8
type Study ¶
type Study struct {
ID uint `json:"id"`
Owner User `json:"owner"`
CreatedAt time.Time `json:"createdAt"`
DeletedAt sql.NullTime `json:"deletedAt"`
InternalName string `json:"internalName"`
ExternalName string `json:"externalName"`
Started bool `json:"started"`
CanEdit bool `json:"canEdit"`
Consent Task `json:"consent"`
Description string `json:"description"`
Config MapStringInterface `json:"config"`
StudyTasks []StudyTask `json:"studyTasks"`
Snapshots MapStringInterface `json:"snapshots"`
}
Study represents a model for a set of tasks
type StudyTask ¶
type StudyTask struct {
StudyID uint `json:"studyId"` // studyTasks are often embedded within studies, so we just store the ID to prevent an infinite loop
Task Task `json:"task"`
TaskOrder int `json:"taskOrder"`
Config MapStringInterface `json:"config"`
}
StudyTask represents a many to many relationship between study and tasks
type StudyUser ¶
type StudyUser struct {
UserID uint `json:"userId"`
StudyID uint `json:"studyId"`
CompletionCode string `json:"completionCode"`
RegisterDate time.Time `json:"registerDate"`
DueDate sql.NullTime `json:"dueDate"`
CurrentTaskIndex int `json:"currentTaskIndex"`
HasAcceptedConsent bool `json:"hasAcceptedConsent"`
Lang string `json:"lang"`
Data MapStringInterface `json:"data"`
}
StudyUser represents a join table between studies and users, tracking the progress and registration of users within a study
type StudyUserSummary ¶
StudyUserSummary
type Task ¶
type Task struct {
ID uint `json:"id"`
FromPlatform string `json:"fromPlatform"`
TaskType string `json:"taskType"`
Name string `json:"name"`
Description string `json:"description"`
ExternalURL string `json:"externalURL"`
Config MapStringInterface `json:"config"` // will either store task metadata or questionnaire metadata
}
Task represents the most basic configuration for the tasks in sharplab
type User ¶
type User struct {
ID uint `json:"id"`
Name string `json:"name"`
Organization *Organization `json:"organization"` // set to a pointer so that the returned json is null if pointer points to a nil value
Email string `json:"email"`
Password string `json:"password"`
Role string `json:"role"`
CreatedAt time.Time `json:"createdAt"`
ChangePasswordRequired bool `json:"changePasswordRequired"`
Lang string `json:"lang"`
}
User represents a model for a user