study

package
v0.0.0-...-4780336 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TEMPORARY_PARTICIPANT_TAKEOVER_PERIOD = 24 * 60 * 60 // seconds - after this period, the temporary participant is considered to be inactive and cannot be used anymore
)

Variables

This section is empty.

Functions

func ComputeConfidentialIDForParticipant

func ComputeConfidentialIDForParticipant(study studyTypes.Study, participantID string) (string, error)

func ComputeParticipantIDs

func ComputeParticipantIDs(study studyTypes.Study, profileID string) (string, string, error)

func EvalCustomExpressionForParticipant

func EvalCustomExpressionForParticipant(instanceID, studyKey, participantID string, expression studyTypes.Expression) (val interface{}, err error)

func Init

func Init(
	studyDB *studydb.StudyDBService,
	gSecret string,
	externalServices []studyengine.ExternalService,
)

func OnCustomStudyEvent

func OnCustomStudyEvent(instanceID string, studyKey string, profileID string, eventKey string, payload map[string]interface{}) (result []studyTypes.AssignedSurvey, err error)

func OnEnterStudy

func OnEnterStudy(instanceID string, studyKey string, profileID string) (result []studyTypes.AssignedSurvey, err error)

func OnLeaveStudy

func OnLeaveStudy(instanceID string, studyKey string, profileID string) (result []studyTypes.AssignedSurvey, err error)

func OnMergeTempParticipant

func OnMergeTempParticipant(instanceID string, studyKey string, profileID string, temporaryParticipantID string) (result []studyTypes.AssignedSurvey, err error)

func OnProfileDeleted

func OnProfileDeleted(instanceID, profileID string, exitSurveyResp *studyTypes.SurveyResponse)

func OnRegisterTempParticipant

func OnRegisterTempParticipant(instanceID string, studyKey string) (pState *studyTypes.Participant, err error)

func OnStudyTimer

func OnStudyTimer(instanceID string, study *studyTypes.Study)

Run study timer event for participants

func OnSubmitResponse

func OnSubmitResponse(instanceID string, studyKey string, profileID string, response studyTypes.SurveyResponse) (result []studyTypes.AssignedSurvey, err error)

func OnSubmitResponseForTempParticipant

func OnSubmitResponseForTempParticipant(instanceID string, studyKey string, participantID string, response studyTypes.SurveyResponse) (result []studyTypes.AssignedSurvey, err error)

Types

type AssignedSurveyWithContext

type AssignedSurveyWithContext struct {
	Survey  *studyTypes.Survey         `json:"survey"`
	Context *SurveyContext             `json:"context,omitempty" `
	Prefill *studyTypes.SurveyResponse `json:"prefill,omitempty"`
}

func GetAssignedSurveyWithContext

func GetAssignedSurveyWithContext(instanceID string, studyKey string, surveyKey string, profileID string) (surveyWithContent AssignedSurveyWithContext, err error)

func GetSurveyWithContextForTempParticipant

func GetSurveyWithContextForTempParticipant(instanceID string, studyKey string, surveyKey string, tempParticipantID string) (surveyWithContent AssignedSurveyWithContext, err error)

type AssignedSurveysWithInfos

type AssignedSurveysWithInfos struct {
	Surveys     []studyTypes.AssignedSurvey `json:"surveys"`
	SurveyInfos []*SurveyInfo               `json:"surveyInfos"`
}

func GetAssignedSurveys

func GetAssignedSurveys(instanceID string, studyKey string, profileIDs []string) (surveysWithInfos AssignedSurveysWithInfos, err error)

func GetAssignedSurveysForTempParticipant

func GetAssignedSurveysForTempParticipant(instanceID string, studyKey string, participantID string) (surveysWithInfos AssignedSurveysWithInfos, err error)

type RunStudyActionProgressFn

type RunStudyActionProgressFn func(totalCount int64, processedCount int64)

type RunStudyActionReq

type RunStudyActionReq struct {
	InstanceID           string
	StudyKey             string
	OnlyForParticipantID string
	Rules                []types.Expression
	OnProgressFn         RunStudyActionProgressFn
}

type RunStudyActionResult

type RunStudyActionResult struct {
	ParticipantCount               int64
	ParticipantStateChangedPerRule []int64
	Duration                       int64
}

func OnRunStudyAction

func OnRunStudyAction(req RunStudyActionReq) (*RunStudyActionResult, error)

func OnRunStudyActionForPreviousResponses

func OnRunStudyActionForPreviousResponses(req RunStudyActionReq, surveyKeys []string, from int64, to int64) (*RunStudyActionResult, error)

type SubmissionEntry

type SubmissionEntry struct {
	ProfileID string `json:"profileID"`
	Timestamp int64  `json:"timestamp"`
	SurveyKey string `json:"surveyKey"`
	VersionID string `json:"versionID"`
}

type SubmissionHistory

type SubmissionHistory struct {
	Submissions []SubmissionEntry `json:"submissions"`
	SurveyInfos []*SurveyInfo     `json:"surveyInfos"`
}

func GetSubmissionHistory

func GetSubmissionHistory(instanceID string, studyKey string, profileIDs []string, limit int64) (submissionHistory SubmissionHistory, err error)

type SurveyContext

type SurveyContext struct {
	Mode              string                      `json:"mode,omitempty"`
	PreviousResponses []studyTypes.SurveyResponse `json:"previousResponses,omitempty"`
	ParticipantFlags  map[string]string           `json:"participantFlags,omitempty"`
}

type SurveyInfo

type SurveyInfo struct {
	SurveyKey       string                       `json:"surveyKey"`
	StudyKey        string                       `json:"studyKey"`
	Name            []studyTypes.LocalisedObject `json:"name"`
	Description     []studyTypes.LocalisedObject `json:"description"`
	TypicalDuration []studyTypes.LocalisedObject `json:"typicalDuration"`
	VersionID       string                       `json:"versionID"`
}

Directories

Path Synopsis
exporter

Jump to

Keyboard shortcuts

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