AutomationContext
provides methods to attach structured annotations to objects, allowing automated analysis and validation workflows to provide meaningful feedback.
Object Annotations
Object annotations enable attaching different types of messages (errors, warnings, informational notes, and successes) to specific objects within an automation run. This helps in tracking issues, communicating insights, and guiding decision-making.Why annotate objects? Annotations allow functions to return structured results, making them actionable in dashboards, reports, and workflows.
Example
Annotation Types
Type | Method | Use Case |
---|---|---|
Error | attach_error_to_objects() | Critical issues requiring immediate action |
Warning | attach_warning_to_objects() | Potential concerns needing attention |
Info | attach_info_to_objects() | General insights and analysis results |
Success | attach_success_to_objects() | Positive outcomes or validation confirmations |
Metadata and Customisation
Annotations can be enriched with additional metadata to improve interpretability and visualization.Using Metadata in Annotations: The metadata parameter allows storing arbitrary key-value pairs alongside annotations, making them more descriptive and informative.
Example
Gradient Visualization
Certain metadata keys affect how results are displayed in the model viewer:gradient: Bool
: Enables gradient-based visualization.gradientValues: List[str]
: Specifies values to apply to objects.
Best Practices
- Use the appropriate annotation type to convey severity accurately.
- Group related annotations into categories for better organization.
- Provide clear, actionable messages to aid decision-making.
- Include relevant object IDs to maintain traceability.
- Leverage metadata for richer annotations and better UI integration.