{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://teal-insights.github.io/excel-grapher/series_binding.schema.json",
"title": "Workbook series bindings",
"description": "Declarative structure and spreadsheet bindings for workbook series. Shared series structure describes dimensions and data_range; optional input, output, internal, and constant blocks declare inverted-tree I/O, triangulation targets, or constants.",
"type": "object",
"additionalProperties": false,
"required": [
"schema_version",
"series"
],
"properties": {
"schema_version": {
"type": "string",
"enum": [
"1.0.0",
"1.1.0",
"1.2.0",
"1.3.0",
"1.4.0",
"1.5.0",
"1.6.0",
"1.7.0",
"1.8.0",
"1.9.0",
"1.10.0",
"1.11.0",
"1.12.0",
"1.13.0",
"1.14.0",
"1.15.0",
"1.16.0",
"1.17.0",
"1.18.0",
"1.19.0",
"1.20.0",
"1.21.0",
"1.22.0"
],
"description": "Schema version for tooling and migrations. 1.0.0\u20131.2.0: row_series and scalar (fully supported). 1.1.0: adds matrix layout (supported with explicit binds). 1.2.0: optional input/output direction blocks and output compute functions. 1.3.0: row_series renamed to series layout; load-time normalization accepts legacy row_series. 1.4.0: adds bool and datetime read modes and dtypes for dimensions and constants (ISO 8601 date strings in manifests). 1.5.0: grouped-row matrix geometry (skip/include/fill/missing on row_label and column_header binds, value_map bind kind, series-level exclude_rows) and optional view-level groups for export sequencing and documentation grouping. 1.6.0: input.mode override for user-editable formula cells (non-leaf input setters). 1.7.0: internal direction for non-I/O formula-cell key triangulation (intersect_graph_formulas validation). 1.8.0: optional dimension/attribute id separating dimension identity from concept, so multiple dimensions can share one concept; record fields and key entries use the effective id (id when declared, else concept) while concept keeps dtype inheritance from concept_scheme. Also adds optional per-dimension dtype overriding the concept-scheme dtype for same-concept dimensions with differing storage types. 1.9.0 (historical): optional input.reader name override for generated read_* duals of set_* setters; extra input.reader keys are now rejected. 1.10.0: optional output.compute.helper so compute_* evaluates collapsed / parameterized helpers from record dims instead of xl_cell(address) when a helper covers the published leaves. 1.11.0: constant direction for non-I/O graph-leaf bindings. Historical codegen emitted read_* without set_* or compute_*; inverted-tree imports constants from data. 1.12.0: series-level exclude_columns (ColumnSpec) symmetric with exclude_rows for carving non-data columns out of an expanded data_range. 1.13.0: optional input.domain so inverted-tree compute_* / Model arguments reject out-of-domain measure values (enum literals, integer between, real_between). 1.14.0: complementary shards with the same series id may declare different sheet/data_range (merged data_range is a list); bind.kind sheet_name reads the worksheet name of each data cell, with an optional values map from worksheet name to dimension code. 1.15.0: optional input.value_map on scalar input series maps public compute_* values to workbook cell needles (MATCH/IF labels); domain checks use the map keys. 1.16.0: input direction no longer requires a setter block; empty `input: {}` marks a series as an editable leaf. Extra setter/reader keys are rejected. Package export takes inputs as `compute_*` / `Model` arguments. 1.17.0: series-level axis_labels identifies a series whose values provide runtime labels for its sole key axis. 1.18.0: series-level relations compile greater_than / not_equal partner series ids to GreaterThanCell / NotEqualCell, aligned on the shared key. 1.19.0: series-level domain (enum / between / real_between / from_workbook); input.domain is accepted and normalized to the series-level key. constant implies from_workbook. Compiles to the CellTypeEnv dynamic-ref inference consumes. 1.20.0: bind.kind row_index and column_letter key each observation by the data cell's own 1-based row index or column letter (Sheet!D18 yields 18 and D) without a values map. 1.21.0: validation.catalog false marks an extract-only series: it still compiles into CellTypeEnv / DynamicRefConfig.from_bindings, but inverted-tree omits it from the catalog and data.py tensors. Fail closed if that series uniquely owns an on-graph formula cell. 1.22.0: domain may union enum with exactly one of between or real_between, so a text sentinel (or other literal) and a numeric interval are alternatives. A value matches when it is an enum member or lies in the interval. Measure dtype follows the interval arm. The two interval kinds cannot be combined."
},
"workbook": {
"type": "string",
"description": "Optional workbook filename or path used when validating bindings against a graph extract."
},
"concept_scheme": {
"$ref": "#/$defs/ConceptScheme",
"description": "Optional shared concept definitions referenced by series bindings in this file."
},
"series": {
"type": "array",
"minItems": 0,
"items": {
"$ref": "#/$defs/SeriesBinding"
},
"description": "One binding per series (input, output, internal, or constant). Empty lists are allowed for draft/placeholder shards."
}
},
"$defs": {
"A1Range": {
"type": "string",
"pattern": "!",
"description": "Sheet-qualified range using project target conventions: Inputs!F5:J5, Inputs!F5:Inputs!J5, 'My Sheet'!A1:'My Sheet'!B2. Parsed via expand_targets_to_roots (not a single regex)."
},
"DefinedName": {
"type": "string",
"pattern": "^[A-Za-z_][A-Za-z0-9_.]*$",
"description": "Workbook defined name resolving to a single cell or rectangular range (requires workbook or graph named-range maps at expand time)."
},
"DataRange": {
"description": "Leaf cells for this binding: sheet-qualified range and/or defined name.",
"oneOf": [
{
"$ref": "#/$defs/A1Range"
},
{
"$ref": "#/$defs/DefinedName"
}
]
},
"DataRangeList": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/DataRange"
},
"description": "One or more DataRange entries concatenated at resolve time (complementary shards)."
},
"SheetName": {
"type": "string",
"minLength": 1,
"description": "Worksheet name (must match a data_range sheet)."
},
"SheetNameList": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/SheetName"
},
"description": "Worksheet names covered by a multi-range complementary series."
},
"A1Cell": {
"type": "string",
"pattern": "^[^!]+![A-Z]{1,3}[1-9][0-9]*$",
"description": "Sheet-qualified A1 cell, e.g. Inputs!A2."
},
"ColumnLetter": {
"type": "string",
"pattern": "^[A-Z]{1,3}$",
"description": "Excel column letters without row, e.g. A or AA."
},
"ConceptId": {
"type": "string",
"minLength": 1,
"pattern": "^[A-Za-z][A-Za-z0-9_]*$",
"description": "Stable concept identifier (SDMX-style ids such as REF_AREA or local ids such as DESCRIPTION)."
},
"DimensionId": {
"type": "string",
"minLength": 1,
"pattern": "^[A-Za-z][A-Za-z0-9_]*$",
"description": "Dimension (or attribute) identifier distinguishing the dimension from the concept it references (SDMX concept identity). Defaults to the concept id when omitted; effective ids must be unique within a series' structure. Record fields and key entries use the effective id; concept_scheme dtype inheritance keys on concept."
},
"ScalarValue": {
"description": "Constant attribute or context value stored in records when include_in_record is true. Datetime constants use ISO 8601 strings (e.g. 2024-01-15 or 2024-01-15T00:00:00); tooling coerces them when read or dtype is datetime.",
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "null"
}
]
},
"RowSpec": {
"description": "One 1-based row index, or an inclusive row range string like 3:8.",
"oneOf": [
{
"type": "integer",
"minimum": 1
},
{
"type": "string",
"pattern": "^[1-9][0-9]*(:[1-9][0-9]*)?$"
}
]
},
"ColumnSpec": {
"type": "string",
"pattern": "^[A-Z]{1,3}(:[A-Z]{1,3})?$",
"description": "One column letter, or an inclusive column range string like C:D."
},
"MissingPolicy": {
"description": "What to do when no source label exists for a data cell: error (default) fails resolution; null keys the cell on None. YAML null is accepted as a spelling of \"null\".",
"enum": [
"error",
"null",
null
],
"default": "error"
},
"ReadAs": {
"type": "string",
"enum": [
"string",
"int",
"float",
"number",
"bool",
"datetime",
"auto"
],
"default": "auto",
"description": "How to coerce a cell or header value into a record field."
},
"Normalize": {
"type": "string",
"enum": [
"none",
"strip",
"strip_trailing_unit"
],
"default": "strip",
"description": "Label normalization applied after reading strings from the sheet."
},
"ConceptScheme": {
"type": "object",
"additionalProperties": false,
"required": [
"concepts"
],
"properties": {
"id": {
"type": "string"
},
"concepts": {
"type": "array",
"minItems": 0,
"items": {
"$ref": "#/$defs/ConceptDefinition"
}
}
}
},
"ConceptDefinition": {
"type": "object",
"additionalProperties": false,
"required": [
"id"
],
"properties": {
"id": {
"$ref": "#/$defs/ConceptId"
},
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"dtype": {
"type": "string",
"enum": [
"string",
"int",
"float",
"number",
"bool",
"datetime"
]
},
"sdmx_concept": {
"type": "string",
"description": "Optional mapping to an external SDMX concept id for documentation."
}
}
},
"Bind": {
"description": "How to obtain a concept value from the workbook for each leaf cell in data_range.",
"oneOf": [
{
"$ref": "#/$defs/BindDataCell"
},
{
"$ref": "#/$defs/BindCell"
},
{
"$ref": "#/$defs/BindColumnHeader"
},
{
"$ref": "#/$defs/BindRowLabel"
},
{
"$ref": "#/$defs/BindValueMap"
},
{
"$ref": "#/$defs/BindConstant"
},
{
"$ref": "#/$defs/BindSheetName"
},
{
"$ref": "#/$defs/BindRowIndex"
},
{
"$ref": "#/$defs/BindColumnLetter"
}
]
},
"BindDataCell": {
"type": "object",
"additionalProperties": false,
"required": [
"kind"
],
"properties": {
"kind": {
"const": "data_cell"
},
"read": {
"$ref": "#/$defs/ReadAs"
}
}
},
"BindCell": {
"type": "object",
"additionalProperties": false,
"required": [
"kind",
"address"
],
"properties": {
"kind": {
"const": "cell"
},
"address": {
"$ref": "#/$defs/A1Cell"
},
"read": {
"$ref": "#/$defs/ReadAs"
},
"normalize": {
"$ref": "#/$defs/Normalize"
}
}
},
"BindColumnHeader": {
"type": "object",
"additionalProperties": false,
"required": [
"kind",
"header_row"
],
"not": {
"required": [
"skip",
"include"
]
},
"properties": {
"kind": {
"const": "column_header"
},
"header_row": {
"type": "integer",
"minimum": 1,
"description": "1-based row index containing column headers for the data columns."
},
"skip": {
"type": "array",
"items": {
"$ref": "#/$defs/ColumnSpec"
},
"description": "Columns in header_row that are not label sources for this dimension. Mutually exclusive with include."
},
"include": {
"type": "array",
"items": {
"$ref": "#/$defs/ColumnSpec"
},
"description": "The only columns in header_row that are label sources for this dimension. Mutually exclusive with skip."
},
"fill": {
"type": "boolean",
"default": false,
"description": "When true, a data column whose header source is skipped or empty inherits the nearest non-skipped, non-empty header to its left."
},
"missing": {
"$ref": "#/$defs/MissingPolicy"
},
"read": {
"$ref": "#/$defs/ReadAs"
},
"normalize": {
"$ref": "#/$defs/Normalize"
}
}
},
"BindRowLabel": {
"type": "object",
"additionalProperties": false,
"required": [
"kind",
"label_column"
],
"not": {
"required": [
"skip",
"include"
]
},
"description": "Read the label on the same row as the data cell from label_column (typical for indicator text in column A).",
"properties": {
"kind": {
"const": "row_label"
},
"label_column": {
"$ref": "#/$defs/ColumnLetter"
},
"skip": {
"type": "array",
"items": {
"$ref": "#/$defs/RowSpec"
},
"description": "Rows in label_column that are not label sources for this dimension (e.g. group header rows for a sub-label key). Mutually exclusive with include."
},
"include": {
"type": "array",
"items": {
"$ref": "#/$defs/RowSpec"
},
"description": "The only rows in label_column that are label sources for this dimension (e.g. group header rows for a band key). Mutually exclusive with skip."
},
"fill": {
"type": "boolean",
"default": false,
"description": "When true, a data row whose label source is skipped or empty inherits the nearest non-skipped, non-empty label above it."
},
"missing": {
"$ref": "#/$defs/MissingPolicy"
},
"read": {
"$ref": "#/$defs/ReadAs"
},
"normalize": {
"$ref": "#/$defs/Normalize"
}
}
},
"BindValueMap": {
"type": "object",
"additionalProperties": false,
"required": [
"kind",
"values"
],
"description": "Key data rows or columns by manifest values when labels are absent from the sheet. Axis is inferred from spec syntax: row specs (3, 3:4) key data rows; column specs (C, C:D) key data columns. Map keys within one bind must share one scalar type.",
"properties": {
"kind": {
"const": "value_map"
},
"values": {
"type": "object",
"minProperties": 1,
"additionalProperties": {
"oneOf": [
{
"$ref": "#/$defs/RowSpec"
},
{
"$ref": "#/$defs/ColumnSpec"
},
{
"type": "array",
"minItems": 1,
"items": {
"oneOf": [
{
"$ref": "#/$defs/RowSpec"
},
{
"$ref": "#/$defs/ColumnSpec"
}
]
}
}
]
},
"description": "Mapping from dimension value to the row or column specs it covers."
},
"missing": {
"$ref": "#/$defs/MissingPolicy"
},
"read": {
"$ref": "#/$defs/ReadAs"
}
}
},
"BindConstant": {
"type": "object",
"additionalProperties": false,
"required": [
"kind",
"value"
],
"properties": {
"kind": {
"const": "constant"
},
"value": {
"$ref": "#/$defs/ScalarValue"
}
}
},
"BindSheetName": {
"type": "object",
"additionalProperties": false,
"required": [
"kind"
],
"properties": {
"kind": {
"const": "sheet_name"
},
"values": {
"type": "object",
"minProperties": 1,
"additionalProperties": {
"$ref": "#/$defs/ScalarValue"
},
"description": "Map from worksheet name to dimension code. When omitted, the worksheet name of each data cell is the dimension value."
},
"read": {
"$ref": "#/$defs/ReadAs"
},
"normalize": {
"$ref": "#/$defs/Normalize"
}
}
},
"BindRowIndex": {
"type": "object",
"additionalProperties": false,
"required": [
"kind"
],
"description": "Key each observation by the data cell's own 1-based row index. For Sheet!D18 yields 18. No values map.",
"properties": {
"kind": {
"const": "row_index"
},
"read": {
"$ref": "#/$defs/ReadAs"
}
}
},
"BindColumnLetter": {
"type": "object",
"additionalProperties": false,
"required": [
"kind"
],
"description": "Key each observation by the data cell's own column letter. For Sheet!D18 yields D. No values map.",
"properties": {
"kind": {
"const": "column_letter"
},
"read": {
"$ref": "#/$defs/ReadAs"
},
"normalize": {
"$ref": "#/$defs/Normalize"
}
}
},
"GroupRef": {
"type": "object",
"additionalProperties": false,
"required": [
"path"
],
"description": "View-level group membership for export sequencing and documentation. Affects only the generated API shape, never graph extraction or record semantics.",
"properties": {
"path": {
"type": "array",
"minItems": 1,
"items": {
"type": "string",
"minLength": 1
},
"description": "Nested group labels, outermost to innermost (e.g. ['Climate scenarios', 'Paris'])."
},
"order": {
"type": [
"integer",
"null"
],
"description": "Optional intra-group sequencing hint. Members without order fall back to binding declaration order."
}
}
},
"DimensionScope": {
"type": "string",
"enum": [
"series",
"cell"
],
"description": "series: one value for the entire binding (e.g. country in A2). cell: varies per leaf (e.g. TIME_PERIOD from column header)."
},
"DimensionRole": {
"type": "string",
"enum": [
"key",
"attribute"
],
"description": "key: participates in record matching. attribute: metadata only unless listed in key."
},
"Dimension": {
"type": "object",
"additionalProperties": false,
"required": [
"concept",
"role",
"scope",
"bind"
],
"properties": {
"id": {
"$ref": "#/$defs/DimensionId"
},
"concept": {
"$ref": "#/$defs/ConceptId"
},
"dtype": {
"type": "string",
"enum": [
"string",
"int",
"float",
"number",
"bool",
"datetime"
],
"description": "Per-dimension storage type overriding the concept-scheme dtype for this dimension only. Use when same-concept dimensions store different types (e.g. an int projection axis and a datetime reference period sharing TIME_PERIOD); an explicit bind read still wins for coercion."
},
"role": {
"const": "key"
},
"scope": {
"$ref": "#/$defs/DimensionScope"
},
"bind": {
"$ref": "#/$defs/Bind"
},
"include_in_record": {
"type": "boolean",
"default": true,
"description": "When false and scope is series, value is used for validation only and omitted from emitted Records unless listed in series_context."
}
}
},
"Attribute": {
"type": "object",
"additionalProperties": false,
"required": [
"concept",
"role"
],
"properties": {
"id": {
"$ref": "#/$defs/DimensionId"
},
"concept": {
"$ref": "#/$defs/ConceptId"
},
"role": {
"const": "attribute"
},
"bind": {
"$ref": "#/$defs/Bind"
},
"value": {
"$ref": "#/$defs/ScalarValue",
"description": "Shorthand for bind.kind constant when the attribute is fixed for the series."
},
"include_in_record": {
"type": "boolean",
"default": false
}
},
"oneOf": [
{
"required": [
"bind"
]
},
{
"required": [
"value"
]
}
]
},
"Measure": {
"type": "object",
"additionalProperties": false,
"required": [
"concept",
"bind"
],
"properties": {
"concept": {
"type": "string",
"const": "OBS_VALUE",
"description": "Observation value concept (required field name value in Records)."
},
"dtype": {
"type": "string",
"enum": [
"int",
"float",
"number",
"string",
"bool",
"datetime"
],
"default": "float"
},
"bind": {
"allOf": [
{
"$ref": "#/$defs/BindDataCell"
}
]
}
}
},
"ComputeHelper": {
"type": "object",
"additionalProperties": false,
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"pattern": "^[a-z][a-z0-9_]*$",
"description": "Parameterized helper callable `(ctx, **dims) -> CellValue` covering the published output leaves (typically a post-refactor internals helper)."
},
"dims": {
"type": "array",
"items": {
"type": "string",
"minLength": 1
},
"description": "Binding concept / effective ids passed as kwargs from the static record. Defaults to the series key when omitted."
}
}
},
"Compute": {
"type": "object",
"additionalProperties": false,
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"pattern": "^compute_[a-z][a-z0-9_]*$",
"description": "Generated Python function name, e.g. compute_borvelia_primary_balance."
},
"record_contract": {
"type": "string",
"const": "records",
"default": "records",
"description": "list[Record] with OBS_VALUE and all declared dimensions."
},
"include_address": {
"type": "boolean",
"default": false,
"description": "When true, each output record includes address or cell_address."
},
"helper": {
"$ref": "#/$defs/ComputeHelper",
"description": "Optional parameterized helper covering this series' published leaves. When set, compute_* calls the helper from static record dims instead of xl_cell(address). Leaves without helper coverage (via address overlay) still use xl_cell."
}
}
},
"InputDomainBounds": {
"type": "object",
"additionalProperties": false,
"properties": {
"min": {
"type": "number",
"description": "Inclusive lower bound."
},
"max": {
"type": "number",
"description": "Inclusive upper bound."
}
},
"anyOf": [
{
"required": [
"min"
]
},
{
"required": [
"max"
]
}
],
"description": "Closed numeric interval; at least one of min or max is required."
},
"InputDomainIntBounds": {
"type": "object",
"additionalProperties": false,
"properties": {
"min": {
"type": "integer",
"description": "Inclusive lower bound."
},
"max": {
"type": "integer",
"description": "Inclusive upper bound."
}
},
"anyOf": [
{
"required": [
"min"
]
},
{
"required": [
"max"
]
}
],
"description": "Closed integer interval; at least one of min or max is required."
},
"InputDomain": {
"description": "Allowed measure values. One kind: enum, between, real_between, or from_workbook; or a union of enum with exactly one of between or real_between (1.22.0). enum/between/real_between are enforced on compute_* / Model arguments. A union enum member is matched against the caller's original value, before int-to-float coercion; other values are checked after that coercion. A union value matches when it is an enum member or lies in the interval. from_workbook pins each bound cell to its cached workbook value (dynamic-ref env only) and cannot be combined with another kind. `between` requires measure dtype `int`; `real_between` requires `float` or `number`. Bind validation and export fail closed on a mismatch. A union cannot combine between with real_between.",
"oneOf": [
{
"type": "object",
"additionalProperties": false,
"required": [
"enum"
],
"properties": {
"enum": {
"type": "array",
"minItems": 1,
"items": {
"type": [
"string",
"number",
"boolean"
]
},
"description": "Closed set of allowed measure values (exact match)."
}
}
},
{
"type": "object",
"additionalProperties": false,
"required": [
"between"
],
"properties": {
"between": {
"$ref": "#/$defs/InputDomainIntBounds",
"description": "Inclusive integer bounds (Between semantics)."
}
}
},
{
"type": "object",
"additionalProperties": false,
"required": [
"real_between"
],
"properties": {
"real_between": {
"$ref": "#/$defs/InputDomainBounds",
"description": "Inclusive real bounds (RealBetween semantics)."
}
}
},
{
"type": "object",
"additionalProperties": false,
"required": [
"from_workbook"
],
"properties": {
"from_workbook": {
"type": "boolean",
"const": true,
"description": "Pin each bound cell to a singleton domain from its cached workbook value."
}
}
},
{
"type": "object",
"additionalProperties": false,
"required": [
"enum",
"between"
],
"properties": {
"enum": {
"type": "array",
"minItems": 1,
"items": {
"type": [
"string",
"number",
"boolean"
]
},
"description": "Literal arm of a union. A value matches when it equals a member or lies in between."
},
"between": {
"$ref": "#/$defs/InputDomainIntBounds",
"description": "Inclusive integer arm of a union (Between semantics)."
}
}
},
{
"type": "object",
"additionalProperties": false,
"required": [
"enum",
"real_between"
],
"properties": {
"enum": {
"type": "array",
"minItems": 1,
"items": {
"type": [
"string",
"number",
"boolean"
]
},
"description": "Literal arm of a union. A value matches when it equals a member or lies in real_between."
},
"real_between": {
"$ref": "#/$defs/InputDomainBounds",
"description": "Inclusive real arm of a union (RealBetween semantics)."
}
}
}
]
},
"InputDirection": {
"type": "object",
"additionalProperties": false,
"properties": {
"mode": {
"type": "string",
"enum": [
"leaf",
"override"
],
"default": "leaf",
"description": "Input binding semantics. leaf (default): data_range cells must be graph leaves. override: allow formula cells with dependents (typed-over-formula validation)."
},
"domain": {
"$ref": "#/$defs/InputDomain",
"description": "Optional measure-value domain. Accepted and normalized to series-level `domain` at load time (1.19.0). When `value_map` is set and `domain` is omitted, compute_* checks use the map keys and the cell env uses the workbook needles."
},
"value_map": {
"$ref": "#/$defs/InputValueMap",
"description": "Optional map from public scalar input values to workbook cell values (MATCH/IF needles). Applied after `input.domain` at the inverted-tree orchestrator before the value enters any expression. Distinct from bind.kind `value_map`."
}
}
},
"InputValueMap": {
"type": "object",
"minProperties": 1,
"additionalProperties": {
"$ref": "#/$defs/ScalarValue"
},
"description": "Public scalar value to workbook needle. Keys are the caller-facing domain; values are the literal cell text the formula compares against."
},
"OutputDirection": {
"type": "object",
"additionalProperties": false,
"required": [
"compute"
],
"properties": {
"compute": {
"$ref": "#/$defs/Compute"
}
}
},
"InternalDirection": {
"type": "object",
"additionalProperties": false,
"description": "Marks a non-I/O binding for formula-cell key triangulation."
},
"ConstantDirection": {
"type": "object",
"additionalProperties": false,
"description": "Marks a non-I/O graph-leaf binding. No public compute_* API is emitted."
},
"Layout": {
"type": "string",
"enum": [
"series",
"scalar",
"matrix"
],
"description": "Optional declarative intent for analysts and layout-specific validation. Resolution and codegen use bind kinds, not layout name. series: one-dimensional data_range with at least one cell-scoped dimension when declared. scalar: single leaf. matrix: rectangular multi-row data_range with at least two dimensions and a cell-scoped dimension when declared."
},
"SeriesRelation": {
"type": "object",
"additionalProperties": false,
"minProperties": 1,
"maxProperties": 1,
"description": "One cell-to-cell comparison against a partner series, aligned on the shared key (1.18.0). Partner is a series id, not an A1 address.",
"properties": {
"greater_than": {
"type": "string",
"pattern": "^[a-z][a-z0-9_]*$",
"description": "Partner series id. The declaring cell is strictly greater than the partner cell at the same key (GreaterThanCell)."
},
"not_equal": {
"type": "string",
"pattern": "^[a-z][a-z0-9_]*$",
"description": "Partner series id. The declaring cell is never equal to the partner cell at the same key (NotEqualCell)."
}
}
},
"SeriesBinding": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"sheet",
"data_range",
"structure",
"key"
],
"properties": {
"id": {
"type": "string",
"pattern": "^[a-z][a-z0-9_]*$",
"description": "Stable binding id, e.g. borvelia_primary_balance."
},
"sheet": {
"description": "Worksheet name (must match data_range sheet). A list when complementary shards cover multiple sheets.",
"oneOf": [
{
"$ref": "#/$defs/SheetName"
},
{
"$ref": "#/$defs/SheetNameList"
}
]
},
"data_range": {
"description": "Numeric cells for this series; codegen intersects with the extracted graph. A list concatenates complementary shard ranges at resolve time.",
"oneOf": [
{
"$ref": "#/$defs/DataRange"
},
{
"$ref": "#/$defs/DataRangeList"
}
]
},
"layout": {
"$ref": "#/$defs/Layout",
"description": "Optional analyst-facing layout intent; triggers layout-specific schema and validation rules when set."
},
"axis_labels": {
"$ref": "#/$defs/DimensionId",
"description": "The sole key axis whose runtime labels are supplied by this series' values."
},
"relations": {
"type": "array",
"items": {
"$ref": "#/$defs/SeriesRelation"
},
"uniqueItems": true,
"description": "Optional cell-to-cell comparisons against partner series, aligned on the shared key (1.18.0). greater_than compiles to GreaterThanCell; not_equal to NotEqualCell. Partner is a series id, not an A1 address."
},
"domain": {
"$ref": "#/$defs/InputDomain",
"description": "Optional series-level measure domain (1.19.0). One of enum, between, real_between, or from_workbook, or a union of enum with exactly one interval (1.22.0). input.domain is accepted and normalized to this key. constant implies from_workbook when omitted. Feeds compute_* checks (except from_workbook) and the CellTypeEnv compiler."
},
"exclude_rows": {
"type": "array",
"items": {
"$ref": "#/$defs/RowSpec"
},
"description": "Rows within data_range that are never data (e.g. group header or separator rows referenced by lookup formulas). Applied before graph-leaf intersection."
},
"exclude_columns": {
"type": "array",
"items": {
"$ref": "#/$defs/ColumnSpec"
},
"description": "Columns within data_range that are never data for this series (e.g. milestone years published on a separate summary series). Applied after data_range expansion alongside exclude_rows, before graph-leaf intersection. Distinct from column_header skip/include, which only filter label sources."
},
"editable": {
"type": "boolean",
"default": true
},
"input": {
"$ref": "#/$defs/InputDirection"
},
"output": {
"$ref": "#/$defs/OutputDirection"
},
"internal": {
"$ref": "#/$defs/InternalDirection"
},
"constant": {
"$ref": "#/$defs/ConstantDirection"
},
"groups": {
"type": "array",
"items": {
"$ref": "#/$defs/GroupRef"
},
"description": "Optional view-level groups for documentation sequencing. Omitted or empty reproduces the flat catalog order."
},
"structure": {
"type": "object",
"additionalProperties": false,
"required": [
"measure",
"dimensions"
],
"properties": {
"measure": {
"$ref": "#/$defs/Measure"
},
"dimensions": {
"type": "array",
"items": {
"$ref": "#/$defs/Dimension"
}
},
"attributes": {
"type": "array",
"items": {
"$ref": "#/$defs/Attribute"
},
"default": []
}
}
},
"key": {
"type": "array",
"items": {
"$ref": "#/$defs/DimensionId"
},
"uniqueItems": true,
"description": "Effective dimension ids (dimension id when declared, else concept) required on each incoming record for matching (MVP series: typically [TIME_PERIOD] when country and indicator are series-scoped). Scalar layout may use an empty key when the binding resolves to a single cell."
},
"series_context": {
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/ScalarValue"
},
"description": "Fixed key-values attached to every record and setter docs; not used for matching unless also listed in key."
},
"validation": {
"$ref": "#/$defs/Validation"
},
"sdmx_notes": {
"type": "string",
"description": "Human-readable SDMX fit commentary; not consumed by codegen."
},
"notes": {
"type": "string",
"description": "Free-form analyst notes."
}
},
"allOf": [
{
"$ref": "#/$defs/SeriesBindingDirectionRules"
},
{
"$ref": "#/$defs/SeriesBindingInternalExclusivity"
},
{
"$ref": "#/$defs/SeriesBindingConstantExclusivity"
},
{
"$ref": "#/$defs/SeriesBindingLayoutKeyRules"
},
{
"$ref": "#/$defs/SeriesBindingInputValueMapRules"
},
{
"$ref": "#/$defs/SeriesBindingMvpRules"
},
{
"$ref": "#/$defs/SeriesBindingMatrixRules"
}
]
},
"SeriesBindingInputValueMapRules": {
"description": "input.value_map is allowed only on layout scalar input series (1.15.0).",
"if": {
"required": [
"input"
],
"properties": {
"input": {
"required": [
"value_map"
]
}
}
},
"then": {
"required": [
"layout"
],
"properties": {
"layout": {
"const": "scalar"
}
}
}
},
"SeriesBindingLayoutKeyRules": {
"description": "Non-scalar layouts require at least one key and dimension; scalar may use empty key and dimensions.",
"if": {
"properties": {
"layout": {
"const": "scalar"
}
},
"required": [
"layout"
]
},
"then": {
"properties": {
"key": {
"minItems": 0
},
"structure": {
"properties": {
"dimensions": {
"minItems": 0
}
}
}
}
},
"else": {
"properties": {
"key": {
"minItems": 1
},
"structure": {
"properties": {
"dimensions": {
"minItems": 1
}
}
}
}
}
},
"SeriesBindingDirectionRules": {
"description": "Each series must declare at least one of input, output, internal, or constant.",
"anyOf": [
{
"required": [
"input"
]
},
{
"required": [
"output"
]
},
{
"required": [
"internal"
]
},
{
"required": [
"constant"
]
}
]
},
"SeriesBindingInternalExclusivity": {
"description": "internal direction is mutually exclusive with input, output, and constant.",
"if": {
"required": [
"internal"
]
},
"then": {
"not": {
"anyOf": [
{
"required": [
"input"
]
},
{
"required": [
"output"
]
},
{
"required": [
"constant"
]
}
]
}
}
},
"SeriesBindingConstantExclusivity": {
"description": "constant direction is mutually exclusive with input, output, and internal.",
"if": {
"required": [
"constant"
]
},
"then": {
"not": {
"anyOf": [
{
"required": [
"input"
]
},
{
"required": [
"output"
]
},
{
"required": [
"internal"
]
}
]
}
}
},
"SeriesBindingMatrixRules": {
"description": "Constraints for layout matrix (1.1.0).",
"if": {
"properties": {
"layout": {
"const": "matrix"
}
},
"required": [
"layout"
]
},
"then": {
"properties": {
"structure": {
"properties": {
"dimensions": {
"type": "array",
"minItems": 2,
"contains": {
"type": "object",
"properties": {
"scope": {
"const": "cell"
}
},
"required": [
"scope"
]
}
}
}
}
}
}
},
"SeriesBindingMvpRules": {
"description": "MVP constraints for one-series-per-id layout rules.",
"allOf": [
{
"if": {
"properties": {
"layout": {
"const": "series"
}
},
"required": [
"layout"
]
},
"then": {
"properties": {
"structure": {
"properties": {
"dimensions": {
"type": "array",
"contains": {
"type": "object",
"properties": {
"scope": {
"const": "cell"
}
},
"required": [
"scope"
]
},
"minItems": 1
}
}
}
}
}
}
]
},
"Validation": {
"type": "object",
"additionalProperties": false,
"properties": {
"intersect_graph_leaves": {
"type": "boolean",
"default": true,
"description": "When true, every cell in data_range must be a leaf in the extracted dependency graph (input leaf mode and constant bindings)."
},
"require_unique_key": {
"type": "boolean",
"default": true,
"description": "When true, resolved key tuples must be unique across leaves in data_range. Keyed inverted-tree catalog series require unique keys; false is incompatible with a keyed catalog series. Extract-only series (`catalog: false`) default this to false."
},
"catalog": {
"type": "boolean",
"default": true,
"description": "When true (the default), inverted-tree catalogs this series as a tensor (`data.py`, occupancy, unique keys). When false, the series is extract-only: it still compiles into CellTypeEnv / DynamicRefConfig.from_bindings and is omitted from the catalog. Fail closed if the series uniquely owns an on-graph formula cell."
},
"fail_on_empty_leaf": {
"type": "boolean",
"default": true
},
"warn_on_partial_overlap": {
"type": "boolean",
"default": true,
"description": "When true, emit a warning when data_range cells are skipped because they are absent from the graph."
},
"intersect_graph_nodes": {
"type": "boolean",
"default": true,
"description": "When true for output bindings, only cells present in the extracted graph are included."
},
"intersect_graph_formulas": {
"type": "boolean",
"default": true,
"description": "When true for internal bindings, only formula cells present in the extracted graph are included."
}
}
}
},
"examples": [
{
"schema_version": "1.3.0",
"workbook": "lic_inputs.xlsx",
"series": [
{
"id": "borvelia_primary_balance",
"sheet": "Inputs",
"data_range": "Inputs!F5:J5",
"layout": "series",
"editable": true,
"structure": {
"measure": {
"concept": "OBS_VALUE",
"dtype": "float",
"bind": {
"kind": "data_cell",
"read": "float"
}
},
"dimensions": [
{
"concept": "REF_AREA",
"role": "key",
"scope": "series",
"bind": {
"kind": "cell",
"address": "Inputs!A2",
"read": "string",
"normalize": "strip"
},
"include_in_record": false
},
{
"concept": "INDICATOR",
"role": "key",
"scope": "series",
"bind": {
"kind": "row_label",
"label_column": "A",
"read": "string",
"normalize": "strip_trailing_unit"
},
"include_in_record": false
},
{
"concept": "TIME_PERIOD",
"role": "key",
"scope": "cell",
"bind": {
"kind": "column_header",
"header_row": 1,
"read": "int"
}
}
],
"attributes": [
{
"concept": "UNIT_MEASURE",
"role": "attribute",
"value": "PC_GDP",
"include_in_record": true
}
]
},
"key": [
"TIME_PERIOD"
],
"series_context": {
"REF_AREA": "Borvelia",
"INDICATOR": "Primary balance (% of GDP)"
},
"validation": {
"intersect_graph_leaves": true,
"require_unique_key": true
},
"sdmx_notes": "Wide row: TIME_PERIOD from row 1 offsets 1-5; REF_AREA from A2; indicator from A5.",
"input": {}
}
]
},
{
"schema_version": "1.1.0",
"workbook": "lic_inputs.xlsx",
"series": [
{
"id": "country_block_primary_balance",
"sheet": "Inputs",
"data_range": "Inputs!F3:J8",
"layout": "matrix",
"structure": {
"measure": {
"concept": "OBS_VALUE",
"bind": {
"kind": "data_cell",
"read": "float"
}
},
"dimensions": [
{
"concept": "REF_AREA",
"role": "key",
"scope": "cell",
"bind": {
"kind": "row_label",
"label_column": "A"
}
},
{
"concept": "INDICATOR",
"role": "key",
"scope": "cell",
"bind": {
"kind": "row_label",
"label_column": "A"
}
},
{
"concept": "TIME_PERIOD",
"role": "key",
"scope": "cell",
"bind": {
"kind": "column_header",
"header_row": 1,
"read": "int"
}
}
]
},
"key": [
"REF_AREA",
"INDICATOR",
"TIME_PERIOD"
],
"notes": "Illustrative 1.1.0 matrix binding with explicit row_label and column_header binds.",
"input": {}
}
]
}
]
}