Cortex

A lightweight, modular analytics engine built in Python to power customer-facing analytics applications. Provides a unified semantic layer for defining business data models, a dynamic query engine that integrates with heterogeneous data sources, and a robust user management system—all accessible via a FastAPI-powered REST API.

pip install "telescope-cortex[api]"

Core Capabilities

    Semantic Layer
    Define and manage data models in JSON with measures, dimensions, filters, and ordering. Dynamic schema generation with plugin support and advanced output formatting for both query-time and post-execution transformations.
    Query Engine
    Translates semantic definitions into optimized queries across multiple data sources. Supports PostgreSQL, BigQuery, and more with real-time output formatting during query execution.
    Multi-Tenant Architecture
    Hierarchical organization with workspaces, environments, and consumer groups. Supports multiple organizations with proper data isolation and environment-level configurations.
    Data Source Integration
    Extensible database connector system supporting PostgreSQL, BigQuery, and more. Factory pattern enables easy addition of new data sources without code changes.
    REST API First
    All functionality exposed via FastAPI-based REST endpoints with clear separation of admin and end-user API flows. Auto-generated OpenAPI documentation with Scalar FastAPI.
    Dashboard Engine
    Vue.js frontend for creating and managing dashboards with multiple chart types. ECharts integration with advanced features like data zoom, tooltips, and real-time preview.
    Type Safety & Validation
    Comprehensive Pydantic validation throughout the system ensuring runtime type safety, automatic API documentation, and robust error handling.
    AI Agent Ready
    Designed with AI agent integration in mind. Natural language interface capabilities, intelligent query optimization, and automated insights generation through structured semantic models.

Use Cases

    Customer-Facing Analytics
    Build white-labeled analytics dashboards for your customers. Provide business users with self-service analytics without exposing underlying database complexity.
    Enterprise Data Democratization
    Enable business users to access and analyze data through semantic models. Reduce dependency on data teams while maintaining data governance and security.
    Data Integration Platform
    Unify data from multiple sources into a single semantic layer. Provide consistent business definitions and metrics across different systems and teams.
    AI-Powered Analytics
    Foundation for natural language querying and AI-driven insights. Structured semantic models enable AI agents to understand business context and generate intelligent analytics.
    Multi-Tenant SaaS Analytics
    Perfect for building analytics platforms serving multiple customers. Hierarchical organization ensures proper data isolation and tenant-specific configurations.
    Rapid Dashboard Development
    Visual dashboard builder with drag-and-drop interface. Enable business users to create and share insights without technical implementation.

Architecture Overview

Cortex follows a layered architecture ensuring modularity, maintainability, and independent evolution of core components.
    Layered Architecture
    Clear separation of concerns with distinct layers for API, business logic, data access, and storage. Enables independent scaling, testing, and maintenance of each component.
    Factory Pattern
    Extensible database connector system using factory pattern. Supports multiple database types with unified interface, making it easy to add new connectors without modifying existing code.
    Multi-Tenant Hierarchy
    Hierarchical organization structure supporting organizations, workspaces, environments, and consumer groups. Provides natural data isolation and access control boundaries.
    Type Safety
    Comprehensive Pydantic validation ensuring runtime type safety, automatic API documentation generation, and robust error handling throughout the system.

Technology Stack

Built with modern Python technologies and best practices for scalable, maintainable analytics platforms.
    Modern Python Stack
    Built with Python 3.12+ featuring async/await, type hints, and modern language features. Uses Poetry for dependency management and follows Python packaging best practices.
    Database Flexibility
    Supports multiple database types through extensible connector system. Currently includes PostgreSQL, BigQuery with easy addition of new databases.
    API-First Design
    REST API first approach with FastAPI providing automatic OpenAPI documentation, request/response validation, and dependency injection capabilities.
    Rich Visualization
    Modern Vue.js frontend with ECharts integration for advanced charting capabilities including stacked charts, data zoom, tooltips, and real-time data updates.