# NOT RUN {
# HIT-level ReviewPolicies #
## Conditionally extend HIT based on HIT Agreement Score
lista <- list(QuestionIds = c("Question1","Question2","Question5"),
QuestionAgreementThreshold = 49, # at least 50 percent agreement
ExtendIfHITAgreementScoreIsLessThan = 50,
ExtendMinimumTimeInSeconds = 3600,
ExtendMaximumAssignments = 2,
DisregardAssignmentIfRejected = TRUE)
policya <- do.call(GenerateHITReviewPolicy, lista)
## Conditionally approve and reject based on Worker Agreement Score
listb <- list(QuestionIds = c("Question1","Question2","Question5"),
QuestionAgreementThreshold = 65, # at least two of three 'correct' answers
ApproveIfWorkerAgreementScoreIsAtLeast = 65,
RejectIfWorkerAgreementScoreIsLessThan = 34,
DisregardAssignmentIfRejected = TRUE)
policyb <- do.call(GenerateHITReviewPolicy, listb)
# Attach an assignment review policy to a HIT
hit1 <-
CreateHIT(title = "Survey",
description = "5 question survey",
reward = ".10",
expiration = seconds(days = 4),
duration = seconds(hours = 1),
keywords = "survey, questionnaire",
hit.review.policy = policyb,
question = GenerateExternalQuestion("http://www.example.com/","400"))
# GetReviewResults
GetReviewResultsForHIT(hit1$HITId)
# cleanup
ExpireHIT(hit1$HITId)
DisposeHIT(hit1$HITId)
# }
# NOT RUN {
# Assignment-level ReviewPolicies #
## Conditional approval of assignments based on percent of correct answers
lista <- list(AnswerKey = list("QuestionId1" = "B",
"QuestionId2" = "A"),
ApproveIfKnownAnswerScoreIsAtLeast = 99)
policya <- do.call(GenerateAssignmentReviewPolicy, lista)
## Conditional rejection of assignments based on percent of correct answers
listb <- list(AnswerKey = list("QuestionId1" = "B",
"QuestionId2" = "A"),
RejectIfKnownAnswerScoreIsLessThan = 1)
policyb <- do.call(GenerateAssignmentReviewPolicy, listb)
## Conditionally extend HIT with more time and assignments based on score
listc <- list(AnswerKey = list("QuestionId1" = "B"),
ExtendIfKnownAnswerScoreIsLessThan = 100,
ExtendMaximumAssignments = 2, # maximum value is 25
ExtendMinimumTimeInSeconds = seconds(hours = 1))
policyc <- do.call(GenerateAssignmentReviewPolicy, listc)
# Attach an assignment review policy to a HIT
hit1 <-
CreateHIT(title = "Survey",
description = "5 question survey",
reward = ".10",
expiration = seconds(days = 4),
duration = seconds(hours = 1),
keywords = "survey, questionnaire",
assignment.review.policy = policya,
question = GenerateExternalQuestion("http://www.example.com/","400"))
# GetReviewResults
GetReviewResultsForHIT(hit1$HITId)
# cleanup
ExpireHIT(hit1$HITId)
DisposeHIT(hit1$HITId)
# }
# NOT RUN {
# HIT- and Assignment-level ReviewPolicies
## Conditional approval of assignments based on percent of correct answers
lista <- list(AnswerKey = list("QuestionId1" = "B",
"QuestionId2" = "A"),
ApproveIfKnownAnswerScoreIsAtLeast = 99)
policya <- do.call(GenerateAssignmentReviewPolicy, lista)
## Conditionally extend HIT based on HIT Agreement Score
listb <- list(QuestionIds = c("Question3","Question4","Question5"),
QuestionAgreementThreshold = 65, # at least 2/3rd agreement
ExtendIfHITAgreementScoreIsLessThan = 66,
ExtendMinimumTimeInSeconds = 3600,
ExtendMaximumAssignments = 2,
DisregardAssignmentIfRejected = TRUE)
policyb <- do.call(GenerateHITReviewPolicy, listb)
# Create HIT
hit1 <-
CreateHIT(title = "Survey",
description = "5 question survey",
reward = ".10",
expiration = seconds(days = 4),
duration = seconds(hours = 1),
keywords = "survey, questionnaire",
assignment.review.policy = policya,
hit.review.policy = policyb,
question = GenerateExternalQuestion("http://www.example.com/","400"))
# GetReviewResults
GetReviewResultsForHIT(hit1$HITId)
# cleanup
ExpireHIT(hit1$HITId)
DisposeHIT(hit1$HITId)
# }
Run the code above in your browser using DataLab