class AnalysisType
An enumeration class that defines standardized types of statistical analyses available in the system.
/tf/active/vicechatdev/vice_ai/models.py
1706 - 1714
simple
Purpose
AnalysisType is an Enum class that provides a controlled vocabulary for categorizing different types of statistical analyses. It ensures type safety and consistency when specifying analysis types throughout the application. The enum includes common statistical methods like descriptive statistics, hypothesis testing, regression, correlation, ANOVA, control charts, and a custom option for user-defined analyses.
Source Code
class AnalysisType(Enum):
"""Type of statistical analysis"""
DESCRIPTIVE = "descriptive"
HYPOTHESIS_TEST = "hypothesis_test"
REGRESSION = "regression"
CORRELATION = "correlation"
ANOVA = "anova"
CONTROL_CHART = "control_chart"
CUSTOM = "custom"
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
Enum | - |
Parameter Details
bases: Inherits from Enum base class, which provides enumeration functionality. No constructor parameters are needed as this is an Enum class with predefined members.
Return Value
Instantiation returns an AnalysisType enum member. Each member has a name (e.g., 'DESCRIPTIVE') and a value (e.g., 'descriptive'). Accessing members returns the enum instance, and accessing .value returns the string representation.
Class Interface
Methods
Not directly called - Enum members are predefined
Purpose: Enum initialization is handled automatically by the Enum metaclass
Returns: AnalysisType enum member
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
DESCRIPTIVE |
AnalysisType | Represents descriptive statistical analysis (mean, median, standard deviation, etc.) | class |
HYPOTHESIS_TEST |
AnalysisType | Represents hypothesis testing analysis (t-tests, z-tests, chi-square tests, etc.) | class |
REGRESSION |
AnalysisType | Represents regression analysis (linear, logistic, polynomial regression, etc.) | class |
CORRELATION |
AnalysisType | Represents correlation analysis (Pearson, Spearman, Kendall correlation, etc.) | class |
ANOVA |
AnalysisType | Represents Analysis of Variance (one-way, two-way ANOVA, etc.) | class |
CONTROL_CHART |
AnalysisType | Represents statistical process control chart analysis (X-bar, R-chart, p-chart, etc.) | class |
CUSTOM |
AnalysisType | Represents custom or user-defined analysis types not covered by standard categories | class |
name |
str | The name of the enum member (e.g., 'DESCRIPTIVE') | instance |
value |
str | The string value associated with the enum member (e.g., 'descriptive') | instance |
Dependencies
enum
Required Imports
from enum import Enum
Usage Example
from enum import Enum
class AnalysisType(Enum):
DESCRIPTIVE = "descriptive"
HYPOTHESIS_TEST = "hypothesis_test"
REGRESSION = "regression"
CORRELATION = "correlation"
ANOVA = "anova"
CONTROL_CHART = "control_chart"
CUSTOM = "custom"
# Access enum members
analysis = AnalysisType.DESCRIPTIVE
print(analysis) # AnalysisType.DESCRIPTIVE
print(analysis.value) # 'descriptive'
print(analysis.name) # 'DESCRIPTIVE'
# Compare enum members
if analysis == AnalysisType.DESCRIPTIVE:
print("Running descriptive analysis")
# Get enum by value
analysis_from_value = AnalysisType("regression")
print(analysis_from_value) # AnalysisType.REGRESSION
# Iterate over all analysis types
for analysis_type in AnalysisType:
print(f"{analysis_type.name}: {analysis_type.value}")
Best Practices
- Use enum members directly (e.g., AnalysisType.DESCRIPTIVE) rather than string values for type safety
- Access the string value using .value property when needed for serialization or storage
- Use enum comparison (==) rather than string comparison for robustness
- Enum members are immutable and singleton - the same member is always returned
- When accepting analysis types as function parameters, use type hints like 'analysis_type: AnalysisType'
- Use AnalysisType(value) to convert string values back to enum members, which will raise ValueError if invalid
- Consider using match/case statements (Python 3.10+) or if/elif chains for handling different analysis types
- The CUSTOM member provides extensibility for user-defined analysis types not covered by standard options
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class AnalysisStatus_v1 71.0% similar
-
class AnalysisStatus 70.9% similar
-
class AnalysisConfiguration 63.4% similar
-
class SectionType 62.8% similar
-
class DataSourceType 59.0% similar