Skip to content

Commit

Permalink
Merge pull request #594 from Amsterdam-Music-Lab/feature/mp-translations
Browse files Browse the repository at this point in the history
Feature/mp translations
BeritJanssen authored Nov 8, 2023
2 parents 463b390 + be8cf51 commit 657966b
Showing 7 changed files with 344 additions and 288 deletions.
224 changes: 0 additions & 224 deletions backend/experiment/fixtures/experiment.json
Original file line number Diff line number Diff line change
@@ -346,229 +346,5 @@
18
]
}
},
{
"model": "experiment.feedback",
"pk": 1,
"fields": {
"text": "",
"experiment": 15
}
},
{
"model": "experiment.feedback",
"pk": 2,
"fields": {
"text": "",
"experiment": 15
}
},
{
"model": "experiment.feedback",
"pk": 3,
"fields": {
"text": "",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 4,
"fields": {
"text": "hh started this test at 11:52 and played until 11:58. But filled in the feedback and submitted at 12: 05.",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 5,
"fields": {
"text": "I breakdown music by ear a lot, so I found this very interesting. After the top row I realized I needed to jot down reminders on scratch paper. Figuring out what is the most effective approach to summarizing a snippet is a great problem to solve. Maybe I will craft a longer response in an email.",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 6,
"fields": {
"text": "Not an easy Play. Cannon say That I plagend it well.",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 7,
"fields": {
"text": "",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 8,
"fields": {
"text": "",
"experiment": 14
}
},
{
"model": "experiment.feedback",
"pk": 9,
"fields": {
"text": "Hi folks! This is the second time I played, and it worked just like a memory game where two \"cards\" were identical. The first time I played, it was a little different - one of the cards sounded like it was being played through some kind of filter and the other was normal. Also, when I got to the end one was the \"Westworld\" theme and its match did not really sound like it was a match. Not sure if any of this is intentional but I thought I'd let you know! :)",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 10,
"fields": {
"text": "This was really hard!!",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 11,
"fields": {
"text": "Sometimes when I clicked, no music played. Not sure if my bluetooth connection was hijacked. Every time I could fix it by clicking on another one -- but I guess that decreased my performance a bit.",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 12,
"fields": {
"text": "Boring excerpts. Rules aren't clear.",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 13,
"fields": {
"text": "I notice that when I click play again, then after finishing the game, it adds the points to the previous points. I wonder if this is the intented behaviour. Very cool application tho!",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 14,
"fields": {
"text": "Were last two correct?! ",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 15,
"fields": {
"text": "DJB game post fix 1 ",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 16,
"fields": {
"text": "game 3 o",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 17,
"fields": {
"text": "game 3 or 4 for me ",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 18,
"fields": {
"text": "That's really cool! ",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 19,
"fields": {
"text": "",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 20,
"fields": {
"text": "play across board djb",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 21,
"fields": {
"text": "First four cards I clicked already showed misremembered.",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 22,
"fields": {
"text": "Yes ER theme tune! What nostalgia!! ",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 23,
"fields": {
"text": "None of the songs were from TV shows",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 24,
"fields": {
"text": "This is way too hard",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 25,
"fields": {
"text": "I was too lazy to read the instructions and didn't realize the task at first. But got the hang of it soon enough.",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 26,
"fields": {
"text": "Pairs are much easier to remember when you know the themes (which is not my case for the most part)\nFun to play ! ",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 27,
"fields": {
"text": "Nice work!",
"experiment": 17
}
},
{
"model": "experiment.feedback",
"pk": 28,
"fields": {
"text": "nice",
"experiment": 17
}
}
]
71 changes: 54 additions & 17 deletions backend/experiment/rules/musical_preferences.py
Original file line number Diff line number Diff line change
@@ -23,8 +23,9 @@

class MusicalPreferences(Base):
ID = 'MUSICAL_PREFERENCES'
preference_offset = 4 #20
knowledge_offset = 6 #42
consent_file = 'consent_musical_preferences.html'
preference_offset = 20
knowledge_offset = 42
round_increment = 1

know_score = {
@@ -44,7 +45,11 @@ def __init__(self):
]

def first_round(self, experiment):
consent = Consent()
rendered = render_to_string('consent/{}'.format(self.consent_file)
)
consent = Consent(
text=rendered, title=_('Informed consent'), confirm=_('I agree'), deny=_('Stop')
)
playlist = Playlist(experiment.playlists.all())
start_session = StartSession()
return [
@@ -128,8 +133,8 @@ def next_round(self, session, request_session=None):
like_results = session.result_set.filter(question_key='like_song')
feedback = Trial(
html=HTML(body=render_to_string('html/musical_preferences/feedback.html', {
'unlocked': _("Love "),
'n_songs': n_songs,
'unlocked': _("Love unlocked"),
'n_songs': n_songs - 1,
'top_participant': self.get_preferred_songs(like_results, 3)
}))
)
@@ -139,8 +144,8 @@ def next_round(self, session, request_session=None):
known_songs = session.result_set.filter(question_key='know_song', score=2).count()
feedback = Trial(
html=HTML(body=render_to_string('html/musical_preferences/feedback.html', {
'unlocked': _("Knowledge "),
'n_songs': n_songs,
'unlocked': _("Knowledge unlocked"),
'n_songs': n_songs - 1,
'top_participant': self.get_preferred_songs(like_results, 3),
'n_known_songs': known_songs
}))
@@ -150,20 +155,28 @@ def next_round(self, session, request_session=None):
like_results = session.result_set.filter(question_key='like_song')
known_songs = session.result_set.filter(question_key='know_song', score=2).count()
all_results = Result.objects.filter(
comment='like_song'
question_key='like_song'
)
top_participant = self.get_preferred_songs(like_results, 3)
top_all = self.get_preferred_songs(all_results, 3)
feedback = Trial(
html=HTML(body=render_to_string('html/musical_preferences/feedback.html', {
'unlocked': _("Connection "),
'n_songs': n_songs,
'top_participant': self.get_preferred_songs(like_results, 3),
'unlocked': _("Connection unlocked"),
'n_songs': n_songs - 1,
'top_participant': top_participant,
'n_known_songs': known_songs,
'top_all': self.get_preferred_songs(all_results, 3)
'top_all': top_all
}))
)
session.finish()
session.save()
return [feedback, self.get_final_view(session)]
return [feedback, self.get_final_view(
session,
top_participant,
known_songs,
n_songs,
top_all
)]

section = session.playlist.random_section()
like_key = 'like_song'
@@ -190,8 +203,8 @@ def next_round(self, session, request_session=None):
view = Trial(
playback=playback,
feedback_form=form,
title=_('Song %(round)i out of %(total)i' %{
'round': n_songs, 'total': session.experiment.rounds}),
title=_('Song %(round)s/%(total)s') %{
'round': n_songs, 'total': session.experiment.rounds},
config={
'response_time': section.duration + .1,
}
@@ -205,9 +218,33 @@ def calculate_score(self, result, data):
else:
return super().calculate_score(result, data)

def get_final_view(self, session):
def social_media_info(self, experiment, top_participant, known_songs, n_songs, top_all):
current_url = "{}/{}".format(settings.RELOAD_PARTICIPANT_TARGET,
experiment.slug
)
format_songs = lambda songs: ', '.join([song['name'] for song in songs])
return {
'apps': ['facebook', 'twitter'],
'message': _("I explored musical preferences on %(url)s! My top 3 favorite songs: %(top_participant)s. I know %(known_songs)i out of %(n_songs)i songs. All players' top 3 songs: %(top_all)s") % {
'url': current_url,
'top_participant': format_songs(top_participant),
'known_songs': known_songs,
'n_songs': n_songs,
'top_all': format_songs(top_all)
},
'url': experiment.url or current_url,
'hashtags': [experiment.hashtag or experiment.slug, "amsterdammusiclab", "citizenscience"]
}

def get_final_view(self, session, top_participant, known_songs, n_songs, top_all):
# finalize experiment
social_info = self.social_media_info(session.experiment, session.final_score)
social_info = self.social_media_info(
session.experiment,
top_participant,
known_songs,
n_songs,
top_all
)
social_info['apps'] = ['weibo', 'share']
view = Final(
session,
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{% load i18n %}
<p>{% translate "Dear participant," %}</p>
<p>
{% blocktranslate %}
You will be taking part in the Musical Preferences research project conducted by Xuan Huang under the supervision of Prof. Henkjan Honing and Dr. John Ashley Burgoyne of the Music Cognition Group at the University of Amsterdam’s Institute for Logic, Language, and Computation.
{% endblocktranslate %}
</p>

<h4>{% translate "Purpose of the research project" %}</h4>

<p>
{% blocktranslate %}
Studies have shown that cultural preferences and familiarity for music start in infancy and continue throughout adolescence and adulthood. People tend to prefer music from their own cultural traditions. This research will help us understand individual and situational influences on musical preferences and investigate the factors that underly musical preferences in China. For example, do people who have preferences for classical music also have preferences for Chinese traditional music? Are there cultural-specific or universal structural features for musical preferences?
{% endblocktranslate %}
</p>

{% load i18n %}
<h4>{% translate "Who can take part in this research?" %}</h4>

<p>
{% blocktranslate %}
Anybody with sufficiently good hearing, natural or corrected, to enjoy music listening is welcome to participate in this research. Your device must be able to play audio, and you must have a sufficiently strong data connection to be able to stream short MP3 files. Headphones are recommended for the best results, but you may also use either internal or external loudspeakers. You should adjust the volume of your device so that it is comfortable for you.
{% endblocktranslate %}
</p>

<h4>{% translate "Instructions" %}</h4>
<p>
{% blocktranslate %}
This study is a music preference experiment in which you will hear 64 music clips throughout the experiment, you either wear headphones or use your device's speakers to listen to the clips. Adjust the volume level of your device before the experiment begins.
{% endblocktranslate %}
</p>

<p>
{% blocktranslate %}
The experiment has two parts. The first part is a questionnaire with 6 questions. The second part is a music preference test, where you will listen to a music clip and answer questions about it. The results of your music preferences will be available after the experiment is completed.
{% endblocktranslate %}
</p>

<h4>{% translate "Voluntary participation" %}</h4>

<p>
{% blocktranslate %}
You will be participating in this research project on a voluntary basis. This means you are free to stop taking part at any stage without consequences or penalty. If you decide to stop or withdraw your consent, all the information gathered up until then will be permanently deleted.
{% endblocktranslate %}
</p>

<h4>{% translate "Confidential treatment of your details" %}</h4>

<p>
{% blocktranslate %}
The information gathered over the course of this research will be used for further analysis and publication in scientific journals only. Fully anonymised data collected during the experiment may be made available online in tandem with these scientific publications. We guarantee that you will remain anonymous under all circumstances. Your personal details will not be viewed by third parties without your express permission.
{% endblocktranslate %}
</p>

{% load i18n %}
<h4>{% translate "Further Information" %}</h4>

<p>
{% blocktranslate %} For further information, please contact Xuan Huang (x.huang@uva.nl) or Dr. John Ashley Burgoyne (j.a.burgoyne@uva.nl). If you have any complaints regarding this project, you can contact the Secretary of the Ethics Committee of the Faculty of Humanities of the University of Amsterdam (commissie-ethiek-fgw@uva.nl).
{% endblocktranslate %}
</p>

<h4>{% translate "Informed consent" %}</h4>

<p>
{% blocktranslate %}
I have been clearly informed about the research project and I consent to participate in this research. I retain the right to revoke this consent without having to provide any reasons for my decision. I am aware that I am entitled to discontinue the research at any time and can withdraw my participation. {% endblocktranslate %}
</p>

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% load i18n %}
<h2 class="title">{{unlocked}}{% translate "Unlocked" %}</h2>
<h2 class="title">{{unlocked}}</h2>
<div class="card mb-3 bg-blue">
<div class="row no-gutters">
<div class="col">
Binary file modified backend/locale/zh/LC_MESSAGES/django.mo
Binary file not shown.
251 changes: 206 additions & 45 deletions backend/locale/zh/LC_MESSAGES/django.po

Large diffs are not rendered by default.

15 changes: 14 additions & 1 deletion frontend/src/components/HTML/HTML.scss
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@
}

.card.bg-blue {
height: 20vh;
height: 21vh;
background-color: $blue;

span {
@@ -55,6 +55,19 @@

.card-body {
text-align: left;
padding-top: 1vh;
ul {
padding: 0;
}
}

.card-title {
padding: 0;
font-size: 2.5vh;
}

.card-text {
font-size: 2vh;
}

}

0 comments on commit 657966b

Please sign in to comment.