What is Rawlytics Notebook?

Rawlytics Notebook is an interactive JavaScript environment designed for data exploration, analysis, and transformation.

Unlike a traditional JavaScript application, a notebook is organized into independent cells that can be executed individually. This allows you to experiment with code, inspect results, and iterate quickly without building a complete application.

A notebook combines code, data, and results in a single workspace, making it suitable for:

  • Exploring datasets
  • Cleaning and transforming data
  • Performing statistical analysis
  • Building reusable data workflows
  • Sharing analytical work with others

Notebook vs JavaScript Script

A traditional JavaScript script typically follows a single execution flow:

Load data
↓
Run code
↓
Produce result
↓
Exit

To get new results, you would need to deploy a new version of the program.

A notebook brings interactivity:

Load data
↓
Run a cell
↓
Inspect result
↓
Modify code
↓
Run another cell
↓
Continue exploring

Instead of repeatedly restarting a program, you work within a persistent environment where code, data, and results remain available throughout the session.

Core Concepts

Once the following concepts are understood, you are ready to create your first Rawlytics Notebook and start working with data.

Sandbox

The sandbox is the execution environment shared by all notebook cells.
It executes code and stores the runtime state of the notebook, including global variables, objects, and loaded datasets.

When a notebook is opened, its cells become available for execution. As cells run, variables, objects, and datasets are created inside the sandbox.

The sandbox remains active until the notebook is closed. It can also be restarted to clear its state and start with a clean environment.

Sandbox Scopes

Unlike many notebook environments where all variables are global by default, Rawlytics Notebook isolates each cell scope and requires variables to be explicitly stored in the sandbox global scope when they need to be shared.

Cell Scope

By default, each cell is executed in its own local scope.

Variables declared inside a cell are isolated from variables declared in other cells. This prevents accidental conflicts between cells and allows multiple versions of the same code to coexist in a notebook.

var total = 100;

The total variable exists only within the scope of the cell where it was created.

Global Scope

Although cells are isolated, they all share the same sandbox.

To make a variable accessible from any cell, store it on the global window object:

Cell 1

window.total = 100;

The variable can then be accessed from another cell:

Cell 2

total += 50;

Using the global scope allows cells to share state while keeping local variables isolated by default.

Logs & Output

When a cell is executed, it can produce two types of visual feedback:

  • Logs, used to inspect and debug execution.
  • Outputs, used to display the final result of a computation.

A cell may produce logs, outputs, both, or neither depending on its purpose.

All Logs and Output methods are available with the Notebook API.

Logs

Logs help you understand what happens while a cell is running.

They can be used to inspect variable values, follow execution steps, identify issues, or provide contextual information about a process.

Rawlytics Notebook provides built-in logging methods that display messages directly below the executed cell.

Logging a message:

notebook.log('Im a cell log');

A cell can produce multiple log entries during execution.

Logs can also be displayed using different visual states to highlight important information.

Setting a warning log:

notebook.warn();

Available log states include:

  • Information
  • Success
  • Warning
  • Error

Using visual states makes notebook execution easier to read and troubleshoot.

Output

The output area is intended to display the final result produced by a cell.

While logs are designed for diagnostic information, outputs are designed for presenting data.

Displaying a dataset as an interactive table:

notebook.output(dataset);

Displaying tabular data as an output is usually more convenient than writing hundreds of rows to the log stream.

Data

Data is a collection of named datasets available within a notebook through the object variable: data.

  • Datasets can be imported from CSV files or generated programmatically.
  • Each dataset can be stored, retrieved, updated, renamed, or removed independently.

The Data API provides dataset management capabilities for the notebook.

Retrieving a dataset from a cell:

var dataset = data.item('data_key').get();

DataFrame

A DataFrame is the primary structure used to work with tabular data.

It organizes information into rows and columns:

┌────┬─────────┬─────────┐
│ id │ product │ revenue │
├────┼─────────┼─────────┤
│ 1  │ A       │ 120     │
│ 2  │ B       │ 95      │
│ 3  │ C       │ 180     │
└────┴─────────┴─────────┘

The DataFrame API provide methods for:

  • Reading data
  • Filtering records
  • Computing statistics
  • Transforming tabular data

Most analytical workflows in Rawlytics Notebook revolve around creating, manipulating, and exporting DataFrames.

Creating a dataFrame with a dataset:

var df = new DataFrame(dataset);