learninglocker icon indicating copy to clipboard operation
learninglocker copied to clipboard

Data exportation to CVS with JS array

Open Matthieu-BRANTHOME opened this issue 4 years ago • 1 comments

I have data stored in xAPI format in my Learning Locker LRS and I am trying to export it to CSV format.

I followed xAPI to the letter and so I have in my statements some data stored in the JSON tree in JS arrays. See for example below my "level" parameter which is in an array with the key "other".

"context": {

    "contextActivities": {

      "other": [

        {

          "objectType": "Activity",

          "id": "https://py-rates.org/xAPI/activities/levels/level1",

          "definition": {

            "name": {

              "en-US": "Level 1",

              "fr": "Niveau 1"

            },

            "type": "https://py-rates.org/xAPI/activities/level"

          }

        }

      ]

    },

When I export my data to CSV from the Learing Locker web interface, there is the possibility to choose some fields by giving their path in the JSON tree. For example for the column "_level", I indicated: "statement.context.contextActivities.other" (see screenshot link below).

1642765160022blob

The problem is that I get the whole array in my CSV, so I need a post-processing to get only the level. I would like to be able to choose the first element of the array to retrieve only the id of the level and not the whole array. Basically, I would like to give the following path: "statement.context.contextActivities.other[0].id ". Unfortunately this syntax does not work.

Do you have any idea how to do it?

Thank you in advance for your help,

MatthieuB

Matthieu-BRANTHOME avatar Jan 24 '22 10:01 Matthieu-BRANTHOME

There is a strange thing in learning locker, the notation: statement.context.contextActivities.other.0.definition.name.en-US Works in the preview

2022_10_12_09_28_45_Learning_Locker_Welcome

but not in the exported files!

Matthieu-BRANTHOME avatar Oct 12 '22 07:10 Matthieu-BRANTHOME