-
Notifications
You must be signed in to change notification settings - Fork 2
resolves #283 align study create with API spec #284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
bdb90e7
af39505
630e6f1
7fdc2a5
0ca3702
0e94e5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -111,6 +111,25 @@ type Study struct { | |||||
| CredentialPoolID string `json:"credential_pool_id"` | ||||||
| } | ||||||
|
|
||||||
| // CompletionCode represents a completion code configuration for a study. | ||||||
| type CompletionCode struct { | ||||||
| Code string `json:"code" mapstructure:"code"` | ||||||
| CodeType string `json:"code_type" mapstructure:"code_type"` | ||||||
| Actions []CompletionCodeAction `json:"actions" mapstructure:"actions"` | ||||||
| } | ||||||
|
|
||||||
| // CompletionCodeAction represents an action to take when a completion code is used. | ||||||
| type CompletionCodeAction struct { | ||||||
| Action string `json:"action" mapstructure:"action"` | ||||||
| ParticipantGroup string `json:"participant_group,omitempty" mapstructure:"participant_group,omitempty"` | ||||||
| } | ||||||
|
|
||||||
| // AccessDetail represents a taskflow study URL allocation. | ||||||
| type AccessDetail struct { | ||||||
| ExternalURL string `json:"external_url" mapstructure:"external_url"` | ||||||
| TotalAllocation int `json:"total_allocation" mapstructure:"total_allocation"` | ||||||
| } | ||||||
|
|
||||||
| // 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. | ||||||
|
|
@@ -121,10 +140,17 @@ type CreateStudy struct { | |||||
| 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" mapstructure:"completion_code"` | ||||||
|
|
||||||
| // New: Array of completion code configurations (replaces completion_code and completion_option) | ||||||
| CompletionCodes []CompletionCode `json:"completion_codes,omitempty" mapstructure:"completion_codes"` | ||||||
|
|
||||||
| // DEPRECATED: Use CompletionCodes instead. Kept for backward compatibility. | ||||||
| CompletionCode string `json:"completion_code,omitempty" mapstructure:"completion_code"` | ||||||
| // DEPRECATED: Use CompletionCodes instead. Kept for backward compatibility. | ||||||
| // Enum: "url", "code" | ||||||
| CompletionOption string `json:"completion_option,omitempty" mapstructure:"completion_option"` | ||||||
| TotalAvailablePlaces int `json:"total_available_places" mapstructure:"total_available_places"` | ||||||
| CompletionOption string `json:"completion_option,omitempty" 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,omitempty" mapstructure:"maximum_allowed_time"` | ||||||
|
|
@@ -135,18 +161,45 @@ type CreateStudy struct { | |||||
| 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"` | ||||||
|
|
||||||
| // New: Array of access details for taskflow studies with multiple URLs (replaces access_details_collection_id) | ||||||
| AccessDetails []AccessDetail `json:"access_details,omitempty" mapstructure:"access_details"` | ||||||
|
|
||||||
| // DEPRECATED: Use AccessDetails instead. Kept for backward compatibility. | ||||||
| // 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" | ||||||
|
|
||||||
| // Data collection method: "AI_TASK_BUILDER" | ||||||
|
||||||
| // Data collection method: "AI_TASK_BUILDER" | |
| // Data collection method. Enum: "AI_TASK_BUILDER", "DC_TOOL" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command help example uses completion_codes with code_type "FAILED_ATTENTION_CHECK" and action "MANUALLY_REVIEW", but those values don't appear anywhere else in the repo’s documented examples. To avoid users copying an example that the API may reject, consider using code_type/action values already demonstrated in docs/examples (e.g. COMPLETED / FOLLOW_UP_STUDY with AUTOMATICALLY_APPROVE, or align with the new REJECTED/AUTOMATICALLY_REJECT usage in model/study_test.go).