Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

4.6 KB
Raw Blame
"""
Facade for data_quality.

The only module this product's presentation layer (and external code) may import. It carries
capability functions and frozen contracts, and nothing else: the check registry, the type specs and
the AST-bearing ``CheckPlan`` stay inside ``logic``, since they are compiler internals rather than
data. ORM model classes never cross here either -- ``facade/models.py`` is their one channel.
"""

from ..activity_logging import log_schedule_change
from ..logic.checks import (
    checks_for_subject,
    edit_check,
    empty_check_suite,
    ensure_name_available,
    live_subject_checks,
    soft_delete_check,
    start_check_suite,
    subject_filter,
    subject_health,
    upsert_check,
    validate_check,
)
from ..logic.compiler import compile_check, related_subject_ref
from ..logic.config import get_gate_config, set_gate_materialization_on_checks
from ..logic.contracts import CompiledCheck, SubjectIdentity, SubjectRef
from ..logic.errors import CheckConfigError, CheckEditConflict, SubjectUnresolvableError
from ..logic.health import CheckStatusRow, roll_up_health
from ..logic.materialization import materialization_failure_summary
from ..logic.navigation import SubjectKey, SubjectLocation, subject_locations
from ..logic.notifications import notify_materialization_blocked
from ..logic.output_schema import metric_output_schema
from ..logic.permissions import authorized_subject_types, restrict_subject_types, sql_denial_context, writable_subjects
from ..logic.registry import UnknownCheckTypeError, list_check_types
from ..logic.run_records import record_check_run
from ..logic.schedule_service import (
    SubjectSchedule,
    get_schedule_with_history,
    list_schedules_with_history,
    schedule_with_history,
    update_schedule,
)
from ..logic.schedules import CheckSchedule, ScheduleUnavailableError, ScheduleUpdateResult, get_schedule, set_schedule
from ..logic.serialization import compute_fingerprint, from_config_entry, to_config_entry
from ..logic.subject_access import (
    DenialContext,
    ReadableSubjects,
    ReferencedSubjects,
    caller_denial_context,
    can_be_object_denied,
    definition_reads_unreadable_subject,
    denial_context,
    memoized_definition_verdict,
    readable_check_subjects,
    suites_backing_unreadable_runs_q,
    unreadable_suites_q,
    visible_check_queryset,
    visible_checks,
    without_denied_runs,
)
from ..logic.subject_schedules import runs_on_a_schedule
from ..logic.subjects import resolve_metric_subjects, resolve_subject, selectable_subjects, testable_metric_subjects
from ..logic.triggers import materialization_audit_mode as quality_audit_mode
from .contracts import CheckTypeInfo, MetricSubject, OutputColumn, SelectableSubject

__all__ = [
    "log_schedule_change",
    "CheckSchedule",
    "ScheduleUnavailableError",
    "ScheduleUpdateResult",
    "SubjectSchedule",
    "CheckConfigError",
    "CheckEditConflict",
    "CheckStatusRow",
    "CheckTypeInfo",
    "CompiledCheck",
    "DenialContext",
    "MetricSubject",
    "OutputColumn",
    "SelectableSubject",
    "ReadableSubjects",
    "ReferencedSubjects",
    "SubjectKey",
    "SubjectIdentity",
    "SubjectLocation",
    "SubjectRef",
    "SubjectUnresolvableError",
    "UnknownCheckTypeError",
    "authorized_subject_types",
    "restrict_subject_types",
    "sql_denial_context",
    "live_subject_checks",
    "materialization_failure_summary",
    "caller_denial_context",
    "can_be_object_denied",
    "checks_for_subject",
    "compile_check",
    "compute_fingerprint",
    "definition_reads_unreadable_subject",
    "memoized_definition_verdict",
    "denial_context",
    "readable_check_subjects",
    "edit_check",
    "empty_check_suite",
    "ensure_name_available",
    "from_config_entry",
    "get_gate_config",
    "get_schedule",
    "get_schedule_with_history",
    "list_schedules_with_history",
    "list_check_types",
    "metric_output_schema",
    "notify_materialization_blocked",
    "quality_audit_mode",
    "record_check_run",
    "related_subject_ref",
    "resolve_subject",
    "resolve_metric_subjects",
    "roll_up_health",
    "set_gate_materialization_on_checks",
    "runs_on_a_schedule",
    "set_schedule",
    "schedule_with_history",
    "soft_delete_check",
    "start_check_suite",
    "subject_filter",
    "subject_health",
    "subject_locations",
    "selectable_subjects",
    "testable_metric_subjects",
    "suites_backing_unreadable_runs_q",
    "to_config_entry",
    "unreadable_suites_q",
    "update_schedule",
    "upsert_check",
    "validate_check",
    "visible_checks",
    "visible_check_queryset",
    "without_denied_runs",
    "writable_subjects",
]