By the end of community bonding period we were done with all the requirements elicitation and designing process. In the community bonding period I also did the installation of the required tools : apache-server, flask and it’s dependencies, MySQL and other 3rd party libraries required.

This phase is directly headed towards the coding part of the project.

Decisions made post community bonding period

We decided to go with MySQL under the abstraction of flask-SQLAlchemy ORM.

Rationale for using MySQL

  • Not only it’s very popular and easy to use, but also
  • there’s a great support for it.
  • Security wise also it’s very reliable.
  • Also, switching from MySQL to Maria-DB is quite simple but the reverse is not true. So we can switch to Maria-DB in future if the need be.

Progress made so far

I am strictly following the timeline proposed in the project proposal and have been able to convey all the deliverables as per the timeline as of now. The Phase 1 coding tasks have been completed. Apropos of phase 1 deliverables, code has been pushed to the github repository Rapid Annotator.

Directory Structure / File Hierarchy

With blueprints, we can have possibly 2 different Directory Hierarchy choices namely : functional and divisional. By examining the pros and cons of both I decided to go with a hybrid of the two.

  • As per divisional approch We will divide Rapid Annotator into several smaller packages which will be related to specific tasks. For example admin package will manage all the control the admin has over all application.
  • Borrowing from functional approach we will have code that can be shared across all the packages. For example : generic jinja-macros, jinja-filters, WTForms-validators, css and other reusable code can be used by any of the packages.

Hence, the final Directory Structure is as below

image

Code Implemented

As explained above the entire code base is divided into many smaller packages using flask Blueprints. Below is the list of packages of Rapid Annotator mentioning their functionality along with their names.

Packages of Rapid Annotator

Functionality Name assigned
Login/Registration frontpage
Home Page home
Add New Experiment add_experiment
View Experiment view_experiment
Annotate “This Experiment” annotate_experiment
Admin Page admin

Phase 1 deals with working on first 3 packages namely : frontpage, home , add_experiment. Broadly this phase aims at finishing the frontpage and home packages completely and start working on add_experiment package.

Backend Implementation

  • Created User relation.
  • Created Experiment relation.
  • Created ExperimentOwner association table to make many to many relation between User and Experiments.
  • Created AnnotatorAssociation association object to make many to many relation between User and Experiments.

An association object was needed since this relation had additional fields of start, end and current integer fields indicating the range of the files that specific User has to annotate and the current file number that specific User is annotating.

Generic Code

  • Created generic macros for rendering similar structured information like forms.
  • Created a generic base template that will be common to all the tabs and pages via Jinja template inheritance.
  • Enhance UI of the basic structure of base template

frontpage package

  • Created UI for Login Page.
  • Got Flask-SQLAlchemy working and connected it to MySQL server.
  • Wrote validators for making sure username attribute follows a specific regex pattern.
  • Created Login Form and Registration Form and fields using FlaskForm of flask_WTF and fields of WTForms.
  • Linked it to database and finished user registration.

home package

  • Displayed 2 tabs: My Experiments & Experiments to Annotate.
  • UI details and made a responsive front-end.
  • Created filters required to render specific stuff like datetime in specific format.

add_experiment package

  • Added Owner dropdown displaying list to choose owner from.
  • Added Annotator dropdown displaying a list to choose annotator from.
  • Used Javascript’s jQuery library to make ajax requests to add Owner and Annotators.

Deviations from the proposal

Changes in the database schema

  • In the User model: I have clubbed first name and second name : into fullname, since there is no need of an additional field for name.
  • In the User model: Password Salt is not included in the model: because we are using flask_bcrypt that recommends using the inbuilt salt value. So, I am now storing Password Hash under the field name password itself.
  • In the Experiment model: created_at and status[complete/incomplete] attributes have been added for ease of access by the Owners and Annotators.