Documentation
¶
Index ¶
- Constants
- func ComputeConfidentialIDForParticipant(study studyTypes.Study, participantID string) (string, error)
- func ComputeParticipantIDs(study studyTypes.Study, profileID string) (string, string, error)
- func EvalCustomExpressionForParticipant(instanceID, studyKey, participantID string, expression studyTypes.Expression) (val interface{}, err error)
- func GetLinkingCode(instanceID string, studyKey string, profileID string, key string) (value string, err error)
- func Init(studyDB *studydb.StudyDBService, gSecret string, ...)
- func IsAllowedToUploadFile(instanceID string, studyKey string, profileID string, fileSize int64, ...) (allowed bool, forParticipantID string)
- func MergeParticipantLastSubmissions(baseState, mergeFromState studyTypes.Participant) studyTypes.Participant
- func OnCustomStudyEvent(instanceID string, studyKey string, profileID string, eventKey string, ...) (result []studyTypes.AssignedSurvey, err error)
- func OnCustomStudyEventOnBehalfOfParticipant(instanceID string, studyKey string, participantID string, eventKey string, ...) (result []studyTypes.AssignedSurvey, err error)
- func OnEnterStudy(instanceID string, studyKey string, profileID string) (result []studyTypes.AssignedSurvey, err error)
- func OnForceMergeParticipants(instanceID string, studyKey string, targetParticipantID string, ...) (result studyTypes.Participant, err error)
- func OnLeaveStudy(instanceID string, studyKey string, profileID string) (result []studyTypes.AssignedSurvey, err error)
- func OnMergeTempParticipant(instanceID string, studyKey string, profileID string, ...) (result []studyTypes.AssignedSurvey, err error)
- func OnMergeVirtualParticipant(instanceID string, studyKey string, profileID string, ...) (result []studyTypes.AssignedSurvey, err error)
- func OnProfileDeleted(instanceID, profileID string, exitSurveyResp *studyTypes.SurveyResponse)
- func OnRegisterTempParticipant(instanceID string, studyKey string) (pState *studyTypes.Participant, err error)
- func OnRegisterVirtualParticipant(instanceID string, studyKey string) (pState *studyTypes.Participant, err error)
- func OnStudyTimer(instanceID string, study *studyTypes.Study)
- func OnSubmitResponse(instanceID string, studyKey string, profileID string, ...) (result []studyTypes.AssignedSurvey, err error)
- func OnSubmitResponseForTempParticipant(instanceID string, studyKey string, participantID string, ...) (result []studyTypes.AssignedSurvey, err error)
- func OnSubmitResponseOnBehalfOfParticipant(instanceID string, studyKey string, participantID string, ...) (result []studyTypes.AssignedSurvey, err error)
- type AssignedSurveyWithContext
- func GetAssignedSurveyWithContext(instanceID string, studyKey string, surveyKey string, profileID string) (surveyWithContent AssignedSurveyWithContext, err error)
- func GetSurveyWithContextForTempParticipant(instanceID string, studyKey string, surveyKey string, tempParticipantID string) (surveyWithContent AssignedSurveyWithContext, err error)
- type AssignedSurveysWithInfos
- type RunStudyActionProgressFn
- type RunStudyActionReq
- type RunStudyActionResult
- type StudyVariableValue
- type SubmissionEntry
- type SubmissionHistory
- type SurveyContext
- type SurveyInfo
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 EvalCustomExpressionForParticipant ¶
func EvalCustomExpressionForParticipant(instanceID, studyKey, participantID string, expression studyTypes.Expression) (val interface{}, err error)
func GetLinkingCode ¶
func Init ¶
func Init( studyDB *studydb.StudyDBService, gSecret string, externalServices []studyengine.ExternalService, studyMessageSender studyengine.StudyMessageSender, )
func IsAllowedToUploadFile ¶
func MergeParticipantLastSubmissions ¶
func MergeParticipantLastSubmissions(baseState, mergeFromState studyTypes.Participant) studyTypes.Participant
MergeParticipantLastSubmissions merges the LastSubmissions maps from two participant states. It includes all keys and for each key present in both maps, takes the larger value (timestamp).
func OnCustomStudyEvent ¶
func OnCustomStudyEvent(instanceID string, studyKey string, profileID string, eventKey string, payload map[string]interface{}) (result []studyTypes.AssignedSurvey, err error)
func OnCustomStudyEventOnBehalfOfParticipant ¶
func OnCustomStudyEventOnBehalfOfParticipant(instanceID string, studyKey string, participantID string, eventKey string, payload map[string]any) (result []studyTypes.AssignedSurvey, err error)
func OnEnterStudy ¶
func OnEnterStudy(instanceID string, studyKey string, profileID string) (result []studyTypes.AssignedSurvey, err error)
func OnForceMergeParticipants ¶
func OnForceMergeParticipants(instanceID string, studyKey string, targetParticipantID string, withParticipantID string) (result studyTypes.Participant, 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 OnMergeVirtualParticipant ¶
func OnMergeVirtualParticipant( instanceID string, studyKey string, profileID string, virtualParticipantID string, linkingCodeKey string, linkingCodeValue 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 OnRegisterVirtualParticipant ¶
func OnRegisterVirtualParticipant(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)
func OnSubmitResponseOnBehalfOfParticipant ¶
func OnSubmitResponseOnBehalfOfParticipant(instanceID string, studyKey string, participantID string, response studyTypes.SurveyResponse, by string) (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"`
}
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 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 StudyVariableValue ¶
type SubmissionEntry ¶
type SubmissionHistory ¶
type SubmissionHistory struct {
Submissions []SubmissionEntry `json:"submissions"`
SurveyInfos []*SurveyInfo `json:"surveyInfos"`
}
func GetSubmissionHistory ¶
type SurveyContext ¶
type SurveyContext struct {
Mode string `json:"mode,omitempty"`
PreviousResponses []studyTypes.SurveyResponse `json:"previousResponses,omitempty"`
ParticipantFlags map[string]string `json:"participantFlags,omitempty"`
StudyVariables map[string]StudyVariableValue `json:"studyVariables,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"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.