Skip to content

Data exportation to CVS with JS array #1609

Open

Description

@Matthieu-BRANTHOME

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

Activity

  1. Matthieu-BRANTHOME commented on Oct 12, 2022

    @Matthieu-BRANTHOME
    Author

    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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions