{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# T-Mon: Traces Monitor in xAPI-SG, with SIMVA integration" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### T-Mon is a set of Jupyter Notebooks to process, analyze and present visualizations of data following the Experience API for Serious Games Profile (xAPI-SG)\n", "\n", "The following code:\n", "- expects as input a **JSON file with a list of xAPI-SG statements, obtained from SIMVA**\n", "- **analyzes the xAPI-SG statements** and fills an adaptation of the **default set of visualizations**\n", "https://github.com/e-ucm/rage-analytics/wiki/Default-visualizations-teacher\n", "\n", "For more information, see **T-Mon GitHub page: https://github.com/e-ucm/t-mon**\n", "\n", "\n", "\n", "**xAPI-SG main reference:**\n", "*Applying standards to systematize learning analytics in serious games.\n", "Ángel Serrano-Laguna, Iván Martínez-Ortiz, Jason Haag, Damon Regan, Andy Johnson, Baltasar Fernández-Manjón\n", "Computer Standards & Interfaces 50 (2017) 116–123, http://dx.doi.org/10.1016/j.csi.2016.09.014*\n", "\n", "Further info on GitHub wiki page: https://github.com/e-ucm/rage-analytics/wiki/xAPI-SG-Profile\n", "\n", "Further info about SIMVA on: https://github.com/e-ucm/simva-infra" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## SIMVA connection parameters \n", "\n", "### Defined in *ipyauth-keycloak-demo.env* file:\n", "\n", "- `base_url`: URL pointing to SIMVA's SSO service (default: https://sso.simva.e-ucm.es)\n", "- `realm`: simva\n", "- `response_type`: id_token token\n", "- `client_id`: SIMVA's client used by jupyter (e.g. jupyter)\n", "- `redirect_uri`: jupyter URL (e.g. http://localhost:8888/callback/)\n", "\n", "### After running the following cell, click on \"Sign in\" to enter your SIMVA credentials" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import json\n", "import requests as rq\n", "\n", "from ipyauth import Auth, ParamsKeycloak\n", "\n", "p = ParamsKeycloak(dotenv_file='ipyauth-keycloak-demo.env',\n", " scope='profile openid email')\n", "a = Auth(params=p)\n", "a" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## SIMVA storage parameters\n", "\n", "- `simva_storage_url`: URL pointing to SIMVA storage service (default: https://minio.simva.e-ucm.es)\n", "- `simva_ca_file`: if SIMVA is installed locally this should point to a file with the CA certificate used by simva (usually located at `$SIMVA_HOME/docker-stacks/data/tls/ca/rootCA.pem`), `None` otherwise" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "simva_storage_url = 'https://minio.simva.e-ucm.es'\n", "simva_ca_file = None\n", "\n", "local = True # Set to True if working with a local-hoster Jupyter server, False if working with a web-hosted Jupyter server\n", "storage = 'simva'\n", "\n", "import json\n", "import numpy as np\n", "from datetime import datetime, timedelta\n", "import copy\n", "import math\n", "import matplotlib.dates as mdates\n", "import matplotlib.pyplot as plt\n", "from collections import Counter\n", "import pandas as pd\n", "from ipywidgets import interact, interactive, fixed, HBox, Layout,VBox\n", "import ipywidgets as widgets\n", "from IPython.display import display, clear_output\n", "import pprint\n", "plt.style.use('default')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "***Display all* function** is constructing an app to display all vis" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "players_info = {} # dict with players info\n", "global timeformats\n", "timeformats=['%Y-%m-%dT%H:%M:%SZ','%Y-%m-%dT%H:%M:%S.%fZ'] #array of time format\n", "\n", "%run fileBrowserAndUploadButtonToLoadProcessStatements.ipynb\n", "%run vis/helpersFunctions/clearFigMatplotlib.ipynb\n", "%run globalsSelectors.ipynb\n", "\n", "header=widgets.HTML(\"

xAPI-SG Processor

Please select .json xAPI SG file to process this file and see visualisations

\")\n", "footer=widgets.HTML(\"

xAPI-SG Processor, by eUCM research team

\")\n", "if storage == 'simva' :\n", " app=VBox([header,simvaWidget.widget(),footer])\n", " display(app)\n", "else:\n", " if local:\n", " app=VBox([header,fileBrowser.widget(),footer])\n", " display(app)\n", " else:\n", " app=VBox([header,uploadButtonApp,footer])\n", " display(app)\n", " with outTabs:\n", " display_checkboxes()\n", " clear_output(wait=True)\n", " displayvis(None)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.6" } }, "nbformat": 4, "nbformat_minor": 4 }