# Prepare to use the TripleBlind API

The TripleBlind API is easy to use via the Python library included in this SDK. This module enables development in Python and R (via the Reticulate library). The installation script will also set up a Conda environment with all necessary dependencies.

## Install the TripleBlind Python Library

These instructions assume the distribution package has been unzipped under a folder named `~/tripleblind-api`, but you can place it anywhere on your system.

### Mac/Linux installation

1. Start a terminal window
2. Change to the directory with the unzipped distribution package:

       cd ~/tripleblind-api

3. Start the installation script:

       ./install.sh

4. Follow the prompts to complete installation.

### Windows installation:

1. Explore to the folder where you unzipped the distribution package.
2. Double-click on the `install` (or `install.bat`, but not `install.sh`) script.

- If you see a Microsoft Defender warning, click on "More Info" and then select "Run Anyway" to bypass the warning.

3. Follow the prompts to complete installation.

## Setup VS Code (Optional)

You a free to choose your favorite development environment. If unsure, we recommend the excellent (and free!) Visual Studio Code.

1. Download from the official VS Code Download Page.
2. Follow the setup instructions..
3. Launch VS Code and use File > Open Folder... to open the directory where you expanded the TripleBlind SDK.
4. Under View > Extensions menu, search for and install:

- python - the official Python support from Microsoft

5. Hit the F1 key to enter command mode and type: Python: Select Interpreter. Hit enter and pick "Python 3.9.13 (tripleblind)". (The exact version of python might be different.)
6. Hit the F1 key to enter command mode and type: Preferences: Open Workspace Settings (JSON) and enter the following:

       {
           "python.defaultInterpreterPath":
               "C:\\Users\\YOURUSER\\anaconda3\\envs\\tripleblind\\python.exe",
           "python.terminal.activateEnvironment": true,
           "terminal.integrated.shell.windows":
               "C:\\Windows\\system32\\cmd.exe"
       }

   This will run the SDK programs using the 'tripleblind' conda environment

## Obtain User Token

Your authentication token can be found in the Router web interface:

1. Log in to the Router and visit Admin > Settings to get to the Authentication Token section.
2. Click the Copy button to place the token on your clipboard.
3. Enter the token when prompted during the installation process. Alternately, use your text editor to open the `tripleblind.yaml` file at the root of your distribution package and paste it in the `sdkuser_token` value, between the double quotes.

# Using the SDK

The TripleBlind library and dependencies are installed in a tripleblind conda virtual environment. From a command prompt, you can type `conda activate tripleblind` to enter this environment.

The basic layout of the SDK is:

- `tutorials` > `notebooks`
  A series of Jupyter notebooks which lead you through the basics of the SDK.
- `demos`
  A handful of demonstrations covering situations where the TripleBlind technology solves real-world scenarios for businesses and other organizations.
- `examples`
  Scripts illustrating each of the major features offered by TripleBlind.

Several other important files can be found at the root of the SDK folder:

- `tb.py`
  Utility to create, search, manage, download and delete assets from the command line. Type python tb.py --help to learn more. The Mac/Linux installer will also set up an alias so you can simply use tb to invoke this utility.
- `tripleblind.yaml`
  Configuration file holding your personal access token and other settings.

Finally, many folders hold a `README.txt` file. This provides detail about the particular area and further operating instructions.

# Enjoy!

That's it, you are ready to roll! Future upgrades can be installed by simply re-running the installation script and following the prompts.

Page outline
Using the TripleBlind API
▻ Install the Python Library
▻ Obtain User Token
▻ Setup VS Code
Using the SDK