19
© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 1 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 1 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 1 ____ __ ____ _____ ____ ______ _____ _____ ____ _____ Click to edit Master text styles Second level Third level Enhancing Spotfire with the Power of R Charles Roosen (Mango Solutions) Difei Luo (TIBCO Software)

Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 1 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 1 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

1

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

Enhancing Spotfire with the Power of R

Charles Roosen (Mango Solutions)

Difei Luo (TIBCO Software)

Page 2: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 2 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 2 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

2

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

Overview

What is Spotfire?

The Spotfire Platform

The Spotfire SDK

R Extensions for Spotfire

Motivation

Extension Types

Implementation Details

Page 3: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 3 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 3 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

3

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

The Spotfire Platform

Page 4: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 4 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 4 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

4

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

TIBCO Spotfire Enterprise Analytics overview

Analysts Business Users

IT &

Developers

Data

Integration

Security

Integration App

Integration

Platform

Extensibility

Page 5: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 5 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 5 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

5

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

TIBCO Spotfire

Professional – In-memory interactive analytics

Explore data with multiple, linked visualizations From simple Bar charts to powerful statistics at the

tip of your fingers

Instantly share any analysis

No separate publishing step

Auto-generated dynamic filters

Real-time, in-memory filtering on any field

Intuitive, user-driven interface Completely interactive user

experience

Load data from multiple sources ODBC/OleDB access, TS As

Information Links, Excel Spreadsheets, flat data files, …

Page 6: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 6 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 6 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

6

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

TS Enterprise Analytics – Platform Overview

CL

IEN

TS

SE

RV

ER

S

Zero Install In-Memory Engine

Web Player Enterprise Player Professional

In-Memory Engine

Web Player

Server

Administration & Integration

Spotf ire Server

Developer

IT / DBA

Development,

Solutions,

Integration,

Statistical Programming

Computation Engine

S+ Server

Real-TimeConnectivity

Event

Processing

Server

Managers, Consumers,

Executives

Analysts

Power Users

Statisticians

Analysts

Power Users

Statisticians

Managers, Consumers,

ExecutivesStatisticians

Computation Engine

Miner S+

Developer

DA

TA

SO

UR

CE

S

DataStreams

Data at rest Data in motion

Relational

Databases

SAP BI

SAP BW

SAP ERP

SAP R/3

SiebelOracle

eBusinessSalesforce

*.xls*

*.mdb

…etc

*.csv

*.txt

…etc

*.xml ,

custom

sources

WebServices

Page 7: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 7 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 7 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

7

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

Demo: Spotfire

Page 8: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 8 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 8 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

8

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

The Spotfire SDK

Page 9: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 9 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 9 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

9

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

What is the Spotfire SDK?

The TIBCO Spotfire platform has a software development kit

(SDK) for configuring, automating, and extending the platform.

The SDK is used to create custom TIBCO Spotfire Extensions.

Extensions add features that from the end users perspective are virtually

indistinguishable from the built-in features.

Extensions are implemented in C# using Visual Studio

Well documented API’s

Well designed architecture

Good examples on the Spotfire Technology Network

Page 10: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 10 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 10 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

10

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

Extension Types

TIBCO Spotfire Extension types include:

Data Reader: Import data from custom file, database, and web services data

sources

Data Writer: Export data to custom file, database, and web services data sources

Calculation: Add custom aggregation, expression function, and statistical

methods that automatically re-execute on data update events

Dialog Tool: Prompt users for input into custom application and document-level

automation jobs

Control Panel: Collect user input from and display feedback to an always

available custom control panel

Visualization Panel: Display custom charts, plots and other forms of

presentation based on the current set of filtered and marked data

Automation Interface: Send and receive properties, events, and commands to

and from an external application

Page 11: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 11 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 11 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

11

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

R Extensions for Spotfire

Page 12: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 12 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 12 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

12

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

Motivation

R has a wealth of statistical techniques of value to Spotfire

users

R core features

Bioconductor

PK modeling

Focus is on using R for statistical computation

R does the computation

Spotfire does the user interface, graphics, reporting, and automation

Why not just use S+?

R has functionality not available for S+, e.g. Bioconductor

Page 13: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 13 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 13 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

13

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

Extensions Implemented

Open R Data File

Load the first object in an “RData” file as a data.frame

Open R Script File

Execute an R script file creating a data.frame

Open From R Expression

Execute a one-liner expression creating a data.frame

R Column Calculation

Execute an R expression that creates a column

R Custom Expression

Execute an R expression computing a summary such as “mean()” or “mad()”

Create and Manage General R Calculations

Execute a block of R code creating a table

Page 14: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 14 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 14 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

14

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

Demo: R Extensions

Page 15: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 15 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 15 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

15

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

Implementation Details

General approach

Spotfire writes data to a tab-delimited file

R reads the data, does some processing, and writes results to a tab-delimited file

Spotfire reads the tab-delimited file

The C# code

On the C# side, most of the code is somewhat generic code for invoking some

general process and communicating to it via text files

The only R-specific code is that related to what “Process” is invoked

The R code

A general R template script handles the data exchange and errors

Each type of extension has an R script, e.g. “Create Column”

Varying values such as file names or R expressions are inserted into the script as

“spotfire.parameters”

Page 16: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 16 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 16 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

16

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

C# Process Code

File.WriteAllText(generatedScriptFile, masterScript);

string args = string.Format("CMD BATCH {0} {1} {2}", batchOptions,

scriptFileName, stdoutFileName);

string rExecPath = RCalculationUtilities.GetRExecutableFilePath();

ProcessStartInfo info = new ProcessStartInfo(rExecPath, args);

info.WorkingDirectory = sessionDir;

info.WindowStyle = ProcessWindowStyle.Hidden;

try {

using (Process rProc = Process.Start(info)) {

rProc.WaitForExit();

if (rProc.ExitCode > 1) {

string errorMsgFileName = Path.Combine(sessionDir,

"errormsg.txt");

if (File.Exists(errorMsgFileName)) {

errorMsg = File.ReadAllText(errorMsgFileName);

}

}

}

}

Page 17: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 17 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 17 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

17

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

R Master Template

# If an error occurs, quit with a non-zero status code

options(error = expression({{cat(geterrmessage(), file="errormsg.txt");q(status=100)}}))

# Parameters for passing settings other than data to R.

spotfire.parameters <- {1}

# Load data

spotfire.inputFilename <- "{2}"

spotfire.data <- read.delim(spotfire.inputFilename, check.names = FALSE)

# BEGIN User defined script

{0}

# END User defined script

# Save results

spotfire.outputFilename <- "{3}"

write.table(spotfire.results, file = spotfire.outputFilename, sep = "\t", na = "", row.names = FALSE)

Page 18: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 18 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 18 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

18

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

R Extension Scripts

## R objects used:

##

## spotfire.data: data.frame passed from Spotfire to R

## spotfire.parameters: named character vector of parameters

## spotfire.results: data.frame passed from R to Spotfire

##

## Note: Error and special-case handling code left out for space reasons

# Example 1: Load the data from an Rdata file

spotfire.results <- get(load(file = spotfire.parameters["FilePath"])[1])

# Example 2: Execute an expression creating a data.frame

expr <- spotfire.parameters["DataFrameCreationExpression"]

spotfire.results <- eval(parse(text=expr))

# Example 3: Execute an expression creating a column

expr <- spotfire.parameters["CreateColumnExpression"]

spotfire.results <- with(spotfire.data, eval(parse(text=expr)))

Page 19: Click to edit Master text styles Enhancing Spotfire with ......The TIBCO Spotfire platform has a software development kit (SDK) for configuring, automating, and extending the platform

© 2006 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 19 © 2005 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary. 19 © 2008 TIBCO Software Inc. All Rights Reserved. Confidential and Proprietary.

19

____ __ ____ _____ ____ ______ _____ _____ ____ _____

Click to edit Master text styles Second level Third level

Summary

Spotfire is a useful tool for interactive data visualization

R provides rich computational capabilities for Spotfire users

The Spotfire SDK makes it easy to integrate the two

Simple communication via text files and a child process works

pretty well