Skip to main content

A Business Capability Modeler built with Python and ttkbootstrap

Project description

PyBCM - Python Business Capability Modeler

PyBCM is a powerful and user-friendly Business Capability Modeling (BCM) application built with Python. It provides an intuitive graphical interface for creating, visualizing, and managing hierarchical business capability models. This tool is designed to help business architects, analysts, and strategists map and understand their organization's capabilities effectively.

PyBCM Screenshot

Key Features

PyBCM offers a comprehensive set of features to support various aspects of business capability modeling:

Core Capability Management

  • Hierarchical Tree View: Visualize and navigate your capability model in an intuitive tree structure.
  • Drag-and-Drop Reordering: Easily rearrange capabilities within the hierarchy by simply dragging and dropping them.
  • CRUD Operations: Create, read, update, and delete capabilities seamlessly.
  • Rich Text Descriptions: Add detailed descriptions to capabilities using Markdown, with real-time preview and automatic saving.
  • Persistent Storage: Utilizes a robust SQLite database to store your capability model reliably.
  • Search Functionality: Quickly find capabilities by name or description using the built-in search bar.
  • Import/Export: Import and export your entire capability model in JSON format for easy sharing and backup.

Advanced AI Assistance

  • AI-Powered Expansion: Leverage the power of large language models (LLMs) to automatically generate sub-capabilities based on selected capabilities.
  • First-Level Capability Generation: Use AI to create initial high-level capabilities from an organization name and description.
  • Customizable AI Settings: Configure the maximum number of AI-generated capabilities and adjust settings for initial capability creation.
  • AI Chat Interface: Interact with an AI assistant to explore your capability model, search capabilities, and get insights.

Interactive Visualization

  • Dynamic Visualizer: Generate interactive visualizations of your capability model within a dedicated window.
  • Zoom and Pan: Easily navigate the visualization using zoom (Ctrl + Mouse Wheel) and pan (click and drag).
  • Color-Coded Levels: Visually distinguish different levels of the capability hierarchy with customizable color schemes.
  • Tooltips: Hover over capabilities to view their detailed descriptions.
  • Auto-Layout: Intelligent layout algorithms automatically arrange capabilities for optimal clarity and readability.
    • Standard Layout: A balanced layout algorithm suitable for most models.
    • High-Quality (HQ) Layout: An advanced algorithm that optimizes for aspect ratio and space utilization, especially useful for complex models.
  • Customizable Visualization Settings: Adjust layout parameters, colors, font sizes, and more to tailor the visualization to your preferences.

Export Options

  • SVG Export: Generate high-quality vector graphics (SVG) of your capability model for use in documentation, presentations, and web pages.
  • PowerPoint Export: Export your capability model directly to a PowerPoint presentation, preserving layout and styling for seamless integration into your reports.
  • Archimate Open Exchange Format: Export your capability model in Archimate Open Exchange format, making it compatible with popular enterprise architecture tools like Archi.
  • Audit Log Export: Export detailed audit logs of all changes made to your capability model in Excel format.

Audit Logging and Security

  • Detailed Audit Trail: Track all changes to your capability model, including creation, updates, deletions, and moves, with timestamps and details of old and new values.
  • Audit Log Viewer: A dedicated interface to view, search, and filter audit logs.
  • Excel Export: Export audit logs to an Excel file for further analysis and reporting.
  • Secure Database: The application uses SQLite with foreign key constraints enabled by default to ensure data integrity and prevent unauthorized modifications.

Installation

Prerequisites

  • Python 3.11 or higher
  • uv package manager (recommended for faster dependency management)

Steps

  1. Clone the repository:

    git clone https://github.com/yourusername/pybcm.git
    cd pybcm
    
  2. Install dependencies using uv:

    uv pip install -e .
    
  3. Alternative: Run as a uv tool:

    You can install bcm directly as a uv tool:

    uv tool install pybcm
    bcm
    
  4. Configure LLM API Keys:

    PyBCM uses PydanticAI to interact with various LLM providers. You'll need to:

    1. Copy the sample environment file:

      cp .env.sample .env
      
    2. Edit .env and configure your environment:

      Required variables:

      • OPENAI_API_KEY: Your OpenAI API key (required for default setup)

      Optional LLM providers:

      • ANTHROPIC_API_KEY: For Claude models
      • GOOGLE_API_KEY: For Gemini models
      • GROQ_API_KEY: For Groq models
      • MISTRAL_API_KEY: For Mistral models

      Model settings:

      • DEFAULT_MODEL: Model to use (default: gpt-4-turbo-preview)
      • MAX_TOKENS: Maximum response length (default: 2000)
      • TEMPERATURE: Response creativity 0.0-1.0 (default: 0.7)

      See the Logfire documentation for setting environment variables for logging.

    The application validates these settings on startup and will show an error if required variables are missing.

  5. Configure Logfire logging (first time only):

    PyBCM uses Logfire for advanced logging and monitoring. On first run, you'll need to:

    1. Create a Logfire account at logfire.pydantic.dev
    2. Install the Logfire CLI:
      uv pip install logfire
      
    3. Authenticate with Logfire:
      logfire auth
      
    4. Create and select a project:
      logfire projects new pybcm
      logfire projects use pybcm
      

    This only needs to be done once. Credentials are stored in ~/.logfire/default.toml.

Usage

Launching the Application

Run the application from the command line:

bcm

Basic Navigation

  • Tree View: The left panel displays the hierarchical capability tree.
  • Description: The right panel shows the description of the selected capability.
  • Toolbar: Provides quick access to common actions like expand/collapse, AI expansion, visualization, search, and editing.
  • Menu Bar: Offers more advanced options, including import/export, settings, and audit log management.

Managing Capabilities

  1. Adding a Capability:

    • Right-click on the desired parent in the tree view and select "New Child."
    • Enter the capability name and an optional description.
    • Click "OK."
  2. Updating a Capability:

    • Select a capability in the tree view.
    • Click "Edit" in the toolbar to switch to edit mode.
    • Modify the name or description in the right panel.
    • Click "View" to see a markdown preview or "Save" to save changes to the database.
  3. Deleting a Capability:

    • Right-click on the capability in the tree view and select "Delete."
    • Confirm the deletion.
  4. Reordering Capabilities:

    • Drag and drop capabilities within the tree view to change their order or parent.

Using AI Features

  1. AI Capability Expansion:

    • Select a capability in the tree view.
    • Click the "✨" (sparkles) button in the toolbar.
    • Review the AI-generated sub-capabilities.
    • Check the boxes next to the capabilities you want to add.
    • Click "OK."
  2. AI Chat:

    • Click the "🤖" (robot) button in the toolbar.
    • A new browser window will open, allowing you to interact with the AI assistant.
    • Ask questions about your capability model, search for capabilities, and get insights using natural language.

Working with Visualizations

  1. Opening the Visualizer:

    • Click the "🗺️" (map) button in the toolbar or select "Visualize Model" from the "Edit" menu.
    • A new window opens displaying the interactive visualization.
  2. Navigation:

    • Zoom: Use Ctrl + Mouse Wheel to zoom in and out.
    • Pan: Click and drag to move around the canvas.
  3. Tooltips:

    • Hover your mouse over a capability to view its description in a tooltip.
  4. Exporting:

    • SVG: Select "File" > "Export to SVG..." to save the visualization as an SVG file.
    • PowerPoint: Select "File" > "Export to PowerPoint..." to generate a PowerPoint presentation.
    • Archimate: Select "File" > "Export to Archimate..." to create an Archimate Open Exchange file.
  5. Customization:

    • Access visualization settings through "File" > "Settings."
    • Customize colors, layout parameters, font sizes, and more.

Settings

Access the application settings through "File" > "Settings." Here you can customize:

  • Visual Theme: Choose from a variety of ttkbootstrap themes.
  • AI Generation: Configure the maximum number of AI-generated capabilities and the range for first-level capabilities.
  • Model Selection: Select the LLM model to be used for AI features.
  • Layout: Adjust layout algorithm, root font size, box dimensions, gaps, padding, target aspect ratio, and maximum level for visualization.
  • Coloring: Customize the color scheme for different capability levels and leaf nodes in the visualizer.

User Directory and Template Customization

PyBCM creates a .pybcm directory in your home folder to store user-specific data and customizations:

~/.pybcm/
├── settings.json      # User settings
├── templates/         # Customizable templates
│   ├── chat.html            # Chat interface template
│   ├── expansion_prompt.j2  # AI capability expansion prompt
│   ├── first_level_prompt.j2# First-level capabilities prompt
│   └── system_prompt.j2     # AI system prompt

Template Customization

You can customize how PyBCM generates capabilities and displays the chat interface by modifying the templates in ~/.pybcm/templates/:

  1. AI Prompts:

    • expansion_prompt.j2: Customize how the AI generates sub-capabilities
    • first_level_prompt.j2: Modify the prompt for generating first-level capabilities
    • system_prompt.j2: Adjust the AI system prompt for better domain-specific responses
  2. Chat Interface:

    • chat.html: Customize the appearance and behavior of the AI chat interface

The application will:

  1. Create these templates automatically on first run
  2. Use your customized versions if they exist
  3. Fall back to the built-in templates if a customized version doesn't exist

This allows you to:

  • Tailor the AI prompts for your specific industry or use case
  • Customize the chat interface appearance
  • Experiment with different prompt strategies
  • Maintain your customizations across application updates

Development

Technologies Used

  • Frontend:
  • Backend:
    • SQLAlchemy: Database ORM for interacting with SQLite.
    • Pydantic: Data validation and settings management.
    • PydanticAI: AI agent based on Pydantic models.
  • AI:
    • PydanticAI: Agent framework for LLM interactions
    • Supported LLM providers:
      • OpenAI (default)
      • Anthropic
      • Google AI (Gemini)
      • Groq
      • Mistral
      • Ollama
  • Visualization:
    • Custom layout algorithms implemented in layout.py and hq_layout.py.
    • tkinter Canvas for rendering.
  • Export:
    • svgwrite (implicitly used for SVG generation)
    • python-pptx for PowerPoint generation.
    • xml.etree.ElementTree for Archimate XML generation.
  • Other:
    • uv: Fast package manager for installing dependencies.
    • jinja2: Templating engine for generating prompts and reports.
    • markdown: For Markdown rendering in descriptions and AI chat.
    • logfire: For logging and instrumentation.

Contributing

Contributions are welcome! If you want to contribute to PyBCM, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and write unit tests if applicable.
  4. Ensure all tests pass and the code follows the project's style guide (we use black).
  5. Submit a pull request with a clear description of your changes.

License

PyBCM is released under the MIT License.

Acknowledgements

  • Thanks to the developers of all the open-source libraries used in this project.
  • Special thanks to ttkbootstrap for providing a fantastic set of modern Tkinter themes and widgets.

Contact

For any questions or feedback, please open an issue on the GitHub repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pybcm-0.1.6.tar.gz (725.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybcm-0.1.6-py3-none-any.whl (129.8 kB view details)

Uploaded Python 3

File details

Details for the file pybcm-0.1.6.tar.gz.

File metadata

  • Download URL: pybcm-0.1.6.tar.gz
  • Upload date:
  • Size: 725.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.5.15

File hashes

Hashes for pybcm-0.1.6.tar.gz
Algorithm Hash digest
SHA256 f4af9706c0bb96b0f8daeb02df209fe31238c295546caa056d69f0055ddedd07
MD5 d8dd5c18f793c9bef42c5738ec808c4d
BLAKE2b-256 497013aaf380c6c224502f3732231caea96a3c396c6a04dce6248c0f9776e324

See more details on using hashes here.

File details

Details for the file pybcm-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: pybcm-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 129.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.5.15

File hashes

Hashes for pybcm-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 32615935db7be280eb3f44af7ed78bb69e617b67014266f724b4d9562510be91
MD5 d202377331728487e4b6e6a805bf378a
BLAKE2b-256 7517cb1f71de6a25df9774cb1c75a97c78e3db97b21ff6f568c10b6f48a1bb66

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page