I need to implement an application for Amazon MTurk
to work with hits
. For this matter, the application should receive a dinamic video imageDir
and frameCount
values fom a CSV file provided in the begining of the session, where each line represents an experiment, which includes several id
s and each has its own frameCount
, which represents the number of frames in this video.
I use a store
to have the video id
s and coresponding frame count
s to use in my code, but they are hard coded, which is not optimal.
Task Store file:
// The video directories together with the corresponding frame counts should be placed here
export const taskStore = readable(
[
{
imageDir: 'https://raw.githubusercontent.com/lieldvd/mturk/main/100159',
frameCount: 63
},
{
imageDir: 'https://raw.githubusercontent.com/lieldvd/mturk/main/100589',
frameCount: 32
}
])
This is the index file I’m using from another project, but I can’t figure out how should I collect and use these variables latter in code to run the program.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script type="module" src="/src/main.js"></script>
<script src="https://s3.amazonaws.com/mturk-public/externalHIT_v1.js" type="text/javascript"></script>
<title>Questions</title>
</head>
<body>
<div style="height: 0; width: 0; opacity: 0;">
<code class="variable-feed">
${id_1} :;: ${frameCount_1}
</code>
<code class="variable-feed">
${id_2} :;: ${frameCount_2}
</code>
<code class="variable-feed">
${id_3} :;: ${frameCount_3}
</code>
<code class="variable-feed">
${id_4} :;: ${frameCount_4}
</code>
<code class="variable-feed">
${id_5} :;: ${frameCount_5}
</code>
</div>
<div id="app"></div>
<input style="height: 0;" type="hidden" name="test"></input>
<!---- important commands for Amazon MTurk ----------------->
<script language="Javascript">
turkSetAssignmentID();
</script>
<!------------------------------------------------------------->
</body>
</html>
Bassically, I need the variables from suplied CSV
file (as is presented below) with fields represented in the index
file in the variable-feed
to be populated inside the taskStore
.
Example of the CSV file containing the data:
id_1,frameCount_1,id_2,frameCount_2,id_3,frameCount_3,id_4,frameCount_4,id_5,frameCount_5
24388,70,92131,39,71955,36,164180,62,91,66