CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-panoramix

An interactive data visualization platform built on SQLAlchemy and Druid.io

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

configuration.mddocs/

Configuration and Utilities

Panoramix provides extensive configuration options and utility functions for customizing the application behavior, database connections, authentication, and data processing.

Capabilities

Application Configuration

Core application settings that control Panoramix behavior and performance.

# Panoramix-specific configuration constants
ROW_LIMIT = 5000                    # Default row limit for queries
WEBSERVER_THREADS = 8               # Number of web server threads  
PANORAMIX_WEBSERVER_PORT = 8088     # Default web server port

Flask Configuration

Standard Flask application configuration options.

# Flask core settings
SECRET_KEY = '\2\1thisismyscretkey\1\2\e\y\y\h'  # Application secret key for sessions
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db')  # Default database URI
CSRF_ENABLED = True                        # CSRF protection enabled
DEBUG = True                               # Debug mode enabled

Flask-AppBuilder Configuration

Settings for the Flask-AppBuilder admin interface and authentication system.

# Application branding
APP_NAME = "Panoramix"                     # Application display name
APP_ICON = "/static/chaudron_white.png"    # Application icon path

# Authentication configuration  
AUTH_TYPE = AUTH_DB                        # Database authentication type

# Available authentication types
AUTH_DB = "db"                             # Database authentication
AUTH_OID = "oid"                           # OpenID authentication  
AUTH_LDAP = "ldap"                         # LDAP authentication
AUTH_REMOTE_USER = "remote_user"           # Remote user authentication
AUTH_OAUTH = "oauth"                       # OAuth authentication

# Optional authentication settings
AUTH_ROLE_ADMIN = 'Admin'                  # Admin role name
AUTH_ROLE_PUBLIC = 'Public'                # Public role name  
AUTH_USER_REGISTRATION = True              # Allow user self-registration
AUTH_USER_REGISTRATION_ROLE = "Public"     # Default role for new users
AUTH_LDAP_SERVER = "ldap://ldapserver.new" # LDAP server URL

# Internationalization
BABEL_DEFAULT_LOCALE = 'en'                # Default language locale
BABEL_DEFAULT_FOLDER = 'translations'      # Translation files folder
LANGUAGES = {                              # Supported languages
    'en': {'flag': 'us', 'name': 'English'},
    'fr': {'flag': 'fr', 'name': 'French'},
}

File Upload Configuration

Settings for handling file uploads in the web interface.

# File upload directories
UPLOAD_FOLDER = basedir + '/app/static/uploads/'       # General uploads
IMG_UPLOAD_FOLDER = basedir + '/app/static/uploads/'   # Image uploads
IMG_UPLOAD_URL = '/static/uploads/'                    # Image URL path

Utility Functions

Helper functions for common data processing and parsing operations.

Date and Time Parsing

def parse_human_datetime(s):
    """
    Convert human-readable datetime strings to datetime objects.
    
    Supports natural language date expressions like:
    - "now"
    - "yesterday" 
    - "2 hours ago"
    - "next week"
    - "2023-01-15"
    
    Args:
        s (str): Human-readable datetime string
        
    Returns:
        datetime.datetime: Parsed datetime object
        
    Raises:
        ValueError: If string cannot be parsed
    """

def parse_human_timedelta(s):
    """
    Parse human-readable time delta strings.
    
    Supports expressions like:
    - "1 hour"
    - "30 minutes" 
    - "2 days"
    - "1 week"
    
    Args:
        s (str): Human-readable time delta string
        
    Returns:
        datetime.timedelta: Parsed timedelta object
        
    Raises:
        ValueError: If string cannot be parsed
    """

def dttm_from_timtuple(d):
    """
    Convert time tuple to datetime object.
    
    Args:
        d (time.struct_time): Time tuple from time module
        
    Returns:
        datetime.datetime: Converted datetime object
    """

Usage Examples

Custom Configuration

# Create custom configuration file: config.py
import os

# Override default settings
ROW_LIMIT = 10000                    # Increase row limit
PANORAMIX_WEBSERVER_PORT = 9999      # Use different port
DEBUG = False                        # Disable debug mode

# Custom database connection
SQLALCHEMY_DATABASE_URI = 'postgresql://user:pass@localhost/panoramix'

# Custom authentication
AUTH_TYPE = AUTH_LDAP               # Use LDAP authentication
AUTH_LDAP_SERVER = "ldap://ldapserver.company.com"

# Custom branding
APP_NAME = "Company Analytics"
APP_ICON = "/static/company_logo.png"

Using Utility Functions

from panoramix.utils import parse_human_datetime, parse_human_timedelta

# Parse natural language dates
start_date = parse_human_datetime("7 days ago")
end_date = parse_human_datetime("now")

# Parse time deltas
time_window = parse_human_timedelta("2 hours")

# Use in queries
result = table.query(
    metrics=['count'],
    since=start_date.isoformat(),
    until=end_date.isoformat(),
    granularity='hour'
)

Environment-Specific Configuration

# Development configuration
class DevelopmentConfig:
    DEBUG = True
    SQLALCHEMY_DATABASE_URI = 'sqlite:///dev.db'
    ROW_LIMIT = 1000

# Production configuration  
class ProductionConfig:
    DEBUG = False
    SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL')
    ROW_LIMIT = 50000
    WEBSERVER_THREADS = 16
    
# Load configuration based on environment
import os
config_name = os.environ.get('PANORAMIX_ENV', 'development')

Security Configuration

# Enhanced security settings
SECRET_KEY = os.environ.get('SECRET_KEY') or 'generate-random-key'
CSRF_ENABLED = True
WTF_CSRF_ENABLED = True

# Database security
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL')
SQLALCHEMY_POOL_PRE_PING = True      # Verify connections

# Authentication security
AUTH_USER_REGISTRATION = False        # Disable self-registration
AUTH_USER_REGISTRATION_ROLE = None   # No default role for new users

Command Line Entry Point

# Command line script: panoramix/bin/panoramix
"""
Panoramix command-line entry point.

Usage:
    python panoramix/bin/panoramix

Configuration:
    - Reads PANORAMIX_WEBSERVER_PORT from config
    - Uses Gunicorn in production (DEBUG=False)
    - Uses Flask dev server in development (DEBUG=True)
    - Configures worker processes and threading
"""

Usage:

# Start development server
python panoramix/bin/panoramix

# Production deployment with custom port
PANORAMIX_WEBSERVER_PORT=8080 python panoramix/bin/panoramix

# Using environment variables
export DATABASE_URL="postgresql://user:pass@localhost/panoramix"
export SECRET_KEY="your-secret-key"
python panoramix/bin/panoramix

Configuration Validation

The application includes configuration validation to ensure proper setup:

  • Database connectivity testing
  • Required configuration checks
  • Authentication system validation
  • File system permissions verification

This comprehensive configuration system allows Panoramix to be deployed in various environments with appropriate security, performance, and functionality settings.

Install with Tessl CLI

npx tessl i tessl/pypi-panoramix

docs

configuration.md

data-sources.md

druid-sources.md

index.md

sql-tables.md

visualizations.md

web-interface.md

tile.json