Skip to content

Smarsh/prorep-dbt-repo

Repository files navigation

User Communication Network - Looker Custom Visualization

An interactive network graph visualization for Looker that displays user-to-user communication patterns with message counts, tooltips, and drill-down capabilities.

Features

  • Interactive Network Graph: Visualizes user communication as a force-directed graph
  • Message Count Display: Shows the number of messages between users on edges
  • Tooltips: Hover over nodes and edges to see detailed information
  • Drill-downs: Click on edges to access Looker's drill-down menu
  • Highlighting: Click on nodes to highlight their connections
  • Zoom & Pan: Interactive controls for navigating large networks
  • Customizable: Multiple configuration options for styling and behavior

Data Requirements

The visualization expects data with the following structure:

Field Type Field Name Examples Description
Dimension source_user, from_user, sender The user sending messages
Dimension target_user, to_user, recipient The user receiving messages
Measure message_count, count, total_messages Number of messages exchanged

Example LookML

view: user_messages {
  dimension: source_user {
    type: string
    sql: ${TABLE}.from_user_id ;;
  }
  
  dimension: target_user {
    type: string
    sql: ${TABLE}.to_user_id ;;
  }
  
  measure: message_count {
    type: count
    drill_fields: [source_user, target_user, message_count]
  }
}

Example SQL Query

SELECT 
  from_user as source_user,
  to_user as target_user,
  COUNT(*) as message_count
FROM messages
GROUP BY from_user, to_user

Installation

Method 1: Direct Upload to Looker

  1. Navigate to Admin > Platform > Visualizations in Looker
  2. Click Add Visualization
  3. Upload the manifest.lkml file
  4. Upload the user_communication_network.js file
  5. Save and enable the visualization

Method 2: Using LookML Project

  1. Create a new folder in your LookML project (e.g., visualizations/)
  2. Copy manifest.lkml and user_communication_network.js to this folder
  3. Commit and deploy your changes
  4. The visualization will be available in your Looker instance

Configuration Options

Node Options

  • Node Color: Color of the user nodes (default: #4285F4)
  • Node Size: Size of the user nodes in pixels (default: 20, range: 10-50)
  • Show Node Labels: Display user names below nodes (default: true)

Edge Options

  • Edge Color: Color of the connection lines (default: #999999)
  • Edge Width: Width of the connection lines (default: 2, range: 1-10)
  • Show Message Counts: Display message counts on edges (default: true)
  • Scale Edge Width by Message Count: Make edges thicker for higher message counts (default: true)

Layout Options

  • Force Strength: Controls how strongly nodes repel each other (default: -300, range: -1000 to -50)
  • Link Distance: Preferred distance between connected nodes (default: 150, range: 50-500)

Tooltip Options

  • Show Tooltips: Enable/disable hover tooltips (default: true)

Usage

Basic Usage

  1. Create or open a Look/Explore with user communication data
  2. Select the User Communication Network visualization
  3. The graph will automatically render with your data

Interactions

  • Hover over nodes: View total messages sent/received and connection count
  • Hover over edges: View source, target, and message count
  • Click on nodes: Highlight that user's connections
  • Click on edges: Open drill-down menu (if configured in LookML)
  • Drag nodes: Reposition nodes manually
  • Scroll: Zoom in/out
  • Drag background: Pan the view
  • Use zoom controls: +/- buttons for zoom, reset button to center

Example Use Cases

  1. Internal Communication Analysis: Visualize email or chat patterns within an organization
  2. Customer Support Networks: Show which support agents handle which customers
  3. Social Network Analysis: Display user interactions in a social platform
  4. Transaction Flow: Visualize money or data transfers between users
  5. Collaboration Patterns: Show who works with whom based on shared projects

Customization Examples

High-Contrast Theme

Node Color: #FF6B6B
Edge Color: #4ECDC4
Node Size: 25
Edge Width: 3

Minimal Layout

Show Node Labels: false
Show Message Counts: false
Node Size: 15
Edge Width: 1
Force Strength: -500

Dense Network

Link Distance: 80
Force Strength: -200
Node Size: 12
Scale Edge Width by Message Count: true

Troubleshooting

No data displayed

  • Ensure your query has at least two dimensions (source and target users) and one measure (message count)
  • Check that field names contain keywords like "source", "target", "from", "to", "count", or "message"

Graph is too crowded

  • Increase Link Distance (150-300)
  • Increase Force Strength magnitude (-500 to -800)
  • Reduce Node Size (10-15)
  • Disable Show Node Labels

Edges are hard to see

  • Enable Scale Edge Width by Message Count
  • Increase Edge Width (3-5)
  • Change Edge Color to a darker color

Performance issues with large datasets

  • Limit your query results (e.g., top 100 connections)
  • Use filters to focus on specific users or time periods
  • Consider aggregating data at a higher level

Technical Details

Dependencies

  • D3.js v7: Force-directed graph layout and visualization
  • Looker Visualization API: Integration with Looker platform

Browser Compatibility

  • Chrome 90+
  • Firefox 88+
  • Safari 14+
  • Edge 90+

Performance

  • Optimized for networks up to 500 nodes and 2000 edges
  • Uses D3's force simulation for efficient layout calculation
  • Implements canvas rendering for large datasets (future enhancement)

Development

Local Development Setup

# Install dependencies
npm install

# Build for production
npm run build

# Watch for changes (development)
npm run dev

File Structure

looker-user-communication-network/
├── manifest.lkml                    # Looker visualization manifest
├── user_communication_network.js    # Main visualization code
├── package.json                     # NPM configuration
├── README.md                        # This file
└── examples/
    ├── sample_data.json            # Sample data for testing
    └── sample_lookml.lkml          # Example LookML configuration

Future Enhancements

  • Directional arrows for bidirectional communication
  • Time-based animation showing communication evolution
  • Community detection and clustering
  • Export graph as image (PNG/SVG)
  • Custom node icons/images
  • Multiple edge types (different communication channels)
  • Filtering and search functionality
  • Canvas rendering for very large networks

Support

For issues, questions, or feature requests, please refer to your Looker administrator or the visualization documentation.

License

MIT License - Feel free to modify and distribute as needed.

Version History

v1.0.0 (Current)

  • Initial release
  • Force-directed network graph
  • Interactive tooltips and drill-downs
  • Zoom and pan controls
  • Customizable styling options
  • Node highlighting on click

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors