Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

How can I pass variables to Svelte through CSV?

$
0
0

I need to implement an application for Amazon MTurk to work with hits. For this matter, the application should receive a dynamic video imageDir and frameCount values from a CSV file provided in the beginning of the session, where each line represents an experiment, which includes several ids and each has its own frameCount, which represents the number of frames in this video.

I use a store to have the video IDs and corresponding frame counts 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 hereexport 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 I should 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>

Basically, I need the variables from supplied 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_524388,70,92131,39,71955,36,164180,62,91,66

Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>