Documentation
¶
Overview ¶
Package model defines the data structures representing Prolific domain entities such as studies, submissions, workspaces, projects, and users. These types are used for JSON serialization when communicating with the Prolific API.
Index ¶
- Constants
- Variables
- type AITaskBuilderAnswerOption
- type AITaskBuilderBatch
- type AITaskBuilderBatchStatus
- type AITaskBuilderBatchStatusEnum
- type AITaskBuilderResponse
- type AITaskBuilderResponseData
- type AITaskBuilderResponseType
- type BaseEntity
- type Campaign
- type Collection
- type CollectionInstruction
- type CollectionPage
- type CollectionPageItem
- type CompletionCode
- type ContentFormat
- type CreateAITaskBuilderCollection
- type CreateStudy
- type Dataset
- type DatasetStatus
- type Filter
- type FilterRange
- type FilterSet
- type Hook
- type HookEvent
- type HookEventType
- type Instruction
- type InstructionOption
- type InstructionType
- type Message
- type MessageData
- type MultipleChoiceOption
- type Page
- type PageInstruction
- type ParticipantGroup
- type ParticipantGroupMembership
- type Project
- type Requirement
- type RequirementAttribute
- type RequirementQuestion
- type Secret
- type Study
- type Submission
- type SubmissionsConfig
- type TaskDetails
- type UnitOption
- type UnitPosition
- type UpdateCollection
- 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 (
// DataCollectionMethodAITBCollection is the data collection method for AI Task Builder Collections
DataCollectionMethodAITBCollection = "AI_TASK_BUILDER_COLLECTION"
)
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 {
// For free_text, free_text_with_unit, multiple_choice, multiple_choice_with_free_text
Value string `json:"value,omitempty"`
// For free_text_with_unit
Unit string `json:"unit,omitempty"`
// For multiple_choice_with_free_text
Explanation string `json:"explanation,omitempty"`
// For file_upload
FileKey string `json:"file_key,omitempty"`
FileName string `json:"file_name,omitempty"`
FileSizeMB float64 `json:"file_size_mb,omitempty"`
ContentType string `json:"content_type,omitempty"`
}
AITaskBuilderAnswerOption represents an answer option in a response. The fields used depend on the response type: - free_text: value - free_text_with_unit: value, unit - multiple_choice: value - multiple_choice_with_free_text: value, explanation - file_upload: file_key, file_name, file_size_mb, content_type
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"`
Answer []AITaskBuilderAnswerOption `json:"answer"`
}
AITaskBuilderResponseData represents the response data structure. This is a discriminated union based on the Type field. All response types use the Answer array with different object structures.
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" AITaskBuilderResponseTypeFreeTextWithUnit AITaskBuilderResponseType = "free_text_with_unit" AITaskBuilderResponseTypeFileUpload AITaskBuilderResponseType = "file_upload" )
type BaseEntity ¶ added in v0.0.58
type BaseEntity struct {
ID string `json:"id,omitempty" yaml:"id,omitempty" mapstructure:"id"`
CreatedBy string `json:"created_by,omitempty" yaml:"created_by,omitempty" mapstructure:"created_by"`
CreatedAt *time.Time `json:"created_at,omitempty" yaml:"created_at,omitempty" mapstructure:"created_at"`
SchemaVersion int `json:"schema_version,omitempty" yaml:"schema_version,omitempty" mapstructure:"schema_version"`
LastModifiedAt *time.Time `json:"last_modified_at,omitempty" yaml:"last_modified_at,omitempty" mapstructure:"last_modified_at"`
LastModifiedBy string `json:"last_modified_by,omitempty" yaml:"last_modified_by,omitempty" mapstructure:"last_modified_by"`
}
BaseEntity contains common fields for all collection entities
type Collection ¶ added in v0.0.58
type Collection struct {
ID string `json:"id"`
Name string `json:"name"`
CreatedAt time.Time `json:"created_at"`
CreatedBy string `json:"created_by"`
ItemCount int `json:"item_count"`
TaskDetails *TaskDetails `json:"task_details,omitempty"`
}
Collection represents a Prolific Collection
func (Collection) Description ¶ added in v0.0.58
func (c Collection) Description() string
Description will set the secondary string for the view.
func (Collection) FilterValue ¶ added in v0.0.58
func (c Collection) FilterValue() string
FilterValue will help the bubbletea views run
func (Collection) Title ¶ added in v0.0.58
func (c Collection) Title() string
Title will set the main string for the view.
type CollectionInstruction ¶ added in v0.0.58
type CollectionInstruction = CollectionPageItem
CollectionInstruction is an alias for CollectionPageItem for backward compatibility. Deprecated: Use CollectionPageItem instead.
type CollectionPage ¶ added in v0.0.58
type CollectionPage struct {
Order int `json:"order" mapstructure:"order"`
PageItems []CollectionInstruction `json:"page_items" mapstructure:"page_items"`
}
CollectionPage represents a page in a collection containing instructions.
type CollectionPageItem ¶ added in v0.0.58
type CollectionPageItem struct {
Order int `json:"order" mapstructure:"order"`
Type string `json:"type" mapstructure:"type"`
// Instruction fields (for free_text, multiple_choice, multiple_choice_with_free_text, free_text_with_unit, file_upload)
Description string `json:"description,omitempty" mapstructure:"description"`
Options []InstructionOption `json:"options,omitempty" mapstructure:"options"`
AnswerLimit *int `json:"answer_limit,omitempty" mapstructure:"answer_limit"`
PlaceholderTextInput string `json:"placeholder_text_input,omitempty" mapstructure:"placeholder_text_input"`
DisableDropdown *bool `json:"disable_dropdown,omitempty" mapstructure:"disable_dropdown"`
HelperText string `json:"helper_text,omitempty" mapstructure:"helper_text"`
// Unit fields (for free_text_with_unit)
UnitOptions []UnitOption `json:"unit_options,omitempty" mapstructure:"unit_options"`
DefaultUnit string `json:"default_unit,omitempty" mapstructure:"default_unit"`
UnitPosition UnitPosition `json:"unit_position,omitempty" mapstructure:"unit_position"`
// File upload fields (for file_upload)
AcceptedFileTypes []string `json:"accepted_file_types,omitempty" mapstructure:"accepted_file_types"`
MaxFileSizeMB *float64 `json:"max_file_size_mb,omitempty" mapstructure:"max_file_size_mb"`
MinFileCount *int `json:"min_file_count,omitempty" mapstructure:"min_file_count"`
MaxFileCount *int `json:"max_file_count,omitempty" mapstructure:"max_file_count"`
// Content block fields (for rich_text)
Content string `json:"content,omitempty" mapstructure:"content"`
ContentFormat ContentFormat `json:"content_format,omitempty" mapstructure:"content_format"`
// Content block fields (for image)
URL string `json:"url,omitempty" mapstructure:"url"`
AltText string `json:"alt_text,omitempty" mapstructure:"alt_text"`
Caption string `json:"caption,omitempty" mapstructure:"caption"`
}
CollectionPageItem represents an item within a collection page. This can be either an instruction (interactive) or a content block (non-interactive). The Type field determines which other fields are relevant. Use InstructionType constants from collection.go for the Type field.
type CompletionCode ¶ added in v0.0.58
type CompletionCode struct {
Code string `json:"code" mapstructure:"code"`
CodeType string `json:"code_type" mapstructure:"code_type"`
Actions []map[string]interface{} `json:"actions" mapstructure:"actions"`
}
CompletionCode represents a study completion code with its type and actions.
type ContentFormat ¶ added in v0.0.59
type ContentFormat string
ContentFormat represents the format of rich text content
const ( // ContentFormatHTML means the content is HTML ContentFormatHTML ContentFormat = "html" // ContentFormatMarkdown means the content is Markdown, converted to HTML server-side ContentFormatMarkdown ContentFormat = "markdown" )
type CreateAITaskBuilderCollection ¶ added in v0.0.58
type CreateAITaskBuilderCollection struct {
WorkspaceID string `json:"workspace_id" mapstructure:"workspace_id"`
Name string `json:"name" mapstructure:"name"`
TaskDetails *TaskDetails `json:"task_details,omitempty" mapstructure:"task_details"`
CollectionItems []CollectionPage `json:"collection_items" mapstructure:"collection_items"`
}
CreateAITaskBuilderCollection represents the payload for creating a collection.
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,omitempty" 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,omitempty" mapstructure:"completion_code"`
// Enum: "url", "code"
CompletionOption string `json:"completion_option,omitempty" mapstructure:"completion_option"`
CompletionCodes []CompletionCode `json:"completion_codes,omitempty" mapstructure:"completion_codes"`
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,omitempty" 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,omitempty" mapstructure:"peripheral_requirements"`
// Study labels for categorization (e.g., "ai_annotation")
StudyLabels []string `json:"study_labels,omitempty" mapstructure:"study_labels"`
// Access details collection ID: ID of the collection to attach to the study (for Taskflow studies)
AccessDetailsCollectionID string `json:"access_details_collection_id,omitempty" mapstructure:"access_details_collection_id"`
// Data collection method: "AI_TASK_BUILDER", "DC_TOOL", or "HUMAN_SIGNAL"
DataCollectionMethod string `json:"data_collection_method,omitempty" mapstructure:"data_collection_method"`
// Data collection ID: Project/collection/batch ID for data collection
DataCollectionID string `json:"data_collection_id,omitempty" mapstructure:"data_collection_id"`
// Data collection metadata: Configuration parameters (optional dict)
DataCollectionMetadata map[string]interface{} `json:"data_collection_metadata,omitempty" mapstructure:"data_collection_metadata"`
SubmissionsConfig struct {
MaxSubmissionsPerParticipant int `json:"max_submissions_per_participant,omitempty" mapstructure:"max_submissions_per_participant"`
MaxConcurrentSubmissions int `json:"max_concurrent_submissions,omitempty" mapstructure:"max_concurrent_submissions"`
} `json:"submissions_config,omitempty" 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,omitempty" mapstructure:"eligibility_requirements"`
Filters []Filter `json:"filters,omitempty" 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,omitempty" mapstructure:"id"`
FilterID string `json:"filter_id" mapstructure:"filter_id"`
FilterTitle string `json:"title,omitempty" mapstructure:"title"`
FilterDescription string `json:"description,omitempty" mapstructure:"description"`
Question string `json:"question,omitempty" mapstructure:"question"`
Type string `json:"type,omitempty" mapstructure:"type"`
DataType string `json:"data_type,omitempty" 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"`
UnitOptions []UnitOption `json:"unit_options,omitempty"`
DefaultUnit string `json:"default_unit,omitempty"`
UnitPosition UnitPosition `json:"unit_position,omitempty"`
HelperText string `json:"helper_text,omitempty"`
PlaceholderTextInput string `json:"placeholder_text_input,omitempty"`
AcceptedFileTypes []string `json:"accepted_file_types,omitempty"`
MaxFileSizeMB *float64 `json:"max_file_size_mb,omitempty"`
MinFileCount *int `json:"min_file_count,omitempty"`
MaxFileCount *int `json:"max_file_count,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 InstructionType ¶ added in v0.0.58
type InstructionType string
InstructionType represents the type of instruction
const ( // Instruction types (interactive - participants respond to these) InstructionTypeFreeText InstructionType = "free_text" InstructionTypeMultipleChoice InstructionType = "multiple_choice" InstructionTypeMultipleChoiceWithFreeText InstructionType = "multiple_choice_with_free_text" InstructionTypeFreeTextWithUnit InstructionType = "free_text_with_unit" InstructionTypeFileUpload InstructionType = "file_upload" // Content block types (non-interactive - for context or guidance) ContentBlockTypeRichText InstructionType = "rich_text" ContentBlockTypeImage InstructionType = "image" )
type Message ¶
type Message struct {
ID string `json:"id"`
SenderID string `json:"sender_id,omitempty"`
Sender string `json:"sender,omitempty"`
Body string `json:"body"`
DatetimeCreated time.Time `json:"datetime_created"`
Type string `json:"type,omitempty"`
ChannelID string `json:"channel_id"`
Data *MessageData `json:"data,omitempty"`
}
Message represents a message on the Prolific platform. The regular messages endpoint returns "sender_id" while the unread endpoint returns "sender", so both fields are present.
func (Message) GetSenderID ¶ added in v0.0.58
GetSenderID returns the sender identifier regardless of which API endpoint populated the message. The regular messages endpoint uses "sender_id" while the unread endpoint uses "sender".
type MessageData ¶ added in v0.0.58
type MessageData struct {
StudyID string `json:"study_id,omitempty"`
Category string `json:"category,omitempty"`
}
MessageData contains metadata associated with a message.
type MultipleChoiceOption ¶ added in v0.0.58
type MultipleChoiceOption struct {
Label string `json:"label" yaml:"label" mapstructure:"label"`
Value string `json:"value" yaml:"value" mapstructure:"value"`
Heading string `json:"heading,omitempty" yaml:"heading,omitempty" mapstructure:"heading"` // Required for multiple_choice_with_free_text
}
MultipleChoiceOption represents an option for multiple choice instructions
type Page ¶ added in v0.0.58
type Page struct {
BaseEntity `yaml:",inline" mapstructure:",squash"`
Order int `json:"order" yaml:"order" mapstructure:"order"`
PageItems []PageInstruction `json:"page_items" yaml:"page_items" mapstructure:"page_items"`
}
Page represents a single page within a collection.
type PageInstruction ¶ added in v0.0.58
type PageInstruction struct {
BaseEntity `yaml:",inline" mapstructure:",squash"`
// Required fields
Type InstructionType `json:"type" yaml:"type" mapstructure:"type"`
Order int `json:"order" yaml:"order" mapstructure:"order"`
// Required for instruction types (free_text, multiple_choice, multiple_choice_with_free_text, free_text_with_unit, file_upload)
Description string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description"`
// Optional - for free_text and free_text_with_unit types
PlaceholderTextInput string `json:"placeholder_text_input,omitempty" yaml:"placeholder_text_input,omitempty" mapstructure:"placeholder_text_input"`
HelperText string `json:"helper_text,omitempty" yaml:"helper_text,omitempty" mapstructure:"helper_text"`
// Optional - for multiple_choice and multiple_choice_with_free_text types
AnswerLimit int `json:"answer_limit,omitempty" yaml:"answer_limit,omitempty" mapstructure:"answer_limit"`
Options []MultipleChoiceOption `json:"options,omitempty" yaml:"options,omitempty" mapstructure:"options"`
DisableDropdown *bool `json:"disable_dropdown,omitempty" yaml:"disable_dropdown,omitempty" mapstructure:"disable_dropdown"`
// Optional - for free_text_with_unit type
UnitOptions []UnitOption `json:"unit_options,omitempty" yaml:"unit_options,omitempty" mapstructure:"unit_options"`
DefaultUnit string `json:"default_unit,omitempty" yaml:"default_unit,omitempty" mapstructure:"default_unit"`
UnitPosition UnitPosition `json:"unit_position,omitempty" yaml:"unit_position,omitempty" mapstructure:"unit_position"`
// Optional - for file_upload type
AcceptedFileTypes []string `json:"accepted_file_types,omitempty" yaml:"accepted_file_types,omitempty" mapstructure:"accepted_file_types"`
MaxFileSizeMB *float64 `json:"max_file_size_mb,omitempty" yaml:"max_file_size_mb,omitempty" mapstructure:"max_file_size_mb"`
MinFileCount *int `json:"min_file_count,omitempty" yaml:"min_file_count,omitempty" mapstructure:"min_file_count"`
MaxFileCount *int `json:"max_file_count,omitempty" yaml:"max_file_count,omitempty" mapstructure:"max_file_count"`
// Content block fields - for rich_text type
Content string `json:"content,omitempty" yaml:"content,omitempty" mapstructure:"content"`
ContentFormat ContentFormat `json:"content_format,omitempty" yaml:"content_format,omitempty" mapstructure:"content_format"`
// Content block fields - for image type
URL string `json:"url,omitempty" yaml:"url,omitempty" mapstructure:"url"`
AltText string `json:"alt_text,omitempty" yaml:"alt_text,omitempty" mapstructure:"alt_text"`
Caption string `json:"caption,omitempty" yaml:"caption,omitempty" mapstructure:"caption"`
}
PageInstruction represents a single page item within a collection page. This can be either an instruction (interactive) or a content block (non-interactive).
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" mapstructure:"task_name"`
TaskIntroduction string `json:"task_introduction" mapstructure:"task_introduction"`
TaskSteps string `json:"task_steps" mapstructure:"task_steps"`
}
TaskDetails represents the task configuration details.
type UnitOption ¶ added in v0.0.58
type UnitOption struct {
Label string `json:"label" yaml:"label" mapstructure:"label"`
Value string `json:"value" yaml:"value" mapstructure:"value"`
}
UnitOption represents a unit option for free_text_with_unit instructions
type UnitPosition ¶ added in v0.0.58
type UnitPosition string
UnitPosition represents the position of the unit relative to the text input.
const ( // UnitPositionPrefix means the unit appears before the text input. UnitPositionPrefix UnitPosition = "prefix" // UnitPositionSuffix means the unit appears after the text input. UnitPositionSuffix UnitPosition = "suffix" )
type UpdateCollection ¶ added in v0.0.58
type UpdateCollection struct {
BaseEntity `yaml:",inline" mapstructure:",squash"`
Name string `json:"name" yaml:"name" mapstructure:"name"`
Description string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description"`
WorkspaceID string `json:"workspace_id,omitempty" yaml:"workspace_id,omitempty" mapstructure:"workspace_id"`
TaskDetails *TaskDetails `json:"task_details,omitempty" yaml:"task_details,omitempty" mapstructure:"task_details"`
CollectionItems []Page `json:"collection_items" yaml:"collection_items" mapstructure:"collection_items"`
}
UpdateCollection represents the payload for updating a collection.
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.