Documentation
¶
Index ¶
- Constants
- Variables
- type AITaskBuilderAnswerOption
- type AITaskBuilderBatch
- type AITaskBuilderBatchStatus
- type AITaskBuilderBatchStatusEnum
- type AITaskBuilderResponse
- type AITaskBuilderResponseData
- type AITaskBuilderResponseType
- type Campaign
- type CreateStudy
- type Dataset
- type DatasetStatus
- type Filter
- type FilterRange
- type FilterSet
- type Hook
- type HookEvent
- type HookEventType
- type Instruction
- type InstructionOption
- type Message
- type ParticipantGroup
- type ParticipantGroupMembership
- type Project
- type Requirement
- type RequirementAttribute
- type RequirementQuestion
- type Secret
- type Study
- type Submission
- type SubmissionsConfig
- type TaskDetails
- type UnreadMessage
- type UpdateStudy
- type User
- type Workspace
Constants ¶
const ( // StatusUnpublished is a valid study status StatusUnpublished = "unpublished" // StatusActive is a valid study status StatusActive = "active" // StatusScheduled is a valid study status StatusScheduled = "scheduled" // StatusAwaitingReview is a valid study status StatusAwaitingReview = "awaiting review" // StatusCompleted is a valid study status StatusCompleted = "completed" // StatusAll is a mock status that allows us to list all studies. StatusAll = "all" )
const ( // TransitionStudyPublish will allow us to publish a study TransitionStudyPublish = "PUBLISH" // TransitionStudyPause will allow us to pause a study TransitionStudyPause = "PAUSE" // TransitionStudyStart will allow us to start a study TransitionStudyStart = "START" // TransitionStudyStop will allow us to stop a study TransitionStudyStop = "STOP" )
const DefaultCurrency string = "GBP"
DefaultCurrency is set to GBP if we cannot figure out what currency to render based on other factors.
Variables ¶
var StudyListStatus = []string{ StatusUnpublished, StatusActive, StatusCompleted, StatusAll, }
StudyListStatus represents what status we can filter on for the list
var StudyStatuses = []string{ StatusUnpublished, StatusActive, StatusScheduled, StatusAwaitingReview, StatusCompleted, }
StudyStatuses represents the allows statuses for the system
var TransitionList = []string{ TransitionStudyPublish, TransitionStudyStart, TransitionStudyPause, TransitionStudyStop, }
TransitionList is the list of transitions we can use on a Study.
Functions ¶
This section is empty.
Types ¶
type AITaskBuilderAnswerOption ¶
type AITaskBuilderAnswerOption struct {
Value string `json:"value"`
}
AITaskBuilderAnswerOption represents an answer option for multiple choice responses.
type AITaskBuilderBatch ¶
type AITaskBuilderBatch struct {
ID string `json:"id"`
CreatedAt time.Time `json:"created_at"`
CreatedBy string `json:"created_by"`
Datasets []Dataset `json:"datasets"`
Name string `json:"name"`
Status AITaskBuilderBatchStatusEnum `json:"status"`
TasksPerGroup int `json:"tasks_per_group"`
TotalTaskCount int `json:"total_task_count"`
TotalInstructionCount int `json:"total_instruction_count"`
WorkspaceID string `json:"workspace_id"`
SchemaVersion int `json:"schema_version"`
TaskDetails TaskDetails `json:"task_details"`
}
AITaskBuilderBatch represents an AI Task Builder batch.
type AITaskBuilderBatchStatus ¶
type AITaskBuilderBatchStatus struct {
Status AITaskBuilderBatchStatusEnum `json:"status"`
}
AITaskBuilderBatchStatus represents the status of an AI Task Builder batch.
type AITaskBuilderBatchStatusEnum ¶
type AITaskBuilderBatchStatusEnum string
const ( // UNINITIALISED: the batch has been created, but contains no tasks. AITaskBuilderBatchStatusUninitialised AITaskBuilderBatchStatusEnum = "UNINITIALISED" // PROCESSING: The batch is being processed into tasks. AITaskBuilderBatchStatusProcessing AITaskBuilderBatchStatusEnum = "PROCESSING" // READY: The batch is processed and ready to be attached to a Prolific study. AITaskBuilderBatchStatusReady AITaskBuilderBatchStatusEnum = "READY" // ERROR: The batch has encountered an error and the data may not be usable. AITaskBuilderBatchStatusError AITaskBuilderBatchStatusEnum = "ERROR" )
type AITaskBuilderResponse ¶
type AITaskBuilderResponse struct {
ID string `json:"id"`
BatchID string `json:"batch_id"`
ParticipantID string `json:"participant_id"`
TaskID string `json:"task_id"`
CorrelationID string `json:"correlation_id"`
SubmissionID string `json:"submission_id"`
Metadata map[string]string `json:"metadata"`
Response AITaskBuilderResponseData `json:"response"`
CreatedAt time.Time `json:"created_at"`
SchemaVersion int `json:"schema_version"`
}
AITaskBuilderResponse represents a response from an AI Task Builder batch task.
type AITaskBuilderResponseData ¶
type AITaskBuilderResponseData struct {
InstructionID string `json:"instruction_id"`
Type AITaskBuilderResponseType `json:"type"`
Text *string `json:"text,omitempty"` // For free_text and multiple_choice_with_free_text
Answer []AITaskBuilderAnswerOption `json:"answer,omitempty"` // For multiple_choice and multiple_choice_with_free_text
}
AITaskBuilderResponseData represents the response data structure. This is a discriminated union based on the Type field.
type AITaskBuilderResponseType ¶
type AITaskBuilderResponseType string
AITaskBuilderResponseType represents the type of response.
const ( AITaskBuilderResponseTypeFreeText AITaskBuilderResponseType = "free_text" AITaskBuilderResponseTypeMultipleChoice AITaskBuilderResponseType = "multiple_choice" AITaskBuilderResponseTypeMultipleChoiceWithFreeText AITaskBuilderResponseType = "multiple_choice_with_free_text" )
type CreateStudy ¶
type CreateStudy struct {
Name string `json:"name" mapstructure:"name"`
InternalName string `json:"internal_name" mapstructure:"internal_name"`
Description string `json:"description" mapstructure:"description"`
ExternalStudyURL string `json:"external_study_url" mapstructure:"external_study_url"`
// Enum "question", "url_parameters" (Recommended), "not_required"
ProlificIDOption string `json:"prolific_id_option" mapstructure:"prolific_id_option"`
CompletionCode string `json:"completion_code" mapstructure:"completion_code"`
// Enum: "url", "code"
CompletionOption string `json:"completion_option" mapstructure:"completion_option"`
TotalAvailablePlaces int `json:"total_available_places" mapstructure:"total_available_places"`
// Minutes
EstimatedCompletionTime int `json:"estimated_completion_time" mapstructure:"estimated_completion_time"`
MaximumAllowedTime int `json:"maximum_allowed_time" mapstructure:"maximum_allowed_time"`
Reward float64 `json:"reward" mapstructure:"reward"`
// Enum: "desktop", "tablet", "mobile"
DeviceCompatibility []string `json:"device_compatibility" mapstructure:"device_compatibility"`
// Enum: "audio", "camera", "download", "microphone"
PeripheralRequirements []string `json:"peripheral_requirements" mapstructure:"peripheral_requirements"`
SubmissionsConfig struct {
MaxSubmissionsPerParticipant int `json:"max_submissions_per_participant" mapstructure:"max_submissions_per_participant"`
MaxConcurrentSubmissions int `json:"max_concurrent_submissions" mapstructure:"max_concurrent_submissions"`
} `json:"submissions_config" mapstructure:"submissions_config"`
EligibilityRequirements []struct {
Attributes []struct {
ID string `json:"id" mapstructure:"id"`
Index any `json:"index,omitempty" mapstructure:"index,omitempty"`
Value any `json:"value" mapstructure:"value"`
} `json:"attributes" mapstructure:"attributes"`
Query struct {
ID string `json:"id" mapstructure:"id"`
} `json:"query" mapstructure:"query"`
Cls string `json:"_cls" mapstructure:"_cls"`
} `json:"eligibility_requirements" mapstructure:"eligibility_requirements"`
Filters []Filter `json:"filters" mapstructure:"filters"`
Project string `json:"project,omitempty" mapstructure:"project"`
CredentialPoolID string `json:"credential_pool_id,omitempty" mapstructure:"credential_pool_id"`
}
CreateStudy is responsible for capturing what fields we need to send to Prolific to create a study. The `mapstructure` is so we can take a viper configuration file.
type Dataset ¶
type Dataset struct {
ID string `json:"id"`
Name string `json:"name"`
CreatedAt string `json:"created_at"`
CreatedBy string `json:"created_by"`
Status DatasetStatus `json:"status"`
TotalDatapointCount int `json:"total_datapoint_count"`
WorkspaceID string `json:"workspace_id"`
}
Dataset represents a dataset in a batch.
type DatasetStatus ¶ added in v0.0.57
type DatasetStatus string
DatasetStatus represents the status of a dataset.
const ( // DatasetStatusUninitialised means the dataset has been created but no data has been uploaded. DatasetStatusUninitialised DatasetStatus = "UNINITIALISED" // DatasetStatusProcessing means the dataset is being processed into datapoints. DatasetStatusProcessing DatasetStatus = "PROCESSING" // DatasetStatusReady means the dataset is ready to be used within a batch. DatasetStatusReady DatasetStatus = "READY" // DatasetStatusError means something went wrong during processing. DatasetStatusError DatasetStatus = "ERROR" )
type Filter ¶
type Filter struct {
ID string `json:"id" mapstructure:"id"`
FilterID string `json:"filter_id" mapstructure:"filter_id"`
FilterTitle string `json:"title" mapstructure:"title"`
FilterDescription string `json:"description" mapstructure:"description"`
Question string `json:"question" mapstructure:"question"`
Type string `json:"type" mapstructure:"type"`
DataType string `json:"data_type" mapstructure:"data_type"`
Min any `json:"min,omitempty" mapstructure:"min"`
Max any `json:"max,omitempty" mapstructure:"max"`
Choices map[string]string `json:"choices,omitempty" mapstructure:"choices"`
SelectedValues []string `json:"selected_values,omitempty" mapstructure:"selected_values"`
SelectedRange FilterRange `json:"selected_range,omitempty" mapstructure:"selected_range"`
}
Filter holds information about the filter that makes up a filter set
func (Filter) Description ¶
Description will return the description of the filter
func (Filter) FilterValue ¶
FilterValue will help the bubbletea views run
type FilterRange ¶
type FilterRange struct {
Lower any `json:"lower,omitempty" mapstructure:"lower"`
Upper any `json:"upper,omitempty" mapstructure:"upper"`
}
FilterRange holds the lower and upper bounds of a filter
type FilterSet ¶
type FilterSet struct {
ID string `json:"id"`
Name string `json:"name"`
OrganisationID string `json:"organisation_id"`
WorkspaceID string `json:"workspace_id"`
Version int `json:"version"`
IsDeleted bool `json:"is_deleted"`
IsLocked bool `json:"is_locked"`
EligibleParticipantCount int `json:"eligible_participant_count"`
Filters []Filter `json:"filters"`
}
FilterSet holds information about the filter
type Hook ¶
type Hook struct {
ID string `json:"id"`
EventType string `json:"event_type"`
TargetURL string `json:"target_url"`
IsEnabled bool `json:"is_enabled"`
WorkspaceID string `json:"workspace_id"`
}
Hook represents a subscription to an event
type HookEvent ¶
type HookEvent struct {
ID string `json:"id"`
DateCreated time.Time `json:"datetime_created"`
DateUpdated time.Time `json:"datetime_updated"`
EventType string `json:"event_type"`
ResourceID string `json:"resource_id"`
Status string `json:"status"`
TargetURL string `json:"target_url"`
}
HookEvent represents a point when Prolific notified the target URL of the event that the user has subscribed to.
type HookEventType ¶
type HookEventType struct {
EventType string `json:"event_type"`
Description string `json:"description"`
}
HookEventType represents event types that are available to register on the webhook subscription
type Instruction ¶ added in v0.0.57
type Instruction struct {
ID string `json:"id"`
Type string `json:"type"`
BatchID string `json:"batch_id"`
CreatedBy string `json:"created_by"`
CreatedAt string `json:"created_at"`
Description string `json:"description"`
Options []InstructionOption `json:"options,omitempty"`
}
Instruction represents an instruction in a batch.
type InstructionOption ¶ added in v0.0.57
type InstructionOption struct {
Label string `json:"label"`
Value string `json:"value"`
Heading string `json:"heading,omitempty"`
}
InstructionOption represents an option for multiple choice instructions.
type Message ¶
type Message struct {
DatetimeCreated time.Time `json:"datetime_created"`
Body string `json:"body"`
SenderID string `json:"sender_id"`
StudyID string `json:"study_id,omitempty"`
Data map[string]any `json:"data,omitempty"`
}
Message represents the message model
type ParticipantGroup ¶
type ParticipantGroup struct {
ID string `json:"id"`
Name string `json:"name"`
ProjectID string `json:"project_id"`
}
ParticipantGroup holds information about the group
type ParticipantGroupMembership ¶
type ParticipantGroupMembership struct {
ParticipantID string `json:"participant_id"`
DatetimeCreated time.Time `json:"datetime_created"`
}
ParticipantGroupMembership holds information about a member in a group
type Project ¶
type Project struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Workspace string `json:"workspace"`
Owner string `json:"owner"`
Users []User `json:"users"`
}
Project represents the project model
type Requirement ¶
type Requirement struct {
ID string `json:"id"`
Type string `json:"type"`
Attributes []RequirementAttribute `json:"attributes,omitempty"`
Query RequirementQuestion `json:"query,omitempty"`
Cls string `json:"_cls"`
Category string `json:"category"`
Subcategory any `json:"subcategory"`
Order int `json:"order"`
Recommended bool `json:"recommended"`
DetailsDisplay string `json:"details_display"`
RequirementType string `json:"requirement_type"`
}
Requirement represents an eligibility requirement in the system.
func (Requirement) Description ¶
func (r Requirement) Description() string
Description will set the secondary string the view.
func (Requirement) FilterValue ¶
func (r Requirement) FilterValue() string
FilterValue will help the bubbletea views run
func (Requirement) Title ¶
func (r Requirement) Title() string
Title will set the main string for the view.
type RequirementAttribute ¶
type RequirementAttribute struct {
Label string `json:"label,omitempty"`
Name string `json:"name,omitempty"`
Value any `json:"value,omitempty"`
Index int `json:"index,omitempty"`
}
RequirementAttribute are all the attributes for a given requirement
type RequirementQuestion ¶
type RequirementQuestion struct {
ID string `json:"id"`
Question string `json:"question"`
Description string `json:"description"`
Title string `json:"title"`
HelpText string `json:"help_text"`
ParticipantHelpText string `json:"participant_help_text"`
ResearcherHelpText string `json:"researcher_help_text"`
IsNew bool `json:"is_new"`
}
type Secret ¶
type Secret struct {
ID string `json:"id"`
Value string `json:"value"`
WorkspaceID string `json:"workspace_id"`
}
Secret represents the secrets passed back from Prolific.
type Study ¶
type Study struct {
ID string `json:"id"`
Name string `json:"name"`
InternalName string `json:"internal_name"`
DateCreated time.Time `json:"date_created"`
TotalAvailablePlaces int `json:"total_available_places"`
Reward float64 `json:"reward"`
CanAutoReview bool `json:"can_auto_review"`
EligibilityRequirements []struct {
ID string `json:"id"`
Question struct {
ID string `json:"id"`
Title string `json:"title"`
} `json:"question"`
DisplayDetails string `json:"details_display"`
} `json:"eligibility_requirements"`
Filters []Filter `json:"filters"`
Desc string `json:"description"`
EstimatedCompletionTime int `json:"estimated_completion_time"`
MaximumAllowedTime int `json:"maximum_allowed_time"`
CompletionURL string `json:"completion_url"`
ExternalStudyURL string `json:"external_study_url"`
PublishedAt any `json:"published_at"`
StartedPublishingAt any `json:"started_publishing_at"`
AwardPoints int `json:"award_points"`
PresentmentCurrencyCode string `json:"presentment_currency_code"`
CurrencyCode string `json:"currency_code"`
Researcher struct {
ID string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Country string `json:"country"`
Institution struct {
Name any `json:"name"`
Logo any `json:"logo"`
Link string `json:"link"`
} `json:"institution"`
} `json:"researcher"`
Status string `json:"status"`
AverageRewardPerHour float64 `json:"average_reward_per_hour"`
DeviceCompatibility []string `json:"device_compatibility"`
PeripheralRequirements []any `json:"peripheral_requirements"`
PlacesTaken int `json:"places_taken"`
EstimatedRewardPerHour float64 `json:"estimated_reward_per_hour"`
Ref any `json:"_ref"`
StudyType string `json:"study_type"`
TotalCost float64 `json:"total_cost"`
PublishAt any `json:"publish_at"`
IsPilot bool `json:"is_pilot"`
IsUnderpaying any `json:"is_underpaying"`
SubmissionsConfig SubmissionsConfig `json:"submissions_config"`
CredentialPoolID string `json:"credential_pool_id"`
}
Study represents a Prolific Study
func (Study) Description ¶
Description will set the secondary string the view.
func (Study) FilterValue ¶
FilterValue will help the bubbletea views run
func (Study) GetCurrencyCode ¶
GetCurrencyCode handles the logic about which internal fields to use to decide which currency to display. Defaults to GBP.
type Submission ¶
type Submission struct {
ID string `json:"id"`
ParticipantID string `json:"participant_id"`
StartedAt time.Time `json:"started_at"`
CompletedAt time.Time `json:"completed_at"`
IsComplete bool `json:"is_complete"`
TimeTaken int `json:"time_taken"`
Reward int `json:"reward"`
Status string `json:"status"`
Strata struct {
DateOfBirth string `json:"date of birth"`
EthnicitySimplified string `json:"ethnicity (simplified)"`
Sex string `json:"sex"`
} `json:"strata"`
StudyCode string `json:"study_code"`
StarAwarded bool `json:"star_awarded"`
BonusPayments []any `json:"bonus_payments"`
IP string `json:"ip"`
}
Submission represents a submission to a study from a participant.
type SubmissionsConfig ¶
type SubmissionsConfig struct {
MaxSubmissionsPerParticipant int `json:"max_submissions_per_participant"`
MaxConcurrentSubmissions int `json:"max_concurrent_submissions"`
}
SubmissionsConfig represents configuration around submission gathering
type TaskDetails ¶
type TaskDetails struct {
TaskName string `json:"task_name"`
TaskIntroduction string `json:"task_introduction"`
TaskSteps string `json:"task_steps"`
}
TaskDetails represents the task configuration details.
type UnreadMessage ¶
type UnreadMessage struct {
DatetimeCreated time.Time `json:"datetime_created"`
Body string `json:"body"`
Sender string `json:"sender"`
}
UnreadMessage represents the unread message model
type UpdateStudy ¶
type UpdateStudy struct {
TotalAvailablePlaces int `json:"total_available_places,omitempty"`
CredentialPoolID string `json:"credential_pool_id,omitempty"`
}
UpdateStudy represents the model we will send back to Prolific to update the study.