Documentation ¶
Index ¶
- Constants
- type AssignedSurvey
- type ComponentProperties
- type Expression
- type ExpressionArg
- type FileInfo
- type FileObjectReference
- type ItemComponent
- type LocalisedObject
- type MaxItemsPerPage
- type NotificationSubscription
- type Participant
- type ParticipantMessage
- type Report
- type ReportData
- type ResponseItem
- type ResponseMeta
- type Study
- type StudyConfigs
- type StudyMessage
- type StudyProps
- type StudyRules
- type StudyStats
- type Style
- type Survey
- type SurveyContextDef
- type SurveyItem
- type SurveyItemResponse
- type SurveyProps
- type SurveyResponse
- type Tag
- type Task
- type Validation
Constants ¶
View Source
const ( ASSIGNED_SURVEY_CATEGORY_PRIO = "prio" ASSIGNED_SURVEY_CATEGORY_NORMAL = "normal" ASSIGNED_SURVEY_CATEGORY_QUICK = "quick" ASSIGNED_SURVEY_CATEGORY_UPDATE = "update" )
View Source
const ( PARTICIPANT_STUDY_STATUS_ACTIVE = "active" PARTICIPANT_STUDY_STATUS_TEMPORARY = "temporary" // for participants without a registered account PARTICIPANT_STUDY_STATUS_EXITED = "exited" PARTICIPANT_STUDY_STATUS_ACCOUNT_DELETED = "accountDeleted" )
View Source
const ( FILE_STATUS_UPLOADING = "uploading" FILE_STATUS_READY = "ready" )
View Source
const ( STUDY_STATUS_ACTIVE = "active" STUDY_STATUS_INACTIVE = "inactive" )
View Source
const ( SURVEY_ITEM_TYPE_PAGE_BREAK = "pageBreak" SURVEY_ITEM_TYPE_END = "surveyEnd" )
View Source
const ( SURVEY_AVAILABLE_FOR_PUBLIC = "public" SURVEY_AVAILABLE_FOR_TEMPORARY_PARTICIPANTS = "temporary_participants" SURVEY_AVAILABLE_FOR_ACTIVE_PARTICIPANTS = "active_participants" SURVEY_AVAILABLE_FOR_PARTICIPANTS_IF_ASSIGNED = "participants_if_assigned" )
View Source
const ( TASK_STATUS_IN_PROGRESS = "in_progress" TASK_STATUS_COMPLETED = "completed" TASK_FILE_TYPE_JSON = "application/json" TASK_FILE_TYPE_CSV = "text/csv" )
View Source
const (
DEFAULT_ID_MAPPING_METHOD = "sha-256"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssignedSurvey ¶
type AssignedSurvey struct { StudyKey string `bson:"studyKey" json:"studyKey"` SurveyKey string `bson:"surveyKey" json:"surveyKey"` ValidFrom int64 `bson:"validFrom" json:"validFrom"` ValidUntil int64 `bson:"validUntil" json:"validUntil"` Category string `bson:"category" json:"category"` ProfileID string `bson:"profileID" json:"profileID"` // optional when sending surveys to multiple profiles }
type ComponentProperties ¶
type ComponentProperties struct { Min *ExpressionArg `bson:"min,omitempty" json:"min,omitempty"` Max *ExpressionArg `bson:"max,omitempty" json:"max,omitempty"` StepSize *ExpressionArg `bson:"stepSize,omitempty" json:"stepSize,omitempty"` DateInputMode *ExpressionArg `bson:"dateInputMode,omitempty" json:"dateInputMode,omitempty"` Pattern string `bson:"pattern,omitempty" json:"pattern,omitempty"` }
type Expression ¶
type Expression struct { Name string `bson:"name" json:"name"` // Name of the operation to be evaluated ReturnType string `bson:"returnType,omitempty" json:"returnType,omitempty"` Data []ExpressionArg `bson:"data,omitempty" json:"data,omitempty"` // Operation arguments Metadata struct { SlotTypes []*string `bson:"slotTypes,omitempty" json:"slotTypes,omitempty"` } `bson:"metadata,omitempty" json:"metadata,omitempty"` }
type ExpressionArg ¶
type ExpressionArg struct { DType string `bson:"dtype" json:"dtype"` Exp *Expression `bson:"exp,omitempty" json:"exp,omitempty"` Str string `bson:"str,omitempty" json:"str,omitempty"` Num float64 `bson:"num,omitempty" json:"num,omitempty"` }
func (ExpressionArg) IsExpression ¶
func (exp ExpressionArg) IsExpression() bool
func (ExpressionArg) IsNumber ¶
func (exp ExpressionArg) IsNumber() bool
func (ExpressionArg) IsString ¶
func (exp ExpressionArg) IsString() bool
type FileInfo ¶
type FileInfo struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` ParticipantID string `bson:"participantID,omitempty" json:"participantID,omitempty"` Status string `bson:"status,omitempty" json:"status,omitempty"` UploadedBy string `bson:"uploadedBy,omitempty" json:"uploadedBy,omitempty"` // if not uploaded by the participant Path string `bson:"path,omitempty" json:"path,omitempty"` PreviewPath string `bson:"previewPath,omitempty" json:"previewPath,omitempty"` SubStudy string `bson:"subStudy,omitempty" json:"subStudy,omitempty"` SubmittedAt int64 `bson:"submittedAt,omitempty" json:"submittedAt,omitempty"` FileType string `bson:"fileType,omitempty" json:"fileType,omitempty"` VisibleToParticipant bool `bson:"visibleToParticipant,omitempty" json:"visibleToParticipant,omitempty"` Name string `bson:"name,omitempty" json:"name,omitempty"` Size int32 `bson:"size,omitempty" json:"size,omitempty"` ReferencedIn []FileObjectReference `bson:"referencedIn,omitempty" json:"referencedIn,omitempty"` }
func (*FileInfo) AddReference ¶
func (f *FileInfo) AddReference(ref FileObjectReference) error
func (*FileInfo) RemoveReference ¶
type FileObjectReference ¶
type ItemComponent ¶
type ItemComponent struct { Role string `bson:"role" json:"role"` Key string `bson:"key" json:"key"` Content []LocalisedObject `bson:"content" json:"content"` DisplayCondition *Expression `bson:"displayCondition,omitempty" json:"displayCondition,omitempty"` Disabled *Expression `bson:"disabled,omitempty" json:"disabled,omitempty"` // group component Items []ItemComponent `bson:"items,omitempty" json:"items,omitempty"` Order *Expression `bson:"order,omitempty" json:"order,omitempty"` // response compontent Dtype string `bson:"dtype,omitempty" json:"dtype,omitempty"` Properties *ComponentProperties `bson:"properties,omitempty" json:"properties,omitempty"` Style []Style `bson:"style,omitempty" json:"style,omitempty"` Description []LocalisedObject `bson:"description" json:"description"` }
type LocalisedObject ¶
type LocalisedObject struct { Code string `bson:"code" json:"code"` // For texts Parts []ExpressionArg `bson:"parts" json:"parts"` }
type MaxItemsPerPage ¶
type Participant ¶
type Participant struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` ParticipantID string `bson:"participantID" json:"participantId"` // reference to the study specific participant ID CurrentStudySession string `bson:"currentStudySession" json:"currentStudySession"` EnteredAt int64 `bson:"enteredAt" json:"enteredAt"` StudyStatus string `bson:"studyStatus" json:"studyStatus"` // shows if participant is active in the study - possible values: "active", "temporary", "exited". Other values are possible and are handled like "exited" on the server. Flags map[string]string `bson:"flags" json:"flags"` AssignedSurveys []AssignedSurvey `bson:"assignedSurveys" json:"assignedSurveys"` LastSubmissions map[string]int64 `bson:"lastSubmission" json:"lastSubmissions"` // surveyKey with timestamp Messages []ParticipantMessage `bson:"messages" json:"messages"` }
Participant defines the datamodel for current state of the participant in a study as stored in the database
type ParticipantMessage ¶
type Report ¶
type Report struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` Key string `bson:"key" json:"key"` ParticipantID string `bson:"participantID" json:"participantID"` // reference to the study specific participant ID ResponseID string `bson:"responseID" json:"responseID"` // reference to the report Timestamp int64 `bson:"timestamp" json:"timestamp"` Data []ReportData `bson:"data" json:"data,omitempty"` }
type ReportData ¶
type ResponseItem ¶
type ResponseItem struct { Key string `bson:"key" json:"key"` Value string `bson:"value,omitempty" json:"value,omitempty"` Dtype string `bson:"dtype,omitempty" json:"dtype,omitempty"` // for response option groups Items []*ResponseItem `bson:"items,omitempty" json:"items,omitempty"` }
type ResponseMeta ¶
type ResponseMeta struct { Position int32 `bson:"position" json:"position"` LocaleCode string `bson:"localeCode" json:"localeCode"` // timestamps Rendered []int64 `bson:"rendered" json:"rendered"` Displayed []int64 `bson:"displayed" json:"displayed"` Responded []int64 `bson:"responded" json:"responded"` }
type Study ¶
type Study struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` Key string `bson:"key" json:"key"` SecretKey string `bson:"secretKey" json:"secretKey"` Status string `bson:"status" json:"status"` Props StudyProps `bson:"props" json:"props"` Configs StudyConfigs `bson:"configs" json:"configs"` NotificationSubscriptions []NotificationSubscription `bson:"notificationSubscriptions" json:"notificationSubscriptions"` // depracted fields potentially to be removed in the future Stats StudyStats `bson:"studyStats" json:"stats"` NextTimerEvent int64 `bson:"nextTimerEvent" json:"nextTimerEvent"` Rules []Expression `bson:"rules" json:"rules"` }
type StudyConfigs ¶
type StudyConfigs struct { ParticipantFileUploadRule *Expression `bson:"participantFileUploadRule" json:"participantFileUploadRule"` IdMappingMethod string `bson:"idMappingMethod" json:"idMappingMethod"` }
type StudyMessage ¶
type StudyMessage struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` Type string `bson:"type,omitempty" json:"type,omitempty"` Payload map[string]string `bson:"payload,omitempty" json:"payload,omitempty"` ParticipantID string `bson:"participantID,omitempty" json:"participantID,omitempty"` }
type StudyProps ¶
type StudyProps struct { Name []LocalisedObject `bson:"name" json:"name"` Description []LocalisedObject `bson:"description" json:"description"` Tags []Tag `bson:"tags" json:"tags"` StartDate int64 `bson:"startDate" json:"startDate"` EndDate int64 `bson:"endDate" json:"endDate"` SystemDefaultStudy bool `bson:"systemDefaultStudy" json:"systemDefaultStudy"` }
type StudyRules ¶
type StudyRules struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` StudyKey string `bson:"studyKey" json:"studyKey"` UploadedAt int64 `bson:"uploadedAt" json:"uploadedAt"` UploadedBy string `bson:"uploadedBy" json:"uploadedBy"` Rules []Expression `bson:"rules,omitempty" json:"rules"` SerialisedRules string `bson:"serialisedRules,omitempty" json:"serialisedRules,omitempty"` }
func (*StudyRules) MarshalRules ¶
func (studyRules *StudyRules) MarshalRules() error
func (*StudyRules) UnmarshalRules ¶
func (studyRules *StudyRules) UnmarshalRules() error
type StudyStats ¶
type Survey ¶
type Survey struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` SurveyKey string `bson:"surveyKey,omitempty" json:"surveyKey,omitempty"` Props SurveyProps `bson:"props,omitempty" json:"props,omitempty"` PrefillRules []Expression `bson:"prefillRules,omitempty" json:"prefillRules,omitempty"` ContextRules *SurveyContextDef `bson:"contextRules,omitempty" json:"contextRules,omitempty"` MaxItemsPerPage *MaxItemsPerPage `bson:"maxItemsPerPage,omitempty" json:"maxItemsPerPage,omitempty"` AvailableFor string `bson:"availableFor,omitempty" json:"availableFor,omitempty"` RequireLoginBeforeSubmission bool `bson:"requireLoginBeforeSubmission,omitempty" json:"requireLoginBeforeSubmission,omitempty"` Published int64 `bson:"published,omitempty" json:"published,omitempty"` Unpublished int64 `bson:"unpublished,omitempty" json:"unpublished,omitempty"` SurveyDefinition SurveyItem `bson:"surveyDefinition,omitempty" json:"surveyDefinition,omitempty"` VersionID string `bson:"versionID,omitempty" json:"versionId,omitempty"` Metadata map[string]string `bson:"metadata,omitempty" json:"metadata,omitempty"` }
type SurveyContextDef ¶
type SurveyContextDef struct { Mode *ExpressionArg `bson:"mode,omitempty" json:"mode,omitempty"` PreviousResponses []Expression `bson:"previousResponses,omitempty" json:"previousResponses,omitempty"` }
type SurveyItem ¶
type SurveyItem struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` Key string `bson:"key" json:"key"` Follows []string `bson:"follows,omitempty" json:"follows,omitempty"` Condition *Expression `bson:"condition,omitempty" json:"condition,omitempty"` Priority float32 `bson:"priority,omitempty" json:"priority,omitempty"` Metadata map[string]string `bson:"metadata,omitempty" json:"metadata,omitempty"` // Question group attributes Items []SurveyItem `bson:"items,omitempty" json:"items,omitempty"` SelectionMethod *Expression `bson:"selectionMethod,omitempty" json:"selectionMethod,omitempty"` // Question attributes Type string `bson:"type,omitempty" json:"type,omitempty"` // Specify some special types e.g. 'pageBreak','surveyEnd' Components *ItemComponent `bson:"components,omitempty" json:"components,omitempty"` Validations []Validation `bson:"validations,omitempty" json:"validations,omitempty"` ConfidentialMode string `bson:"confidentialMode,omitempty" json:"confidentialMode,omitempty"` MapToKey string `bson:"mapToKey,omitempty" json:"mapToKey,omitempty"` // map to this key for confidential mode }
type SurveyItemResponse ¶
type SurveyItemResponse struct { Key string `bson:"key" json:"key"` Meta ResponseMeta `bson:"meta" json:"meta"` // for groups: Items []SurveyItemResponse `bson:"items,omitempty" json:"items,omitempty"` // for single items: Response *ResponseItem `bson:"response,omitempty" json:"response,omitempty"` ConfidentialMode string `bson:"confidentialMode,omitempty" json:"confidentialMode,omitempty"` MapToKey string `bson:"mapToKey,omitempty" json:"mapToKey,omitempty"` // map to this key for confidential mode }
type SurveyProps ¶
type SurveyProps struct { Name []LocalisedObject `bson:"name,omitempty" json:"name,omitempty"` Description []LocalisedObject `bson:"description,omitempty" json:"description,omitempty"` TypicalDuration []LocalisedObject `bson:"typicalDuration,omitempty" json:"typicalDuration,omitempty"` }
type SurveyResponse ¶
type SurveyResponse struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` Key string `bson:"key" json:"key"` ParticipantID string `bson:"participantID" json:"participantId"` VersionID string `bson:"versionID" json:"versionId"` OpenedAt int64 `bson:"openedAt" json:"openedAt"` SubmittedAt int64 `bson:"submittedAt" json:"submittedAt"` ArrivedAt int64 `bson:"arrivedAt" json:"arrivedAt"` Responses []SurveyItemResponse `bson:"responses" json:"responses"` Context map[string]string `bson:"context" json:"context"` }
type Tag ¶
type Tag struct {
Label []LocalisedObject `bson:"label" json:"label"`
}
type Task ¶
type Task struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` CreatedAt time.Time `bson:"createdAt" json:"createdAt"` CreatedBy string `bson:"createdBy" json:"createdBy"` UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"` Status string `bson:"status" json:"status"` TargetCount int `bson:"targetCount" json:"targetCount"` ProcessedCount int `bson:"processedCount" json:"processedCount"` ResultFile string `bson:"resultFile" json:"resultFile"` FileType string `bson:"fileType" json:"fileType"` Error string `bson:"error,omitempty" json:"error,omitempty"` }
type Validation ¶
type Validation struct { Key string `bson:"key" json:"key"` Type string `bson:"type" json:"type"` // kind of validation : 'soft' or 'hard' Rule Expression `bson:"expression" json:"rule"` }
Click to show internal directories.
Click to hide internal directories.