Encontrar

Artículo
· 23 sep, 2024 Lectura de 4 min

iris-DataViz: Tableau-style drag-and-drop Data Analysis and Visualization Application

image

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

image

To run the application Navigate to http://localhost:8051.
Select Namespace,Schema and table. Click on Data tab to analyze the data.
image

Select the Visualization tab, Drag the desired columns in X-Axis and Y-Axis, and select the desired graph type.
image


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
}
}

Embedded Python Code invoking objectscript code:

  import iris
  ns = iris.cls('dc.DataViz.Util').getNameSpaces()
  namespaces = ns.split(",")

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


For more details, please visit iris-DataViz open exchange application page.

Thanks

3 comentarios
Comentarios (3)1
Inicie sesión o regístrese para continuar
Pregunta
· 23 sep, 2024

Large Stream to base64Encoded

I have below method , which receives a PDF ; this method throws error for a PDF file of 3MB size

 <MAXSTRING>zBase64Encode+9 -- logged as '-' number - @'    set encodedData = $system.Encryption.Base64Encode(content)'

How do I fix this.

----------------

ClassMethod Base64Encode(pStream As %Stream) As %Stream
{
  set tSC = $$$OK
  set tSC = pStream.Rewind()  
  s pEncoded=##class(%Stream.GlobalCharacter).%New()  
  while 'pStream.AtEnd {   
    Set tLen = pStream.Size    
    set content = pStream.Read(.tLen)    
    set encodedData = $system.Encryption.Base64Encode(content)
    set encodedData=$translate(encodedData, $c(13,10))
    s tSC=pEncoded.Write(encodedData)   
    q:$$$ISERR(tSC)
  }
  //q:$$$ISERR(tSC)  
  do pEncoded.Rewind()  
  Quit pEncoded
}

2 comentarios
Comentarios (2)1
Inicie sesión o regístrese para continuar
Anuncio
· 23 sep, 2024

Time to vote in the InterSystems Developer Tools Contest

Hi Community,

It's voting time! Cast your votes for the best applications in our Developer Tools Contest:

🔥 VOTE FOR THE BEST APPS 🔥

How to vote? Details below.

Experts nomination:

InterSystems experienced jury will choose the best apps to nominate the prizes in the Experts Nomination.

Community nomination:

For each user, a higher score is selected from two categories below:

Conditions

Place
1st 2nd 3rd
If you have an article posted on DC and an app uploaded to Open Exchange (OEX) 9 6 3
If you have at least 1 article posted on DC or 1 app uploaded to OEX 6 4 2
If you make any valid contribution to DC (posted a comment/question, etc.) 3 2 1

 

Level

Place
1st 2nd 3rd
VIP Global Masters level or ISC Product Managers 15 10 5
Ambassador GM level 12 8 4
Expert GM level or DC Moderators 9 6 3
Specialist GM level 6 4 2
Advocate GM level or ISC Employees 3 2 1

Blind vote!

The number of votes for each app will be hidden from everyone. Once a day we will publish the leaderboard in the comments to this post. 

The order of projects on the contest page will be as follows: the earlier an application was submitted to the competition, the higher it will be on the list.

P.S. Don't forget to subscribe to this post (click on the bell icon) to be notified of new comments.

To take part in the voting, you need:

  1. Sign in to Open Exchange – DC credentials will work.
  2. Make any valid contribution to the Developer Community – answer or ask questions, write an article, contribute applications on Open Exchange – and you'll be able to vote. Check this post on the options to make helpful contributions to the Developer Community.

If you change your mind, cancel the choice and give your vote to another application!

Support the application you like!


Note: contest participants are allowed to fix the bugs and make improvements to their applications during the voting week, so don't miss and subscribe to application releases!

5 comentarios
Comentarios (5)5
Inicie sesión o regístrese para continuar
Resumen
· 23 sep, 2024

Publicações Desenvolvedores InterSystems, Setembro 16 - 22, 2024, Resumo

Resumen
· 23 sep, 2024

InterSystems Developers Publications, Week September 16 - 22, 2024, Digest

Articles
Announcements
Questions
#InterSystems IRIS
#Ensemble
#InterSystems IRIS for Health
#Caché
#Other
September 16 - 22, 2024Week at a GlanceInterSystems Developer Community