Getting Started#

Symphony is a framework that wraps task-specific visualization components for different environments. To load data into Symphony, only a Pandas-like metadata table is required. Symphony can be used in Jupyter Notebooks, created directly from Python scripts, and loaded as standalone web-based dashboards. Individual components have access to a shared state, which is kept in a shared toolbar component. This toolbar component synchronizes state between all active components and provides common interaction patterns.

Installation#

To install the main Symphony package, run:

pip install symphony_ui

You can then install individual components, for example:

pip install symphony_summary

See Available Components for a list of all the other component packages. If you want to install all available components, run:

pip install "symphony_ui[widgets]"

Symphony works great with DNIKit. You can use DNIKit to generate analysis data for Symphony, for example for the Familiarity and Duplicates components. If you want to run the precomputed Symphony example that uses DNIKit, run:

pip install "symphony_ui[examples]"

Usage#

Symphony can either be used as individual components in a Jupyter Notebook or as a combination of components in a standalone web dashboard. We currently do not support Jupyter Lab.

Jupyter Notebook#

First, we import the Symphony class and any components we would like to use, in this case only the SymphonySummary component.

from symphony_ui import Symphony
from symphony_summary import SymphonySummary

Next, for this example, we’ll create a simple Pandas DataFrame with some mock data.

import random
import pandas as pd

a = [random.random() * 100 for i in range(100)]
b = [random.random() * 10 for i in range(100)]
c = [random.random() for i in range(100)]

df = pd.DataFrame(zip(a, b, c), columns=['a', 'b', 'c'])
print(df.head())
           a         b         c
0   5.896428  2.091387  0.606556
1  59.016360  4.856744  0.141110
2  77.360630  0.419707  0.157936
3   4.597110  1.613752  0.393199
4  91.483971  3.152750  0.442023

Combining these, we can create a Symphony instance and use our components to explore the data.

symph = Symphony(df)
symph.widget(SymphonySummary)

That’s it! You can import different components and pass them to symph.widget(). To see other components, check out more Examples.

Standalone Dashboard#

There are two ways to create and use a standalone dashboard.

Dashboard from a Notebook#

If you are working from a notebook, you can export the current Symphony instance to a static folder using export().

symph.export('./standalone/')

Dashboard from a Python Script#

You can also create a standalone version from a Python script, making it possible to run on remote services or as a chron job.

To do this, we use the standalone() function which takes in which components you would like to include.

from symphony_ui import Symphony
from symphony_summary import SymphonySummary

import random
import pandas as pd

a = [random.randint(0, 100) for i in range(100)]
b = [random.randint(50, 200) for i in range(100)]
c = [random.randint(0, 1) for i in range(100)]

df = pd.DataFrame(zip(a, b, c), columns=['a', 'b', 'c'])

symph = Symphony(df)
symph.standalone([SymphonySummary], './standalone/')

You can then serve the Symphony export from the command line python -m http.server to see the dashboard. The static directory can be deployed to a service like GitHub Pages to share with others.