Hi Community,
In this article, I will introduce my application iris-DataViz
iris-DataViz is an Exploratory Data Analysis and Visualization Streamlit Application that leverages the functionality of IRIS embedded python and SQLAlchemy to interact with IRIS, as well as the PyGWalker python library for data analysis and data Visualization. PyGWalker (Python Graphic Walker) is an interactive data visualization library built for Python, aiming to bring the ease and functionality of Tableau-style drag-and-drop visualization into Python environments.
Application Features
- Drag-and-Drop Visualization
- Manipulate and clean your data within the visualization
- Wide Range of Chart Types:
- Interactive Data Exploration
- Interactive Aggregation and Grouping:
- Exportable Visualizations
- Automatic Data Summarization
- Calculated / Computed Fields
- Support for Categorical, Numerical, and Temporal Data
- Interactive Legends and Filters
- Interactive Report Generation
- Geospatial Data Support
Application Overview
Application already imported car-related data.
In order to view the data navigate to the Management Portal SQL and view the data by using below SQL command:
SELECT
Make, Model, Year, EngineFuelType, EngineHP,
EngineCylinders, TransmissionType, Driven_Wheels,
NumberofDoors, MarketCategory, VehicleSize,
VehicleStyle, highwayMPG, citympg, Popularity, MSRP
FROM DataViz.CarsInfo
SQLSQL
To run the application Navigate to http://localhost:8051.
Select Namespace,Schema and table. Click on Data tab to analyze the data.
Select the Visualization tab, Drag the desired columns in X-Axis and Y-Axis, and select the desired graph type.
Application Code Snippet
Below objectscript code invoked from embedded Python to get IRIS namespaces:
Class dc.DataViz.Util Extends %RegisteredObject
{
ClassMethod getNameSpaces() As %String
{
//init sql statement
set statement=##class(%SQL.Statement).%New()
//Prepare Class Query
set status=statement.%PrepareClassQuery("%SYS.Namespace","List")
//Check the Error
if $$$ISERR(status)
{
do $system.OBJ.DisplayError(status)
}
//Execute the statement
set resultset=statement.%Execute()
set results = "1"
while resultset.%Next() {
//zw resultset
if results = "1" {
set results = resultset.%Get("Nsp")
}
else
{
set results = results _ "," _ resultset.%Get("Nsp")
}
}
return results
}
}
ObjectScriptObjectScript
Embedded Python Code invoking objectscript code:
import iris
ns = iris.cls('dc.DataViz.Util').getNameSpaces()
namespaces = ns.split(",")
PythonPython
The code below will get schema and tables list:
def get_schema(self):
#Establish IRIS Connection
with self.engine.connect() as conn:
with conn.begin():
sql = text("""
SELECT distinct TABLE_SCHEMA
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE='BASE TABLE'
order by TABLE_SCHEMA
""")
results = []
try:
#Fetch records into results variable
results = conn.execute(sql).fetchall()
schemas="0"
for element in results:
if schemas == "0":
schemas = element[0]
else:
schemas = schemas+","+element[0]
except Exception as e:
print(e)
return schemas
def get_tables(self,schema):
#Establish IRIS Connection
with self.engine.connect() as conn:
with conn.begin():
sql = text("""
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE='BASE TABLE'
AND TABLE_SCHEMA = :schema
order by TABLE_NAME
""").bindparams(schema=schema)
results = []
try:
#Fetch records into results variable
results = conn.execute(sql).fetchall()
tables="0"
for element in results:
if tables == "0":
tables = element[0]
else:
tables = tables+","+element[0]
except Exception as e:
print(e)
return tables
PythonPython
For more details, please visit iris-DataViz open exchange application page.
Thanks
Hi Muhammad,
Your video is available on InterSystems Developers YouTube:
⏯️ iris DataViz - Tableau style drag and drop Data Analysis and Visualization Application
https://www.youtube.com/embed/8rMQHZM6URc?si=W5hilRA6cOMxLm79
[This is an embedded link, but you cannot view embedded content directly on the site because you have declined the cookies necessary to access it. To view embedded content, you would need to accept all cookies in your Cookies Settings]
Thanks @Iryna Mologa