Skip to main content
This example demonstrates how to apply a risk segmentation configuration using the Python SDK after analyses are completed. You will connect to an existing engagement, skip analyses that have not finished running, and create the same named configuration on each completed analysis result. If a configuration with that name already exists, the script deletes it first so reruns replace the previous settings.

Prerequisites

Complete Get started so the Python SDK is installed and configured. You also need:
  • A MindBridge tenant host that you can access, such as {your-tenant}.mindbridge.ai.
  • An engagement ID for an engagement that contains one or more analyses.

Overview

In this guide you will:
  • Authenticate with the MindBridge API and load an engagement by ID.
  • Iterate through every analysis in the engagement and skip runs that are not complete.
  • Create a risk segmentation configuration on each completed analysis result, replacing any existing configuration with the same name.

Configure Your Inputs

Adjust the values in the Configure inputs section at the top of the script below to match your tenant, engagement, and segmentation requirements. Typically, you only need to update that section; the rest of the script follows a standard process.
  • mindbridge_url: The MindBridge host for your tenant.
  • engagement_id: The ID of the engagement whose completed analyses should receive the configuration.
  • risk_segmentation_config: The RiskSegmentationConfigItem to apply. Update name, segments, and columns to match the grouping and metrics you want in MindBridge. The script copies this item and sets analysis_id for each completed analysis.
The listing below is one continuous script you can save and run. Step boundaries are marked with comments inside the code.

Complete example


When the script finishes, each completed analysis in the engagement has a risk segmentation configuration with the name you specified. Analyses without a latest result are left unchanged. To modify this workflow, adjust segments, columns, or the configuration name to match how your team reviews risk in MindBridge.