A simple flask application to collect annotations for the Turing Change Point Dataset, a benchmark dataset for change point detection algorithms

Overview

AnnotateChange

Welcome to the repository of the "AnnotateChange" application. This application was created to collect annotations of time series data in order to construct the Turing Change Point Dataset (TCPD). The TCPD is a dataset of real-world time series used to evaluate change point detection algorithms. For the change point detection benchmark that was created using this dataset, see the Turing Change Point Detection Benchmark repository.

Any work that uses this repository should cite our paper: Van den Burg & Williams - An Evaluation of Change Point Detection Algorithms (2020). You can use the following BibTeX entry:

@article{vandenburg2020evaluation,
        title={An Evaluation of Change Point Detection Algorithms},
        author={{Van den Burg}, G. J. J. and Williams, C. K. I.},
        journal={arXiv preprint arXiv:2003.06222},
        year={2020}
}

Here's a screenshot of what the application looks like during the annotation process:

screenshot of 
AnnotateChange

Some of the features of AnnotateChange include:

  • Admin panel to add/remove datasets, add/remove annotation tasks, add/remove users, and inspect incoming annotations.

  • Basic user management: authentication, email confirmation, forgotten password, automatic log out after inactivity, etc. Users are only allowed to register using an email address from an approved domain.

  • Task assignment of time series to user is done on the fly, ensuring no user ever annotates the same dataset twice, and prioritising datasets that are close to a desired number of annotations.

  • Interactive graph of a time series that supports pan and zoom, support for multidimensional time series.

  • Mandatory "demo" to onboard the user to change point annotation.

  • Backup of annotations to the admin via email.

  • Time series datasets are verified upon upload acccording to a strict schema.

Getting Started

Below are instructions for setting up the application for local development and for running the application with Docker.

Basic

AnnotateChange can be launched quickly for local development as follows:

  1. Clone the repo

    $ git clone https://github.com/alan-turing-institute/AnnotateChange
    $ cd AnnotateChange
    
  2. Set up a virtual environment and install dependencies (requires Python 3.7+)

    $ sudo apt-get install -y python3-venv # assuming Ubuntu
    $ pip install wheel
    $ python3 -m venv ./venv
    $ source ./venv/bin/activate
    $ pip install -r requirements.txt
    
  3. Create local development environment file

    $ cp .env.example .env.development
    $ sed -i 's/DB_TYPE=mysql/DB_TYPE=sqlite3/g' .env.development
    

    With DB_TYPE=sqlite3, we don't have to deal with MySQL locally.

  4. Initialize the database (this will be a local app.db file).

    $ ./flask.sh db upgrade
    
  5. Create the admin user account

    $ ./flask.sh admin add --auto-confirm-email
    

    The --auto-confirm-email flag automatically marks the email address of the admin user as confirmed. This is mostly useful in development environments when you don't have a mail address set up yet.

  6. Run the application

    $ ./flask.sh run
    

    This should tell you where its running, probably localhost:5000. You should be able to log in with the admin account you've just created.

  7. As admin, upload ALL demo datasets (included in demo_data) through: Admin Panel -> Add dataset. You should then be able to follow the introduction to the app (available from the landing page).

  8. After completing the instruction, you then will be able to access the user interface ("Home") to annotate your own time series.

Docker

To use AnnotateChange locally using Docker, follow the steps below. For a full-fledged installation on a server, see the deployment instructions.

  1. Install docker and docker-compose.

  2. Clone this repository and switch to it:

    $ git clone https://github.com/alan-turing-institute/AnnotateChange
    $ cd AnnotateChange
    
  3. Build the docker image:

    $ docker build -t gjjvdburg/annotatechange .
    
  4. Create the directory for persistent MySQL database storage:

    $ mkdir -p persist/{instance,mysql}
    $ sudo chown :1024 persist/instance
    $ chmod 775 persist/instance
    $ chmod g+s persist/instance
    
  5. Copy the environment variables file:

    $ cp .env.example .env
    

    Some environment variables can be adjusted if needed. For example, when moving to production, you'll need to change the FLASK_ENV variable accordingly. Please also make sure to set a proper SECRET_KEY and AC_MYSQL_PASSWORD (= MYSQL_PASSWORD). You'll also need to configure a mail account so the application can send out emails for registration etc. This is what the variables prefixed with MAIL_ are for. The ADMIN_EMAIL is likely your own email, it is used when the app encounters an error and to send backups of the annotation records. You can limit the email domains users can use with the USER_EMAIL_DOMAINS variable. See the config.py file for more info on the configuration options.

  6. Create a local docker network for communiation between the AnnotateChange app and the MySQL server:

    $ docker network create web
    
  7. Launch the services with docker-compose

    $ docker-compose up
    

    You may need to wait 2 minutes here before the database is initialized. If all goes well, you should be able to point your browser to localhost:7831 and see the landing page of the application. Stop the service before continuing to the next step (by pressing Ctrl+C).

  8. Once you have the app running, you'll want to create an admin account so you can upload datasets, manage tasks and users, and download annotation results. This can be done using the following command:

    $ docker-compose run --entrypoint 'flask admin add --auto-confirm-email' annotatechange
    
  9. As admin, upload ALL demo datasets (included in demo_data) through: Admin Panel -> Add dataset. You should then be able to follow the introduction to the app (available from the landing page).

  10. After completing the instruction, you then will be able to access the user interface ("Home") to annotate your own time series.

Notes

This codebase is provided "as is". If you find any problems, please raise an issue on GitHub.

The code is licensed under the MIT License.

This code was written by Gertjan van den Burg with helpful comments provided by Chris Williams.

Some implementation details

Below are some thoughts that may help make sense of the codebase.

  • AnnotateChange is a web application build on the Flask framework. See this excellent tutorial for an introduction to Flask. The flask.sh shell script loads the appropriate environment variables and runs the application.

  • The application handles user management and is centered around the idea of a "task" which links a particular user to a particular time series to annotate.

  • An admin role is available, and the admin user can manually assign and delete tasks as well as add/delete users, datasets, etc. The admin user is created using the cli (see the Getting Started documentation above).

  • All datasets must adhere to a specific dataset schema (see utils/dataset_schema.json). See the files in [demo_data] for examples, as well as those in TCPD.

  • Annotations are stored in the database using 0-based indexing. Tasks are assigned on the fly when a user requests a time series to annotate (see utils/tasks.py).

  • Users can only begin annotating when they have successfully passed the introduction.

  • Configuration of the app is done through environment variables, see the .env.example file for an example.

  • Docker is used for deployment (see the deployment documentation in docs), and Traefik is used for SSL, etc.

  • The time series graph is plotted using d3.js.

You might also like...
This repository outlines deploying a local Kubeflow v1.3 instance on microk8s and deploying a simple MNIST classifier using KFServing.

Zero to Inference with Kubeflow Getting Started This repository houses all of the tools, utilities, and example pipeline implementations for exploring

A simple tutorial to get you started with Discord and it's Python API
A simple tutorial to get you started with Discord and it's Python API

Hello there Feel free to fork and star, open issues if there are typos or you have a doubt. I decided to make this post because as a newbie I never fo

SCTYMN is a GitHub repository that includes some simple scripts(currently only python scripts) that can be useful.

Simple Codes That You Might Need SCTYMN is a GitHub repository that includes some simple scripts(currently only python scripts) that can be useful. In

Żmija is a simple universal code generation tool.

Żmija Żmija is a simple universal code generation tool. It is intended to be used as a means to generate code that is both efficient and easily mainta

 Simple yet powerful CAD (Computer Aided Design) library, written with Python.
Simple yet powerful CAD (Computer Aided Design) library, written with Python.

Py-MADCAD it's time to throw parametric softwares out ! Simple yet powerful CAD (Computer Aided Design) library, written with Python. Installation

A simple XLSX/CSV reader - to dictionary converter
A simple XLSX/CSV reader - to dictionary converter

sheet2dict A simple XLSX/CSV reader - to dictionary converter Installing To install the package from pip, first run: python3 -m pip install --no-cache

A simple USI Shogi Engine written in python using python-shogi.

Revengeshogi My attempt at creating a USI Shogi Engine in python using python-shogi. Current State of Engine Currently only generating random moves us

A simple document management REST based API for collaboratively interacting with documents

documan_api A simple document management REST based API for collaboratively interacting with documents.

3D AffordanceNet is a 3D point cloud benchmark consisting of 23k shapes from 23 semantic object categories, annotated with 56k affordance annotations and covering 18 visual affordance categories.
3D AffordanceNet is a 3D point cloud benchmark consisting of 23k shapes from 23 semantic object categories, annotated with 56k affordance annotations and covering 18 visual affordance categories.

3D AffordanceNet This repository is the official experiment implementation of 3D AffordanceNet benchmark. 3D AffordanceNet is a 3D point cloud benchma

Motion detector, Full body detection, Upper body detection, Cat face detection, Smile detection, Face detection (haar cascade), Silverware detection, Face detection (lbp), and Sending email notifications
Motion detector, Full body detection, Upper body detection, Cat face detection, Smile detection, Face detection (haar cascade), Silverware detection, Face detection (lbp), and Sending email notifications

Security camera running OpenCV for object and motion detection. The camera will send email with image of any objects it detects. It also runs a server that provides web interface with live stream video.

Pyrin is an application framework built on top of Flask micro-framework to make life easier for developers who want to develop an enterprise application using Flask
Pyrin is an application framework built on top of Flask micro-framework to make life easier for developers who want to develop an enterprise application using Flask

Pyrin A rich, fast, performant and easy to use application framework to build apps using Flask on top of it. Pyrin is an application framework built o

IMGUR5K handwriting set. It is a handwritten in-the-wild dataset, which contains challenging real world handwritten samples from different writers.The dataset is shared as a set of image urls with annotations. This code downloads the images and verifies the hash to the image to avoid data contamination.
iloveflask is a Python library to collect functions that help a flask developer generate reports, config files and repeat code.

I Love Flask iloveflask is a Python library to collect functions that help a flask developer generate reports, config files and repeat code. Installat

Very simple NCHW and NHWC conversion tool for ONNX. Change to the specified input order for each and every input OP. Also, change the channel order of RGB and BGR. Simple Channel Converter for ONNX.
Very simple NCHW and NHWC conversion tool for ONNX. Change to the specified input order for each and every input OP. Also, change the channel order of RGB and BGR. Simple Channel Converter for ONNX.

scc4onnx Very simple NCHW and NHWC conversion tool for ONNX. Change to the specified input order for each and every input OP. Also, change the channel

A Celery application to collect data, download media and extract information from social media APIs

Project IBEX A Celery application to collect data, download media and extract information from social media APIs. Requirements You must have a Redis D

This is the official repository for evaluation on the NoW Benchmark Dataset. The goal of the NoW benchmark is to introduce a standard evaluation metric to measure the accuracy and robustness of 3D face reconstruction methods from a single image under variations in viewing angle, lighting, and common occlusions. An esoteric visual language that takes image files as input based on a multi-tape turing machine, designed for compatibility with C.
An esoteric visual language that takes image files as input based on a multi-tape turing machine, designed for compatibility with C.

vizh An esoteric visual language that takes image files as input based on a multi-tape turing machine, designed for compatibility with C. Overview Her

Neural Turing Machines (NTM) - PyTorch Implementation
Neural Turing Machines (NTM) - PyTorch Implementation

PyTorch Neural Turing Machine (NTM) PyTorch implementation of Neural Turing Machines (NTM). An NTM is a memory augumented neural network (attached to

Neural Turing Machine (NTM) & Differentiable Neural Computer (DNC) with pytorch & visdom
Neural Turing Machine (NTM) & Differentiable Neural Computer (DNC) with pytorch & visdom

Neural Turing Machine (NTM) & Differentiable Neural Computer (DNC) with pytorch & visdom Sample on-line plotting while training(avg loss)/testing(writ

Comments
  • Fixed broken `DEPLOYMENT.md` hyperlink

    Fixed broken `DEPLOYMENT.md` hyperlink

    The hyperlink to the DEPOLYMENT.md file results in a 404 error. This is simply because the .md extension was missing in the code, which I have included in this pull request.

    opened by INASIC 1
Owner
The Alan Turing Institute
The UK's national institute for data science and artificial intelligence.
The Alan Turing Institute
Tampilan - Change Termux Appearance With Python

Tampilan Gambar usage pkg update && pkg upgrade pkg install git && pkg install f

Creator Lord-Botz 1 Jan 31, 2022
graphical orbitational simulation of solar system planets with real values and physics implemented so you get a nice elliptical orbits. you can change timestamp value or scale from source code idc.

solarSystemOrbitalSimulation graphical orbitational simulation of solar system planets with real values and physics implemented so you get a nice elli

Mega 3 Mar 3, 2022
SqlAlchemy Flask-Restful Swagger Json:API OpenAPI

SAFRS: Python OpenAPI & JSON:API Framework Overview Installation JSON:API Interface Resource Objects Relationships Methods Custom Methods Class Method

Thomas Pollet 361 Nov 16, 2022
DocumentPy is a Python application that runs in a command-line interface environment, made for creating HTML documents.

DocumentPy DocumentPy is a Python application that runs in a command-line interface environment, made for creating HTML documents. Usage DocumentPy, a

Lotus 0 Jul 15, 2021
Testing-crud-login-drf - Creation of an application in django on music albums

testing-crud-login-drf Creation of an application in django on music albums Befo

Juan 1 Jan 11, 2022
DataRisk Detection Learning Resources

DataRisk Detection Learning Resources Data security: Based on the "data-centric security system" position, it generally refers to the entire security

Liao Wenzhe 59 Dec 5, 2022
Anomaly Detection via Reverse Distillation from One-Class Embedding

Anomaly Detection via Reverse Distillation from One-Class Embedding Implementation (Official Code ⭐️ ⭐️ ⭐️ ) Environment pytorch == 1.91 torchvision =

null 73 Dec 19, 2022
Gaphor is the simple modeling tool

Gaphor Gaphor is a UML and SysML modeling application written in Python. It is designed to be easy to use, while still being powerful. Gaphor implemen

Gaphor 1.3k Jan 3, 2023
A collection of simple python mini projects to enhance your python skills

A collection of simple python mini projects to enhance your python skills

PYTHON WORLD 12.1k Jan 5, 2023
A simple malware that tries to explain the logic of computer viruses with Python.

Simple-Virus-With-Python A simple malware that tries to explain the logic of computer viruses with Python. What Is The Virus ? Computer viruses are ma

Xrypt0 6 Nov 18, 2022