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.

Owner
The Alan Turing Institute
The UK's national institute for data science and artificial intelligence.
The Alan Turing Institute
BakTst_Org is a backtesting system for quantitative transactions.

BakTst_Org 中文reademe:传送门 Introduction: BakTst_Org is a prototype of the backtesting system used for BTC quantitative trading. This readme is mainly di

18 May 08, 2021
100 Days of Code Learning program to keep a habit of coding daily and learn things at your own pace with help from our remote community.

100 Days of Code Learning program to keep a habit of coding daily and learn things at your own pace with help from our remote community.

Git Commit Show by Invide 41 Dec 30, 2022
Automated generation of real Swagger/OpenAPI 2.0 schemas from Django REST Framework code.

drf-yasg - Yet another Swagger generator Generate real Swagger/OpenAPI 2.0 specifications from a Django Rest Framework API. Compatible with Django Res

Cristi Vîjdea 3k Dec 31, 2022
Repository for tutorials, examples and starter scripts for using the MTU HPC cluster

MTU-HPC-Starter Repository for tutorials, examples and starter scripts for using the MTU HPC cluster Connecting to the MTU HPC cluster Within the coll

1 Jan 31, 2022
Compare two CSV files for differences. Colorize the differences and align the columns.

pretty-csv-diff Compare two CSV files for differences. Colorize the differences and align the columns. Command-Line Example Command-Line Usage usage:

Devon 6 Dec 29, 2022
This is the repository that includes the code material for the ESweek 2021 for the Education Class Lecture A3 "Learn to Drive (and Race!) Autonomous Vehicles"

ESweek2021_educationclassA3 This is the repository that includes the code material for the ESweek 2021 for the Education Class Lecture A3 "Learn to Dr

F1TENTH Autonomous Racing Community 29 Dec 06, 2022
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

jimy byerley 124 Jan 06, 2023
An MkDocs plugin to export content pages as PDF files

MkDocs PDF Export Plugin An MkDocs plugin to export content pages as PDF files The pdf-export plugin will export all markdown pages in your MkDocs rep

Terry Zhao 266 Dec 13, 2022
A web app builds using streamlit API with python backend to analyze and pick insides from multiple data formats.

Data-Analysis-Web-App Data Analysis Web App can analysis data in multiple formates(csv, txt, xls, xlsx, ods, odt) and gives shows you the analysis in

Kumar Saksham 19 Dec 09, 2022
Watch a Sphinx directory and rebuild the documentation when a change is detected. Also includes a livereload enabled web server.

sphinx-autobuild Rebuild Sphinx documentation on changes, with live-reload in the browser. Installation sphinx-autobuild is available on PyPI. It can

Executable Books 440 Jan 06, 2023
Rust Markdown Parsing Benchmarks

Rust Markdown Parsing Benchmarks This repo tries to assess Rust markdown parsing

Ed Page 1 Aug 24, 2022
YAML metadata extension for Python-Markdown

YAML metadata extension for Python-Markdown This extension adds YAML meta data handling to markdown with all YAML features. As in the original, metada

Nikita Sivakov 14 Dec 30, 2022
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
Generates, filters, parses, and cleans data regarding the financial disclosures of judges in the American Judicial System

This repository contains code that gets data regarding financial disclosures from the Court Listener API main.py: contains driver code that interacts

Ali Rastegar 2 Aug 06, 2022
🐱‍🏍 A curated list of awesome things related to Hugo themes.

awesome-hugo-themes Automated deployment @ 2021-10-12 06:24:07 Asia/Shanghai &sorted=updated Theme Author License GitHub Stars Updated Blonde wamo MIT

13 Dec 12, 2022
JMESPath is a query language for JSON.

JMESPath JMESPath (pronounced "james path") allows you to declaratively specify how to extract elements from a JSON document. For example, given this

1.7k Dec 31, 2022
The source code that powers readthedocs.org

Welcome to Read the Docs Purpose Read the Docs hosts documentation for the open source community. It supports Sphinx docs written with reStructuredTex

Read the Docs 7.4k Dec 25, 2022
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

Sachit 1 Nov 01, 2021
Hasköy is an open-source variable sans-serif typeface family

Hasköy Hasköy is an open-source variable sans-serif typeface family. Designed with powerful opentype features and each weight includes latin-extended

67 Jan 04, 2023
Poetry plugin to export the dependencies to various formats

Poetry export plugin This package is a plugin that allows the export of locked packages to various formats. Note: For now, only the requirements.txt f

Poetry 90 Jan 05, 2023