Skip to content
/ MTV Public

A General Platform for Multivariate Time Series Visualization.

License

Notifications You must be signed in to change notification settings

dyuliu/MTV

Repository files navigation

“DAI-Lab” An open source project from Data to AI Lab at MIT.

Build Status Coverage Status CLA

MTV

MTV is a visual analytics system built for anomaly analysis of multiple time-series data.

The Restful APIs documentation: http:https://45.77.5.58/apidoc/

License

The MIT License

Before You Begin

Before you begin we recommend you read about the basic building blocks that assemble the MTV:

  • Python (>=3.0) - MTV has been developed and runs on Python 3.6. Although it is not strictly required, the usage of a virtualenv is highly recommended in order to avoid interfering with other software installed in the system where MTV is run.
  • Flask (>=1.0.2) - The best way to understand express is through its Official Website, which has a good Tutorial. We use Flask-RESTful as an extension of Flask to quickly build REST APIs.
  • Typescript (>=3.0) - Typescript's Official Documentation is a great starting point.
  • MongoDB (>=3.6) - Go through MongoDB Official Website and proceed to their Official Manual, which should help you understand NoSQL and MongoDB better.

Prerequisites

Make sure you have installed all of the following prerequisites on your development machine:

  • Git - Download & Install Git. OSX and Linux machines typically have this already installed.

  • Node.js (>= 10.0.0) - Download & Install Node.js and the npm package manager. Make sure to install gulp-cli globally after the installation of Node.js.

    $ npm install --quiet -g gulp-cli
  • MongoDB - Download & Install MongoDB, and make sure it's running on the default port (27017).

Get Started

Downloading MTV

Cloning from Github

The recommended way to get MTV is to use git to directly clone the MTV repository:

$ git clone https://github.com/HDI-Project/MTV mtv

This will clone the latest version of the MTV repository to a mtv folder.

Downloading the zip file

Another way to use the MTV is to download a zip copy from the master branch on GitHub. You can also do this using the wget command:

$ wget https://github.com/HDI-Project/MTV/archive/master.zip -O mtv.zip
$ unzip mtv.zip
$ rm mtv.zip

Don't forget to rename mtv-master after your project name.

Quick Install

Once you've downloaded the MTV repository and installed all the prerequisites, you're just a few steps away from running your application. To install the project, create a virtualenv and execute

$ make install
$ make install-theme

This command will install all the dependencies needed for the application (server-end and client-end) to run. For development, use the following command instead, which will install some additional dependencies for code linting and testing

$ make install-develop
$ make install-theme

Data

Downloading the demo data
$ make load-db-mtv

This will download and restore the dataset into MongoDB.

Working with Orion to generate your own data

Once the required data is generated using Orion, you simple type the following command to sync the data from Orion to MTV. Note that you can configure the mongodb in the file ./mtv/config.yaml.

$ mtv update db -v

Running Your Application

Please activate your virtualenv for MTV first, and then use the following command to run the application.

$ mtv run -v

Your application should run on port 3000 with the production environment by default. Just go to http:https://localhost:3000 in your browser (Chrome). The following list the optional arguments for mtv run

usage: mtv run [-h] [-l LOGFILE] [-v] [-P PORT] [-E ENV]

optional arguments:
  -h, --help             show this help message and exit
  -l, --logfile LOGFILE  Name of the logfile. If not given, log to stdout.
  -v, --verbose          Be verbose. Use -vv for increased verbosity.
  -P PORT, --port PORT   Flask server port
  -E ENV, --env ENV      Flask environment

Development

The server-end code and client-end code are in two separate folders, namely, <project-home>/mtv and <project-home>/client

Run the following command for server-end development

$ mtv run -E development -v

Run the following command for client-end development

$ cd client
$ gulp

Production deploy with Docker

  • Install Docker and Compose

  • Load data into the mongo container

    $ make docker-db-up
  • Run the application

    $ docker-compose up -d

    The application should be successfully running on port 3000 using the production environment by default. Just go to http:https://localhost:3000 in your chrome browser to start your exploration.

    Note: if MTV is deployed in a remote server, please change the variable server in .client/src/config.ts to the server IP address with right port.

  • Stop the application

    $ docker-compose stop
  • Remove the related containers and volumes (optional step)

    $ docker-compose down -v

Production deploy in local secure environment

  • Install Docker and Compose

  • Download MTV project and put the MTV docker image into the project direction

  • Enter the MTV folder and install the docker image by running

    $ docker load --input mtv.tar
    Loaded image: dyuliu/mtv:latest
    Loaded image: mongo:4.0
  • Restore data back to database running on mongo:4.0 container

    $ docker-compose -f docker-compose-db.yml up
  • Run the application. Please check the file docker-compose.yml and make sure line 18 (build: .) is commented and line 17 (image: dyuliu/mtv) is uncommented.

    $ docker-compose up -d

    Your application should run on port 3000 with the production environment by default. Just go to http:https://localhost:3000 in your browser to start your exploration.

  • Stop the application

    $ docker-compose stop