model

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
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"
)
View Source
const DefaultCurrency string = "GBP"

DefaultCurrency is set to GBP if we cannot figure out what currency to render based on other factors.

Variables

StudyListStatus represents what status we can filter on for the list

StudyStatuses represents the allows statuses for the system

TransitionList is the list of transitions we can use on a Study.

Functions

This section is empty.

Types

type CreateStudy added in v0.0.2

type CreateStudy struct {
	Name             string `json:"name"`
	InternalName     string `json:"internal_name"`
	Description      string `json:"description"`
	ExternalStudyURL string `json:"external_study_url"`
	// Enum "question", "url_parameters" (Recommended), "not_required"
	ProlificIDOption string `json:"prolific_id_option"`
	CompletionCode   string `json:"completion_code"`
	// Enum: "url", "code"
	CompletionOption     string `json:"completion_option"`
	TotalAvailablePlaces int    `json:"total_available_places"`
	// Minutes
	EstimatedCompletionTime int     `json:"estimated_completion_time"`
	MaximumAllowedTime      int     `json:"maximum_allowed_time"`
	Reward                  float64 `json:"reward"`
	// Enum: "desktop", "tablet", "mobile"
	DeviceCompatibility []string `json:"device_compatibility"`
	// Enum: "audio", "camera", "download", "microphone"
	PeripheralRequirements []string `json:"peripheral_requirements"`
}

CreateStudy is responsible for capturing what fields we need to send to Prolific to create a study.

type Hook added in v0.0.10

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 added in v0.0.17

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 added in v0.0.16

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 ParticipantGroup added in v0.0.18

type ParticipantGroup struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	ProjectID string `json:"project_id"`
}

ParticipantGroup holds information about the group

type ParticipantGroupMembership added in v0.0.18

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 added in v0.0.12

type Project struct {
	ID                      string  `json:"id"`
	Title                   string  `json:"title"`
	Description             string  `json:"description"`
	Users                   []User  `json:"users"`
	NaivetyDistributionRate float64 `json:"naivety_distribution_rate"`
}

Project represents the project model

type Requirement added in v0.0.2

type Requirement struct {
	ID   string `json:"id"`
	Type string `json:"type"`
	// Attributes []struct {
	// 	Label string `json:"label"`
	// 	Name  string `json:"name"`
	// 	Value string `json:"value"`
	// 	Index int    `json:"index"`
	// } `json:"attributes"`
	Query 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"`
	} `json:"query,omitempty"`
	Cls             string      `json:"_cls"`
	Category        string      `json:"category"`
	Subcategory     interface{} `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 added in v0.0.2

func (r Requirement) Description() string

Description will set the secondary string the view.

func (Requirement) FilterValue added in v0.0.2

func (r Requirement) FilterValue() string

FilterValue will help the bubbletea views run

func (Requirement) Title added in v0.0.2

func (r Requirement) Title() string

Title will set the main string for the view.

type Secret added in v0.0.13

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"`
	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             interface{} `json:"published_at"`
	StartedPublishingAt     interface{} `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 interface{} `json:"name"`
			Logo interface{} `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 []interface{} `json:"peripheral_requirements"`
	PlacesTaken            int           `json:"places_taken"`
	EstimatedRewardPerHour float64       `json:"estimated_reward_per_hour"`
	Ref                    interface{}   `json:"_ref"`
	StudyType              string        `json:"study_type"`
	TotalCost              float64       `json:"total_cost"`
	PublishAt              interface{}   `json:"publish_at"`
	IsPilot                bool          `json:"is_pilot"`
	IsUnderpaying          interface{}   `json:"is_underpaying"`
}

Study represents a Prolific Study

func (Study) Description

func (s Study) Description() string

Description will set the secondary string the view.

func (Study) FilterValue

func (s Study) FilterValue() string

FilterValue will help the bubbletea views run

func (Study) GetCurrencyCode added in v0.0.14

func (s Study) GetCurrencyCode() string

GetCurrencyCode handles the logic about which internal fields to use to decide which currency to display. Defaults to GBP.

func (Study) Title

func (s Study) Title() string

Title will set the main string for the view.

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 []interface{} `json:"bonus_payments"`
	IP            string        `json:"ip"`
}

Submission represents a submission to a study from a participant.

type User added in v0.0.12

type User struct {
	ID    string   `json:"id"`
	Name  string   `json:"name"`
	Email string   `json:"email"`
	Roles []string `json:"roles"`
}

User represents a user in the system

type Workspace added in v0.0.12

type Workspace struct {
	ID                      string  `json:"id"`
	Title                   string  `json:"title"`
	Description             string  `json:"description"`
	Users                   []User  `json:"users"`
	NaivetyDistributionRate float64 `json:"naivety_distribution_rate"`
}

Workspace represents the workspace model

Jump to

Keyboard shortcuts

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