Great game of Turkey: Difference between revisions

From Opasnet
Jump to navigation Jump to search
(all codes exist but may not work)
(some bugs fixed but not all)
Line 5: Line 5:
library(OpasnetUtils)
library(OpasnetUtils)


ques <- opbase.data("Op_en7421.questions")
objects.latest("Op_en7421", code_name = "dayquestion")
#ques <- ques[ques$Date == as.character(Sys.Date()) , ]
colnames(ques)[colnames(ques) == "Result"] <- "Option"
 
qvote <- opbase.data("Op_en7421.question_vote")
qvote <- unique(qvote[qvote$Date == as.character(Sys.Date()) , ]) # Remove double votes
qvote <- aggregate(qvote["User"], by = qvote["Result"], FUN = length)
qvote <- qvote[order(qvote$User, descending = TRUE) , ][1,] # Choose the row with most votes


temp <- merge(ques, qvote, by.x = "Obs", by.y = "Result")["Question"]
ques <- question()


cat(as.character(temp$Question), "\n")
cat(as.character(ques$Question[1]), "\n")
 
# Find the most popular options
 
ovote <- opbase.data("Op_en7421.option_vote")
ovote <- unique(ovote[ovote$Date == as.character(Sys.Date()) , ]) # Remove double votes
ovote <- aggregate(ovote["User"], by = ovote["Result"], FUN = length)
ovote <- ovote[order(ovote$User, descending = TRUE) , ]#[1:4,] # Choose the 4 rows with most votes
ovote <- ovote[!is.na(ovote$User) , ]
 
ques <- merge(merge(ques, temp), ovote, by.x = "Obs", by.y = "Result")


oprint(ques["Option"])
oprint(ques["Option"])
Line 34: Line 17:
<rcode name="choices" label="Choose policy" embed=1 variables="
<rcode name="choices" label="Choose policy" embed=1 variables="
name:option|description:Check above the question of the day and decide which option you would choose.|type:selection|options:
name:option|description:Check above the question of the day and decide which option you would choose.|type:selection|options:
'Option 1';Option 1;
1;Option 1;
'Option 2';Option 2;
2;Option 2;
'Option 3';Option 3;
3;Option 3;
'Option 4';Option 4
4;Option 4
">
">
# This is code Op_en7421/choices on page [[Great game of Turkey]]
# This is code Op_en7421/choices on page [[Great game of Turkey]]


library(OpasnetUtils)
library(OpasnetUtils)
objects.latest("Op_en7421", code_name = "dayquestion")
ques <- question()
oprint(ques)


dat <- data.frame(
dat <- data.frame(
User = wiki_username,  
User = wiki_username,  
Result = option # Option
Question = ques$Question[1],
Result = ques$Option[option] # Option
)
)


Line 63: Line 52:


<rcode label="Choose group" embed=1 variables="
<rcode label="Choose group" embed=1 variables="
name:group|description:Into which group do you identify most?|type:selection|options:
name:group|description:Into which group do you identify most? (You only need to choose once)|type:selection|options:
'Nationalists';Nationalists;
'Nationalists';Nationalists;
'Conservatives';Conservatives;
'Conservatives';Conservatives;
Line 121: Line 110:


<rcode name="happiness" label="Save your happiness score" embed=1 variables="
<rcode name="happiness" label="Save your happiness score" embed=1 variables="
name:option|type:selection|options:
name:option|description:Select an option|type:selection|options:
'Abandon scarf ban';Abandon scarf ban;
1;Option 1;
'Abandon scarf ban partly';Abandon scarf ban partly;
2;Option 2;
'Do not abandon scarf ban';Do not abandon scarf ban|
3;Option 3;
name:group|type:selection|options:
4;Option 4|
name:group|description:Select a group|type:selection|options:
'Nationalists';Nationalists;
'Nationalists';Nationalists;
'Conservatives';Conservatives;
'Conservatives';Conservatives;
Line 131: Line 121:
'Liberals';Liberals;
'Liberals';Liberals;
'Kemalists';Kemalists|
'Kemalists';Kemalists|
name:hscore|type:selection|options:
name:hscore|description:How much happiness would this option bring to this group?|type:selection|options:
NA;- choose score -;2;+2;1;+1;0;0;-1;-1;-2;-2|default:NA
NA;- choose score -;2;+2;1;+1;0;0;-1;-1;-2;-2|default:NA
">
">
Line 137: Line 127:


library(OpasnetUtils)
library(OpasnetUtils)
objects.latest("Op_en7421", code_name = "dayquestion")
ques <- question()
cat(as.character(ques$Question[1]), "\n")
oprint(ques["Option"])


dat <- data.frame(
dat <- data.frame(
Option = option,
Question = ques$Question[1],
Option = ques$Option[option],
Group = group,
Group = group,
User = wiki_username,  
User = wiki_username,  
Line 145: Line 144:
)
)


if(!is.na(hscore)) {
opbase.upload(
opbase.upload(
dat,  
dat,  
ident = "Op_en7421",  
ident = "Op_en7421",  
name = "Great game of Turkey",  
name = "Great game of Turkey",  
subset = "Happiness",  
subset = "Happiness",  
act_type = "append",  
act_type = "append",  
language = "eng",  
language = "eng",  
who = wiki_username
who = wiki_username
)
)
 
oprint(dat)
oprint(dat)
cat("Your progress score was successfully saved.\n")
cat("Your progress score was successfully saved.\n")
} else {
 
cat("Choose your score first.\n")
}
</rcode>
</rcode>


<rcode name="progress" label="Save your progress score" embed=1 variables="
<rcode name="progress" label="Save your progress score" embed=1 variables="
name:option|type:selection|options:
name:option|description:Select an option|type:selection|options:
'Abandon scarf ban';Abandon scarf ban;
1;Option 1;
'Abandon scarf ban partly';Abandon scarf ban partly;
2;Option 2;
'Do not abandon scarf ban';Do not abandon scarf ban|
3;Option 3;
4;Option 4|
name:progress|type:selection|options:
name:progress|type:selection|options:
'Civil Rights';Civil Rights;
'Civil Rights';Civil Rights;
'Women's Rights';Women's Rights;
'Women´s Rights';Women´s Rights;
'Religion';Religion;
'Religion';Religion;
'National Values';National Values;
'National Values';National Values;
Line 179: Line 177:


library(OpasnetUtils)
library(OpasnetUtils)
objects.latest("Op_en7421", code_name = "dayquestion")
ques <- question()
cat(as.character(ques$Question[1]), "\n")
oprint(ques["Option"])


dat <- data.frame(
dat <- data.frame(
Option = option,
Question = ques$Question[1],
Option = ques$Option[option],
Progress = progress,
Progress = progress,
User = wiki_username,  
User = wiki_username,  
Line 204: Line 211:
</rcode>
</rcode>


<rcode label="See the questions of the day" embed=1>
<rcode label="See all questions of the day" embed=1>
# This code is Op_en7421/ on page [[Great game of Turkey]]
# This code is Op_en7421/ on page [[Great game of Turkey]]


Line 210: Line 217:


ques <- opbase.data("Op_en7421.questions")
ques <- opbase.data("Op_en7421.questions")
#ques$Date <- as.Date(ques$Date)
ques <- ques[ques$Date == as.character(Sys.Date()) , ]
ques <- ques[ques$Date == as.character(Sys.Date()) , ]
colnames(ques)[colnames(ques) == "Result"] <- "Option"
colnames(ques)[colnames(ques) == "Result"] <- "Option"
Line 222: Line 228:


<rcode label="Vote for the day's question" embed=1 variables="
<rcode label="Vote for the day's question" embed=1 variables="
name:question|description:Give the number of the question you want for today.
name:question|description:Give the number of the question you want for today.|type:text
">
">
# This is code Op_en7421/ on page [[Great game of Turkey]]
# This is code Op_en7421/ on page [[Great game of Turkey]]
Line 229: Line 235:


dat <- data.frame(
dat <- data.frame(
Date = Sys.Date(),
Date = as.character(Sys.Date()),
User = wiki_username,  
User = wiki_username,  
Result = question # Question
Result = question # Question
)
)


if(!is.null(question)) {
opbase.upload(
opbase.upload(
dat,  
dat,  
ident = "Op_en7421",  
ident = "Op_en7421",  
name = "Great game of Turkey",  
name = "Great game of Turkey",  
subset = "Question vote",  
subset = "Question vote",  
act_type = "append",  
act_type = "append",  
language = "eng",  
language = "eng",  
who = wiki_username
who = wiki_username
)
)
 
oprint(dat)
oprint(dat)
cat("Your question vote was successfully saved.\n")
 
} else {
cat("Your question vote was successfully saved.\n")
cat("Choose your question first.\n")
 
}
</rcode>
</rcode>


Line 259: Line 264:


dat <- data.frame(
dat <- data.frame(
Date = Sys.Date(),
Date = as.character(Sys.Date()),
User = wiki_username,  
User = wiki_username,  
Result = option # Option
Result = option # Option
)
)


if(!is.null(option)) {
opbase.upload(
opbase.upload(
dat,  
dat,  
ident = "Op_en7421",  
ident = "Op_en7421",  
name = "Great game of Turkey",  
name = "Great game of Turkey",  
subset = "Option vote",  
subset = "Option vote",  
act_type = "append",  
act_type = "append",  
language = "eng",  
language = "eng",  
who = wiki_username
who = wiki_username
)
)
 
oprint(dat)
oprint(dat)
cat("Your option vote was successfully saved.\n")
 
} else {
cat("Your option vote was successfully saved.\n")
cat("Choose your option first.\n")
 
</rcode>
 
<rcode name="dayquestion" label="Initiate dayquestion (for developers only)" embed=1>
# This is code Op_en7421/dayquestion on page [[Great game of Turkey]]
 
library(OpasnetUtils)
 
question <- function() {
  ques <- opbase.data("Op_en7421.questions")
  colnames(ques)[colnames(ques) == "Result"] <- "Option"
 
  qvote <- opbase.data("Op_en7421.question_vote")
  qvote <- unique(qvote[qvote$Date == as.character(Sys.Date()) , ]) # Remove double votes
  qvote <- aggregate(qvote["User"], by = qvote["Result"], FUN = length)
  qvote <- qvote[order(qvote$User, descending = TRUE) , ][1,] # Choose the row with most votes
 
  temp <- merge(ques, qvote, by.x = "Obs", by.y = "Result")["Question"]
 
  # Find the most popular options
 
  ovote <- opbase.data("Op_en7421.option_vote")
  ovote <- ovote[nrow(ovote):1 , ] #Turn newest first
  ovote <- ovote[!duplicated(ovote[c("Date", "User") , ]) , ] # Only keep the last vote
  out <- merge(merge(temp, ques), ovote, by.x = "Obs", by.y = "Result")
  out <- aggregate(out["User"], by = out["Option"], FUN = length)
  out <- out[order(out$User, descending = TRUE) , ][1:4,] # Choose the 4 rows with most votes
  out <- out[!is.na(out$User) , "Option", drop = FALSE]
 
  return(merge(temp, out))
}
}
objects.store(question)
</rcode>
</rcode>



Revision as of 05:44, 17 January 2016

+ Show code

Check above the question of the day and decide which option you would choose.:

+ Show code

Into which group do you identify most? (You only need to choose once):

+ Show code

Question

What is a good game to crowdsource citizen priorities about daily political decisions in such a way that

  • it can be done using a mobile app,
  • it characterises happiness of citizen groups of the decisions,
  • it characterises progress of important societal values,
  • it enables crowdsourcing the actual questions and options asked?

Answer

See the top of the page for the main questionnaire of the game.

Rationale

Questions(-)
ObsDateQuestionOption
12016-01-16Should the scarf ban in the universities be abandoned?Yes
22016-01-16Should the scarf ban in the universities be abandoned?Partly
32016-01-16Should the scarf ban in the universities be abandoned?No
42016-01-17Should the military budget be increased?Yes
52016-01-17Should the military budget be increased?No, keep the same
62016-01-17Should the military budget be increased?No, reduce
72016-01-17Should the education budget be increased?Yes
82016-01-17Should the education budget be increased?No, keep the same
92016-01-17Should the education budget be increased?No, reduce

Select an option:

Select a group:

How much happiness would this option bring to this group?:

+ Show code

Select an option:

progress:

pscore:

+ Show code

+ Show code

Give the number of the question you want for today.:

+ Show code

Give the number of the option you want for today (up to 4 options used).:

+ Show code

+ Show code

Structures of the tables.
Questions Choices Happiness Progress Question vote Option vote User
  • Question
  • Option
  • User
  • Option
  • Option
  • Group
  • User
  • Hscore
  • Option
  • Progress
  • User
  • Pscore
  • Question
  • User
  • Qscore
  • Option
  • User
  • Oscore
  • User
  • Date
  • Group
Important categories
Groups for Turkey Progress categories
  • Nationalists
  • Conservatives
  • Minorities
  • Liberals
  • Kemalists
  • Civil Rights
  • Women's Rights
  • Religion
  • National Values
  • Democracy

See also


Keywords

References


Related files