Skip to content
Increment 0.1.0a6 prerelease documentation. These docs describe the increment 0.1.0a6 prerelease (v0.1.0a6). Its API may change. Install: pip install 'increment==0.1.0a6' Keep any extras requested by the guide, such as increment[dashboard]==0.1.0a6.

Assignment and study contracts

Assignment

No docstring.

ParallelAssignment

No docstring.

IndependentBernoulliOrder

One independent Bernoulli CT/TC order draw per unit-cycle.

Every unit draws its own order independently of every other unit, which is what makes the unit the independent replicate: cross-unit replication exists for a unit-level reference distribution.

SharedScheduleOrder

One independent Bernoulli CT/TC order draw per two-period block, shared by every unit in a fixed, complete unit roster.

Unlike :class:IndependentBernoulliOrder, no unit draws its own order: the whole roster follows one realized order per block, so the independent replicate is the block, not the unit. A common roster duplicated uniformly adds no independent blocks and therefore cannot change the mean-unit retained-window effect scale or inferential sample size. The switchback panel path reduces the roster within each block and uses switchback_block_t with a block_t reference. At least two independent blocks are required; a one-unit roster is supported.

SwitchbackWindow

A washout/observation window with a declared residual-carryover order.

carryover_order names additional observation steps, immediately after the declared washout, still assumed contaminated by the prior period and therefore discarded before the retained window used for inference. Retained steps satisfy step >= washout_steps + carryover_order; the retained window’s length is observation_steps - carryover_order. carryover_order=0 is the plain no-residual-carryover-after-washout case. Declaring an order is an assumption, not something a balance diagnostic can prove true.

SwitchbackAssignment

No docstring.

ParallelStudyEnvelope

No docstring.

SwitchbackStudyEnvelope

No docstring.

StudyEnvelope

No docstring.

The artifact API controls how immutable unit-day data is published and adopted. The store authorizes namespaces; callers provide trusted context and pinned generation references. Artifact contract modules provide the context, catalog, and digest helpers.

ModelPurpose
UnitDayArtifactRefPins an immutable artifact generation.
ArtifactRelationRefBinds a relation and its digests to that generation.
MeasureManifestRecords measure provenance and freshness.
ArtifactContextBinds canonical context JSON (format 2, hash-only source recipes, no source SQL) to its SHA-256 digest (encoding integrity, not authenticity). Format 1 is retired; republish.
UnitDayArtifactManifestCaptures the complete artifact manifest.
ExtensionRefBaseCarries relation, definition, and source digests.
BreakoutDimensionExtensionDescribes a pre-exposure breakout dimension.
FactorDimensionExtensionDescribes a pre-exposure factor dimension.
ClusterIdentityExtensionIdentifies the clustering relation.
CupedPreperiodExtensionSupplies a pre-period measure.
AssignmentCountsExtensionCaptures assignment population counts.
TriggerPopulationExtensionVersion-3, cutoff-bound trigger membership with trigger-feed completeness evidence.
TriggerMeasureStatsExtensionSingleton metric trigger-relative per-unit/day sufficient statistics bound to trigger membership.
EncouragementUptakeExtensionCaptures encouragement uptake data.
SiteVolumeExtensionRecords site-level measure volume and freshness.
UnitCovariateExtensionCarries one declared numeric per-unit covariate.
UnitCovariateLevelExtensionCarries one declared categorical per-unit covariate, including nulls.
ArtifactExtensionRefTagged union of the eleven concrete extension references.
ArtifactExtensionRequestTagged union of the eleven concrete extension requests.

These models and tagged unions are importable from increment.artifacts. They describe the published format without exposing source-loading machinery.

RelationLocator

A namespace-qualified relation name; never a backend SQL fragment.

RelationRole

No docstring.

BaseRelations

Required base artifact relations bound to one artifact generation.

Construct it with exposure and measure-stat relation references, usually through the artifact publication loader.

Freshness

No docstring.

SimpleMetricMeasure

No docstring.

RatioMetricMeasure

No docstring.

MetricMeasure

No docstring.

These references describe artifact dimensions, assignment, trigger membership and outcomes, uptake, and site-volume extensions.

Requests validate extension definitions before publication.

ExtensionRequestBase

No docstring.

BreakoutDimensionRequest

No docstring.

FactorDimensionRequest

No docstring.

ClusterIdentityRequest

No docstring.

CupedPreperiodRequest

No docstring.

AssignmentCountsRequest

No docstring.

TriggerPopulationRequest

No docstring.

TriggerMeasureStatsRequest

No docstring.

EncouragementUptakeRequest

No docstring.

SiteVolumeRequest

No docstring.

UnitCovariateRequest

No docstring.

UnitCovariateLevelRequest

No docstring.

from_definitions(..., source_snapshot_evidence=...) accepts increment.artifacts.SourceSnapshotEvidence only when the source provides a timezone-aware event-time cutoff and, optionally, certified per-feed completeness times. Without a cutoff, Increment does not invent one: assigned-only operations remain available, but triggered membership, triggered outcomes, and trigger-evidence publication refuse with source.native.trigger_evidence_required. Missing feed certification stays unknown; maximum observed timestamps, publication time, and experiment end do not prove completeness. Triggered artifact outcome requests select one trigger_measure_stats item per (trigger, metric), bound to the version-3 membership digest and the same pinned cutoff.

SourceSnapshotEvidence(observation_cutoff_ts, complete_through_by_feed)

Event-time cutoff and explicitly certified per-feed completeness.

A missing or null feed watermark means completeness is unknown; this value is never inferred from rows observed in the feed.

Publication connects validated context to immutable snapshots in the authorized artifact store.

ArtifactPublication

Isolated create-only generation handle.

ArtifactSnapshot

Immutable, generation-scoped read handle.

ArtifactStore

Namespace-scoped publication/snapshot lifecycle contract.

WarehouseArtifactStore(con, catalog, schema_name, namespace)

An immutable artifact store backed by one SQL connection.

Publication persists generation-owned warehouse relations. A snapshot pins the manifest and relation references, then lazily creates private temporary copies during verification. Verified copies isolate reads from later changes and are dropped when the snapshot closes. A declared schema and the store’s tables are created by its first write, a publication or an abandoned generation; reading a store whose schema does not exist creates nothing. A catalog or schema name longer than the warehouse allows (PostgreSQL 63 bytes, Snowflake 255 characters, BigQuery 1,024 bytes) refuses at construction with store.schema_name_too_long.

artifact_context(experiment, reader)

Return the trusted publication context for a definitions-backed experiment.

publish_unit_day_artifact(experiment, reader, store, extensions, refresh_of)

Publish a definitions-backed experiment as an immutable unit-day artifact.

ArtifactExtensionCatalogEntry

No docstring.

unit_day_artifact_extension_catalog(context)

Validate and expose the immutable extension catalog in a context.

Canonical encodings and SHA-256 helpers keep artifact identities deterministic across publication and requests.

ArtifactDigestError

Public coded refusal raised by canonical digest operations.

DigestType

No docstring.

FieldSpec(name, type_tag, nullable)

No docstring.

RelationDigests(role, schema_sha256, content_sha256, row_count, schema_bytes, rows_bytes, digest_format)

No docstring.

canonical_schema_bytes(schema)

No docstring.

canonical_row_bytes(schema, row)

No docstring.

canonical_rows_bytes(schema, rows, primary_key)

No docstring.

canonical_json_bytes(value)

No docstring.

schema_sha256(role, schema)

No docstring.

content_sha256(role, schema, rows, primary_key)

No docstring.

digest_relation(role, schema, rows, primary_key)

No docstring.

manifest_sha256(manifest)

No docstring.

context_sha256(context)

No docstring.

request_sha256(request)

No docstring.

extension_definition_sha256(kind, canonical_definition_json)

No docstring.

extension_source_provenance_sha256(kind, canonical_source_recipe_json)

No docstring.