study

package
v0.0.0-...-45ce995 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 12 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)

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 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"`
}

Directories

Path Synopsis
exporter

Jump to

Keyboard shortcuts

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