← Files ClaraARCHIVED FILE

modules/mix-contribution-analysis/vendor/modules/chart_harness/__init__.py

4.59 KB · Oct 2, 2026 · 00:29 UTC

↓ Download file

"""Shared deterministic harness helpers for chart-family Codex plugins."""

from __future__ import annotations

from .artifacts import (
    CSV_EXTENSIONS,
    EXCEL_EXTENSIONS,
    SCHEMA_VERSION,
    analysis_scope_from_recipe,
    artifact_kind,
    build_manifest_artifacts,
    frame_profile,
    json_safe,
    read_json_object,
    read_table,
    relative_path,
    utc_now,
    write_json,
    write_prepared_data_manifest,
)
from .analysis_context import available_analysis_context
from .metric_semantics import (
    MetricSemanticsError,
    normalize_metric_semantics,
    validate_metric_relationships,
    validate_metric_requirements,
)
from .period_derivations import (
    add_comparison_cohort_columns,
    apply_period_derivations,
    apply_recipe_cohorts,
    filter_like_for_like_entities,
    normalize_like_for_like_spec,
    normalize_period_derivation_specs,
    normalize_recipe_cohort_contract,
    preserve_recipe_cohorts,
    recipe_cohort_dimension_names,
    recipe_cohort_period_labels,
    recipe_cohort_source_dimensions,
)
from .period_contract import (
    PERIOD_GRAIN_MONTH,
    PERIOD_GRAIN_QUARTER,
    PERIOD_GRAIN_WEEK,
    PERIOD_GRAIN_YEAR,
    PERIOD_TYPE_CALENDAR,
    PERIOD_TYPE_CUSTOM,
    PERIOD_TYPE_FISCAL,
    PERIOD_TYPE_ROLLING,
    PERIOD_TYPE_TO_DATE,
    calendar_period_label,
    default_scenario_comparison_pair,
    fiscal_start_month_from_options,
    normalize_period_grain,
    normalize_period_type,
    period_contract_options,
    period_label_expression,
    scenario_column_kind,
    scenario_roles_for_values,
)
from .period_label_policy import (
    has_resolved_period_context,
    is_scenario_label,
    looks_like_resolved_period_label,
    period_label_policy_texts,
    scenario_tokens_from_text,
    validate_period_label_policy,
)
from .recipe_filters import (
    apply_legacy_filter_title_metadata,
    apply_recipe_filters,
    extract_recipe_filters,
    legacy_filter_dict_from_recipe,
    normalize_recipe_filters,
    preserve_recipe_filters,
)
from .reporting_titles import (
    ReportingTitleContract,
    apply_three_row_plotly_title,
    clean_reporting_text,
    format_reporting_entity_name,
    plain_plotly_title_text,
    plotly_title_lines,
    reporting_entity_label_from_recipe,
    reporting_filter_label_from_recipe,
    reporting_period_line_from_recipe,
    reporting_subject_label_from_recipe,
    reporting_title_html,
    three_row_title_html,
)

__all__ = [
    "CSV_EXTENSIONS",
    "EXCEL_EXTENSIONS",
    "PERIOD_GRAIN_MONTH",
    "PERIOD_GRAIN_QUARTER",
    "PERIOD_GRAIN_WEEK",
    "PERIOD_GRAIN_YEAR",
    "PERIOD_TYPE_CALENDAR",
    "PERIOD_TYPE_CUSTOM",
    "PERIOD_TYPE_FISCAL",
    "PERIOD_TYPE_ROLLING",
    "PERIOD_TYPE_TO_DATE",
    "ReportingTitleContract",
    "SCHEMA_VERSION",
    "add_comparison_cohort_columns",
    "analysis_scope_from_recipe",
    "apply_legacy_filter_title_metadata",
    "apply_recipe_cohorts",
    "apply_recipe_filters",
    "apply_period_derivations",
    "apply_three_row_plotly_title",
    "artifact_kind",
    "available_analysis_context",
    "build_manifest_artifacts",
    "MetricSemanticsError",
    "calendar_period_label",
    "clean_reporting_text",
    "default_scenario_comparison_pair",
    "extract_recipe_filters",
    "filter_like_for_like_entities",
    "fiscal_start_month_from_options",
    "format_reporting_entity_name",
    "frame_profile",
    "has_resolved_period_context",
    "is_scenario_label",
    "json_safe",
    "legacy_filter_dict_from_recipe",
    "looks_like_resolved_period_label",
    "normalize_like_for_like_spec",
    "normalize_period_grain",
    "normalize_period_derivation_specs",
    "normalize_period_type",
    "normalize_recipe_cohort_contract",
    "normalize_recipe_filters",
    "normalize_metric_semantics",
    "period_contract_options",
    "period_label_policy_texts",
    "period_label_expression",
    "preserve_recipe_cohorts",
    "recipe_cohort_dimension_names",
    "recipe_cohort_period_labels",
    "recipe_cohort_source_dimensions",
    "preserve_recipe_filters",
    "plain_plotly_title_text",
    "plotly_title_lines",
    "read_json_object",
    "read_table",
    "reporting_entity_label_from_recipe",
    "reporting_filter_label_from_recipe",
    "reporting_period_line_from_recipe",
    "reporting_subject_label_from_recipe",
    "reporting_title_html",
    "three_row_title_html",
    "scenario_column_kind",
    "scenario_roles_for_values",
    "scenario_tokens_from_text",
    "relative_path",
    "utc_now",
    "validate_metric_relationships",
    "validate_metric_requirements",
    "validate_period_label_policy",
    "write_json",
    "write_prepared_data_manifest",
]

SHA-256: 64040e09b08b176a94cee3a65971c649479d7bc2d47a7a48c0fed0bf00c65dc5