User:Miriya52/PythonLibrary serialize Wikimedia Quiz format

Project Phabricator task: T89761

Proposal T148072

Anna's Medium blog

Community Bonding Period

 * [X] Work done (environment setup, links to patches merged etc.)
 * Lessons learnt
 * Problems faced and solutions found
 * Any changes to the original plan
 * [X] Minimum Viable Product for the project decided
 * [X] Communication plan with mentor decided. Gitter, because it has a mobile platform


 * [X] Detailed plan agreed with your mentors.
 * [X] Request creation of Phabricator project (instructions).
 * [X] Meetings with mentors started.
 * [X] Bonding period report published.


 * [X] Becoming familiar with the community practices and processes. (This often involves a mix of observation and participation.)
 * [X] Participating on Mailing Lists / IRC / etc. (Not just lurking.)
 * [X] Setting up development environment.
 * [X] Small (or large) patches/bug fixes. (These do not need to be directly related to the Outreachy project.)
 * Working with their mentor and other org members on refining their project plan. This might include finalizing deadlines and milestones, adding more detail, figuring out potential issues, etc.
 * Reading (and updating!) documentation they will need to understand to complete their project.
 * Reporting or replicating bugs.

Preparation Tasks

 * [Oct 2016] Investigation of Pyslet package for Standards in Learning Education and Training (LET). It implements a number of LET-specific standards, including IMS QTI, Content Packaging and Basic LTI. It also includes support for some general standards, including the data access standard OData (see http://www.odata.org).
 * [Oct 27 2016] Submitted a pull request in the pyslet project to fix remaining PEP8 errors.
 * [Nov 16 2016 - ??] Running   in pyslet, and create a wiki page on your fork describing the various problems it finds. That wil, help us determine if swl10/pyslet#38 is feasible. Also does pyslet have good unit tests for the functionality we are interested in? If not, adding some unit tests will improve your knowledge about that library.

Bonding Period Report (before Dec 6)
MVP is "bi-directional support. Tools need to be able to parse and update Quiz data on Wikiversity.  Almost every other embedded content in wikitext is in a format that has parsers and python libraries - this one doesn't." Retain style/token information so round-trip conversion has very few dirty diffs.

Use cases include:
 * Importing quizzes from other systems in Wikiversity, to back up materials for mooc/quiz systems going offline or being upgraded.
 * Generate custom/personalized quiz (in Python) and push to Wikiversity user page
 * Gamification of Wikimedia, using Python webapps deployed on the tool labs.
 * (See comments in original phabricator task: https://phabricator.wikimedia.org/T89761)

Communication on Gitter (https://gitter.im/WM-quiz-serialize/Lobby). Gitter has a mobile app.

My development environment will primarily be a cloud Ubuntu 16.04 server and sublime text on MacOS for syntax highlighting, which was useful for fixing PEP8 errors.

My Medium blog posts [Nov 17, Dec 1] discussed the preparation tasks I worked on before official internship start date of December 6, 2016.

Additional comments

 * I will be using my travel allowance to attend Wikimedia Developer Summit. I reviewed the proposal topics and provided feedback on my topics of interest.
 * I have also looked into packaging a Python library (Packaging a Python Library (PyCon 2016), Hitchhiker's Guide to Python - Structuring Your Project)

Week 1: December 6 - 9
Comparison of quiz format specifications for WikiQuiz, GIFT, and QTI.

Week 1 Report

Week 2: December 12 - 16
TL;DR. QTI specs include UI/UX and more complex than GIFT. QTI objects also have multiple levels of inheritance, in which inherited classes seem to be mostly for the xml tags in QTI. Can the pyslet GIFT class be simple, or needs to mimic the multiple levels of inheritance?

I looked into mapping the GIFT format to the QTI v2.1 classes in pyslet. The QTI specification includes UI/UX, and much more complexity than in GIFT. GIFT simply specifies the a text microformat for quiz questions. I'm working on making pyslet.GIFT class that has the same structure as pyslet.qtiv2, but only for the classes that are relevant to the GIFT format.

Week 2 Report

Medium blog post #3 (Dec 16)

Week 3: December 19 - 23
Reading through the pyslet source code to understand the pyslet structure for parsing QTI v2.1 to objects. I added a unit test in the gift_support branch, and will be writing the parsers to satisfy this unit test.

Week 3 Report

Week 4: December 26 - 30
This past week, I worked on the parser and structures for GIFT. I'm wondering if this is the correct approach, as there are many supporting functions to emulate the complex inheritance structure of pyslet.

Week 4 Report

Medium blog post #4 (Dec 30)

Week 5: January 2 - 6

 * I added most of the unittests for gift.structures that don't rely on parsing logic.
 * Next is working on the parsing logic and associated unittests.

Week 5 Report

Week 6: Wikimedia Developer Summit, January 9 - 13
Wikimedia Developer Summit (Jan 9-11, 2017) Trip Report

What did I learn or accomplish? How did it improve my ability to contribute to free and open source software?

Medium blog post #5 (Jan 13)

Week 7: January 16 - 20
This week I focused on parsing a basic GIFT formatted text, a comment.

Week 7 report

Week 8: January 23 - 27, Midterm Report

 * Weekly reports up to date.
 * Patches published and accepted (or equivalent for non-coding projects).
 * Regular meetings with mentors.
 * If there is a delay in expected deliveries, plan updated accordingly.
 * Full-time routine established

Midterm Report

—

I added some more unittests and method implementation to pass those tests. I am also still figuring out how the pyslet xml components interacts with the structures, and how to adapt it for the gift format. In trying to trace from the parser to the structures, I found that I need to take some time to actually figure out how the classes and methods interact to populate the structures. Also, which classes and methods are still relevant for the gift format.

Week 8 Report

Week 9: January 30 - February 3

 * Read through pyslet structures and tutorial on XML format to better understand how the QTI text is parsed to the pyslet structures.
 * Successfully parses the question title in a basic question to the pyslet tree structure

Week 9 report

Week 10: February 6 - 10

 * Successfully parses basic question
 * Working on validation check, adding True/False type, and reading in a file.

Medium blog post #6 (Feb 10)

Week 10 Report

Week 11: February 13 - 17

 * Parses additional types
 * Reads in gift format text in file and parses it to a document object

Week 11 Report

Week 12: February 20 - 24

 * Bi-directional support for for valid and well-formed input: parse GIFT format text to Pyslet structures, and then generate GIFT format text. See update in project wiki.
 * Added | pyslet issue 63 about inconsistent behaviour for QTI v2.1 example as input. This issue is documented here
 * Fixed parser.parse_document with instantiating Document object
 * Added more unittests for wellformed and parse document
 * Wrote a GitHub wiki to describe project
 * Looking to address py2/py3 type error in Travis CI, but not manual tox. Also, adding validation.  These issues documented here

Medium blog post #7 (Feb 24)

Week 13: February 27 - March 3

 * point 1
 * point 2

Final Evaluation (March 6, 2017)

 * Weekly reports up to date.
 * In sync with mentors.
 * Full-time routine.
 * Project completed, or at least a functional prototype.
 * Tasks created for known bugs, missing features, and suggested improvements.
 * Documentation for users and contributors.
 * Wrap-up report.
 * Summary in Past projects page

Final Report

Relevant links

 * Moodle's reference PHP GIFT parser
 * Moodle GSoC 2017