Using the Spotfire Application Profiler

Recently I needed to comb through the entire Exchange.ai library to see which templates had a certain set of Spotfire Extensions in them. This was a great application for Spotfire’ Application Profiler. Using the Application Profiler involves two IronPython scripts:

  • One where you define the output
  • One where you define the action you want to perform on each file.

Output Columns

In the first script, we need to define the output columns for each of the files searched.

from System import Tuple, String
from Spotfire.Dxp.Data import DataType

OutputColumnDataTypes.Add(Tuple.Create[String,DataType]("DCA Wrangler", DataType.String))
OutputColumnDataTypes.Add(Tuple.Create[String,DataType]("3D Subsurface Visualization", DataType.String))
OutputColumnDataTypes.Add(Tuple.Create[String,DataType]("Well Log", DataType.String))
OutputColumnDataTypes.Add(Tuple.Create[String,DataType]("Word Cloud", DataType.String))
OutputColumnDataTypes.Add(Tuple.Create[String,DataType]("Ternary Plot", DataType.String))
OutputColumnDataTypes.Add(Tuple.Create[String,DataType]("Radar Plot", DataType.String))
OutputColumnDataTypes.Add(Tuple.Create[String,DataType]("Scatterplot Matrix", DataType.String))

Searching Script

In the second script, we open each page and traverse the Spotfire document model looking to flag that template as having a Spotfire Extension.

from Spotfire.Dxp.Application.Visuals import *
from Spotfire.Dxp.Application import DocumentMetadata

OutputColumns["DCA Wrangler"] = False
OutputColumns["3D Subsurface Visualization"] = False
OutputColumns["Well Log"] = False
OutputColumns["Word Cloud"] = False
OutputColumns["Ternary Plot"] = False
OutputColumns["Radar Plot"] = False
OutputColumns["Scatterplot Matrix"] = False

for page in Application.Document.Pages:
	for viz in page.Visuals:
		if viz.TypeId.DisplayName == "DCA Wrangler": OutputColumns["DCA Wrangler"] = True
		if viz.TypeId.DisplayName == "3D Subsurface Visualization": OutputColumns["3D Subsurface Visualization"] = True
		if viz.TypeId.DisplayName == "Well Log": OutputColumns["Well Log"] = True
		if viz.TypeId.DisplayName == "Word Cloud": OutputColumns["Word Cloud"] = True
		if viz.TypeId.DisplayName == "Ternary Plot": OutputColumns["Ternary Plot"] = True
		if viz.TypeId.DisplayName == "Radar Plot": OutputColumns["Radar Plot"] = True
		if viz.TypeId.DisplayName == "Scatterplot Matrix": OutputColumns["Scatterplot Matrix"] = True

That’s all you’ll need! Pick a directory to run this on and hit Start and you’ll get the window below:

Technical Director at Ruths.ai

Leave a Comment

Your email address will not be published. Required fields are marked *