{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 1. Activity Magic" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The Activity Magic is a method of giving quizzes, polls, etc. to a group of users on a jupyterhub server. \n", "\n", "In the current implementation, it acts like a Classroom Response System (also called \"clickers\", [audience response system](https://en.wikipedia.org/wiki/Audience_response), personal response systems, student response system, or electronic response system).\n", "\n", "The main pedagogical use is for implementing instantaneous anonymous polling for gaging student understanding." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Table of Contents\n", "* [1. Activity Magic](#1.-Activity-Magic)\n", "\t* [1.1 Requirements](#1.1-Requirements)\n", "\t\t* [1.1.1 Install tl;dr](#1.1.1-Install-tl;dr)\n", "\t* [1.2 Workflow](#1.2-Workflow)\n", "\t* [1.3 Demonstration](#1.3-Demonstration)\n", "\t* [1.4 JSON Details](#1.4-JSON-Details)\n", "\t\t* [1.4.1 Top level](#1.4.1-Top-level)\n", "\t\t* [1.4.2 Activity types](#1.4.2-Activity-types)\n", "\t\t\t* [1.4.2.1 poll](#1.4.2.1-poll)\n", "\t* [1.5 Results file format](#1.5-Results-file-format)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1.1 Requirements" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To use, you will need:\n", "\n", "* [jupyterhub](https://github.com/jupyter/jupyterhub) - for multi-user notebook server\n", "* [metakernel](https://github.com/Calysto/metakernel/) - for the [activity magic](https://github.com/Calysto/metakernel/blob/master/metakernel/magics/activity_magic.py)\n", "* [calysto](https://github.com/Calysto/calysto) - for barcharts" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 1.1.1 Install tl;dr" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "1. Shell: pip install metakernel\n", "2. Shell: pip install calysto\n", "3. Notebook: from metakernel import register_ipython_magics\n", "4. Notebook: register_ipython_magics()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1.2 Workflow" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Activity magic works as follows:\n", "\n", "1. instructor creates a poll using the %%activity cell magic defining a poll via JSON\n", "2. poll appears for verification\n", "3. students use the same file, but via a line magic\n", "4. everyone should make their choice\n", "5. instructor shows bar chart of all choices\n", "6. everyone clicks on \"Next\" to proceed to the next question" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1.3 Demonstration" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Here is the docs on %%activity magic:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%%activity?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```\n", "Docstring:\n", "%%activity FILENAME - make an activity from\n", " a JSON structure\n", "\n", "This magic will construct a Python file from the cell's\n", "content, a JSON structure.\n", "\n", "Example:\n", " %%activity /home/teacher/activity1\n", " {\"activity\": \"poll\",\n", " \"instructors\": [\"teacher01\"],\n", " \"items\": [{\"id\": \"...\",\n", " \"type\": \"multiple choice\",\n", " \"question\": \"...\",\n", " \"options\": [\"...\", ...]\n", " }, ...]\n", " }\n", "\n", "In this example, users will load\n", "/home/teacher/activity1\n", "File: /usr/lib/python3.4/site-packages/metakernel-0.10.5-py3.4.egg/metakernel/magics/activity_magic.py\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Here is an actual poll with three questions:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "%%activity /home/dblank/activity1\n", "\n", "{\"activity\": \"poll\",\n", " \"instructors\": [\"dblank\"],\n", " \"items\": [\n", " {\"id\": \"1\", \n", " \"question\": \"\"\"Which of the following will print \"Hello\" 5 times without errors?\"\"\", \n", " \"type\": \"multiple choice\",\n", " \"options\": [\n", "\"\"\"
\n", "for (int i=0; i < 5; i++) {\n", " println(\"Hello\");\n", "}\n", "\"\"\",\n", "\"\"\"
\n", "println(\"Hello\");\n", "println(\"Hello\");\n", "println(\"Hello\");\n", "println(\"Hello\");\n", "println(\"Hello\");\n", "\"\"\",\n", "\"\"\"
\n", "int i = 0;\n", "while (i < 5) {\n", " println(\"Hello\");\n", " i++;\n", "}\n", "\"\"\",\n", " \"All of the above\",\n", " \"None of the above\",\n", " ]},\n", " \n", " {\"id\": \"2\", \n", " \"question\": \"\"\"Which of the following is a function definition?\"\"\", \n", " \"type\": \"multiple choice\",\n", " \"options\": [\n", "\"\"\"
\n", "void draw() {\n", "}\n", "\"\"\",\n", "\"\"\"
\n", "rect(10, 10, 50, 50);\n", "\"\"\",\n", "\"\"\"
\n", "drawBunny(mouseX, mouseY, 50, 100);\n", "\"\"\",\n", " \"All of the above\",\n", " \"None of the above\",\n", " ]},\n", " {\"id\": \"3\", \n", " \"question\": \"\"\"Which of the following has parameters?\"\"\", \n", " \"type\": \"multiple choice\",\n", " \"options\": [\n", "\"\"\"
\n", "void draw() {\n", "}\n", "\"\"\",\n", "\"\"\"
\n", "void drawRect(float x, float y, float w, float h) {\n", " rect(x, y, w, h);\n", "}\n", "\"\"\",\n", "\"\"\"
\n", "void drawBunny() {\n", " rect(10, 20, 100, 150);\n", "}\n", "\"\"\",\n", " \"All of the above\",\n", " \"None of the above\",\n", " ]},\n", " {\"id\": \"4\", \n", " \"question\": \"\"\"Which of the following is a function call?\"\"\", \n", " \"type\": \"multiple choice\",\n", " \"options\": [\n", "\"\"\"
\n", "void draw() {\n", "}\n", "\"\"\",\n", "\"\"\"
\n", "rect(10, 10, 50, 50);\n", "\"\"\",\n", "\"\"\"
\n", "drawBunny(mouseX, mouseY, 50, 100);\n", "\"\"\",\n", " \"2 and 3\",\n", " \"None of the above\",\n", " ]},\n", " ]\n", "}\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "When executed in a live cell, it shows the following:\n", "\n", "