Difference between revisions of "Great game of Turkey"
From Testiwiki
(all codes exist but may not work) |
(some bugs fixed but not all) |
||
Line 5: | Line 5: | ||
library(OpasnetUtils) | library(OpasnetUtils) | ||
− | + | objects.latest("Op_en7421", code_name = "dayquestion") | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | ques <- question() | |
− | cat(as.character( | + | cat(as.character(ques$Question[1]), "\n") |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
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: | ||
− | + | 1;Option 1; | |
− | + | 2;Option 2; | |
− | + | 3;Option 3; | |
− | + | 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: |
− | + | 1;Option 1; | |
− | + | 2;Option 2; | |
− | + | 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: | ||
) | ) | ||
− | + | opbase.upload( | |
− | + | dat, | |
− | + | ident = "Op_en7421", | |
− | + | name = "Great game of Turkey", | |
− | + | subset = "Happiness", | |
− | + | act_type = "append", | |
− | + | language = "eng", | |
− | + | who = wiki_username | |
− | + | ) | |
− | + | ||
− | + | oprint(dat) | |
− | + | cat("Your progress score was successfully saved.\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: |
− | + | 1;Option 1; | |
− | + | 2;Option 2; | |
− | + | 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; |
'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 | + | <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 <- 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 | ||
) | ) | ||
− | + | opbase.upload( | |
− | + | dat, | |
− | + | ident = "Op_en7421", | |
− | + | name = "Great game of Turkey", | |
− | + | subset = "Question vote", | |
− | + | act_type = "append", | |
− | + | language = "eng", | |
− | + | who = wiki_username | |
− | + | ) | |
− | + | ||
− | + | oprint(dat) | |
− | + | ||
− | + | cat("Your question vote was successfully saved.\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 | ||
) | ) | ||
− | + | opbase.upload( | |
− | + | dat, | |
− | + | ident = "Op_en7421", | |
− | + | name = "Great game of Turkey", | |
− | + | subset = "Option vote", | |
− | + | act_type = "append", | |
− | + | language = "eng", | |
− | + | who = wiki_username | |
− | + | ) | |
− | + | ||
− | + | oprint(dat) | |
− | + | ||
− | + | cat("Your option vote was successfully saved.\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
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
Obs | Date | Question | Option |
---|---|---|---|
1 | 2016-01-16 | Should the scarf ban in the universities be abandoned? | Yes |
2 | 2016-01-16 | Should the scarf ban in the universities be abandoned? | Partly |
3 | 2016-01-16 | Should the scarf ban in the universities be abandoned? | No |
4 | 2016-01-17 | Should the military budget be increased? | Yes |
5 | 2016-01-17 | Should the military budget be increased? | No, keep the same |
6 | 2016-01-17 | Should the military budget be increased? | No, reduce |
7 | 2016-01-17 | Should the education budget be increased? | Yes |
8 | 2016-01-17 | Should the education budget be increased? | No, keep the same |
9 | 2016-01-17 | Should the education budget be increased? | No, reduce |
Questions | Choices | Happiness | Progress | Question vote | Option vote | User |
---|---|---|---|---|---|---|
|
|
|
|
|
|
|
Groups for Turkey | Progress categories |
---|---|
|
|
See also
This page is a assessment.
The page identifier is Op_en7421 |
---|
Moderator:Jouni (see all) |
Give your opinion to the peer rating of the content of this page. |
Upload data
|
Keywords
References