Tutorial: Getting Started with Rapture and iPython Notebook / Jupyter
Objectives:
Jupyter notebook is an open source web application that supports a variety of data science projects including data normalization, visualizations, statistical modeling and machine learning. This tutorials details how to access and manipulate Rapture managed data via a locally running Jupyter notebook.
The specific use case presented here involves loading data received as a csv file into a Rapture managed series repository and charting this data in a Jupyter notebook.
This will cover the following steps:
- Installing jupyter notebook
- Install rapture python modules
- Connecting to Rapture demo env
- Getting data from rapture
- Creating graphs
- Saving data to rapture
For the purposes of this tutorial:
- We have created a Jupyter docker instance that you can connect to your Rapture Demo Env
- We have created a notebook to get you started.
Pre-req
Note: In order to complete this tutorial, you must have a running Rapture instance. If you do not have one, you may request one from dev.incapture.net, or use our docker-compose.yml
There are 2 ways to use Jupyter notebook with Rapture:
1.) Using Docker (easiest/fastest)
- If you do not have Docker installed, please browse to https://docs.docker.com/engine/installation/ and select the appropriate installation method for your machine (OSX, Linux and Windows compatible)
- Once you have the Docker engine installed, simply run the following command to launch your own Jupyter notebook:
**TODO if this is to remain an option: make tutorial notebook files available in a downloadable .zip file.
docker run -d -p 9999:9999 --name jupyter incapture/jupyter
OR (if you are using our docker-compose.yml):
docker run -d -p 9999:9999 --link raptureapiserver --name jupyter incapture/jupyter
Then browse to <dockerMachineIP>:9999
2.) Install Jupyter locally
*Prerequisite: Anaconda must be installed locally
conda install jupyter pip install RaptureAPI pip install requests pip install xlrd pip install bokeh pip install quandl pip install raptureAPI
Then browse to: localhost:8888
2. Open Tutorial Notebook
- Browse to <dockerMachineIP>:9999 or localhost:8888 depending on which install method you chose.
- Navigate to tutorial/QMG/
- Open the settings.py file and change the following:
- Change the localInstance variable to http://<yourRaptureInstanceAddress>:8665/rapture
- *Alternatively, you can use the name of the apiserver docker container, ex: "http://raptureapiserver:8665/rapture" if using the incapture/jupyter Docker image.
- set localUser to your username on your Rapture instance.
- *If you are using Docker, your default username is: rapture
- set localPassword to your password on your Rapture instance.
- *If you are using Docker, your default password is: rapture
- Change the localInstance variable to http://<yourRaptureInstanceAddress>:8665/rapture
- You are now ready to begin the Data Science tutorial.
3. Begin the Tutorial
- Navigate to Tutorial/QMG/Demo_QMG_1_import.ipynb
- The purpose of this script is to extract data from a csv or xls file, and upload it as a BLOB to your Rapture instance.
-
At the top of this notebook file, you can see the RaptureAPI being imported:
Importfrom raptureAPI import raptureAPI
-
Also note that we are retrieving the variables you set in settings.py for our Rapture login:
import settings settings.init() rapture = raptureAPI.raptureAPI(settings.localInstance, settings.localUser, settings.localPassword)
-
From here, you can follow the documentation within the notebook itself.