Unreleased documentation. These pages follow the main branch and can change before the next release. For supported guidance, use v0.48.0.
If your institution publishes counts from a Base Registry Engine (BReg) registry to a dashboard, statistics office, or republisher, declare a statistical dataset and publish its ended periods. Release readers see small counts suppressed and the rest rounded under minimum-count-and-rounding, or every measure exactly under exact-public-values, without permission on the records behind them.
What a statistical dataset fixes
Section titled “What a statistical dataset fixes”A statistical dataset measures the records of one Record type, its unit, that match a fixed population, per calendar period, grouped by a closed set of dimensions. The registry project declares all of this, including the measures: counts, sums, means, distinct counts, ratios, and percentiles. PostgreSQL computes every value. A consumer chooses periods and JSON or CSV, never SQL, a grouping, or the population, so every reader counts the same thing.
Declare a dataset
Section titled “Declare a dataset”The facility template declares none; add one under the root statisticalDatasets key of registry.yaml, with these members:
id, andunit, the Record type whose records are countedpopulation, a filter in the same$filtergrammar as a list query, over that Record type’s fieldsperiod, eithertype: flowwith a datefieldthat places each record in one period, ortype: stockwith avalidity(temporal, orfromand an optionaluntildate field) that counts the records valid on the period’s reference dategranularity(day,month,quarter, oryear) andfirstPeriod, both insideperioddimensions, boolean or vocabulary-code fields of the unit Record typemeasures, optional, a list tagged bytype, described in Choose the measures. Omitting the list gives one count measure with the idcountdisclosure, tagged by a requiredtype, eitherminimum-count-and-roundingwithminimumCountandroundingBase, each at least 2, orexact-public-valueswith no other member
One period, with every dimension code, every total, and every measure, must fit in 10,000 cells.
A dataset declares at most 12 dimensions (breg.statistical-dataset.dimensions-exceeded), because PostgreSQL computes the totals with one CUBE that accepts no more.
Choose the measures
Section titled “Choose the measures”A dataset may declare these measure types:
count, at most one per datasetsumwith afieldmeanwith afieldand ascalefrom 0 to 38distinct-countwith areferencefieldratiowith anumerator, adenominator, and ascalefrom 0 to 38percentilewith afield, apercentilefrom 1 to 99, and ascalefrom 0 to 38
scale sets the number of digits after the decimal point.
A sum, a mean, or a percentile needs an unencrypted int64 or decimal field of the unit.
A distinct count needs an unencrypted reference field.
Every read-live profile must be able to read that field, because the measure reveals its values.
The publisher and the exactReads profile must be able to read it too, under either disclosure method.
The field need not be filterable, and being filterable is not enough.
Every measure type is available on the exact paths: read-live, read-exact, and a release under exact-public-values.
A release under minimum-count-and-rounding carries counts, distinct counts, and sums.
Sums follow the rules in Release sums, which are held for review.
A dataset with a mean, a ratio, or a percentile cannot be released under that method (breg.statistical-dataset.measure-release-unsupported).
Read those measures live or exactly instead.
A reader of a release who wants a mean divides a released sum by a released count:
measures: - id: count type: count - id: amount_total type: sum field: amount - id: amount_mean type: mean field: amount scale: 2A distinct count reports how many different values a reference field takes among a cell’s records. On a parcel register, a count of parcels and the number of distinct owners:
measures: - id: count type: count - id: owner_count type: distinct-count field: ownerIts value is a JSON integer, and an empty cell is 0. Records with no owner are left out. A field of any other type is refused with breg.statistical-dataset.measure-field-type, and two distinct counts over the same field with breg.statistical-dataset.measure-distinct-count-duplicate. A distinct count is not additive: one owner can hold parcels in two districts, so the distinct owners of two districts are not the sum of each district’s distinct owners. A total is counted over the records, and a reader must not add distinct-count cells. Because totals are computed over the records, a dataset that declares a distinct count declares at most 4 dimensions (breg.statistical-dataset.non-additive-dimensions).
A ratio divides one measure by another: the share of irrigated area is a sum of irrigated hectares over a sum of total hectares, and hectares per owner is a sum over a distinct count. numerator and denominator name a count, distinct-count, or sum measure of the same dataset, and scale is required:
measures: - id: area_total type: sum field: area - id: owner_count type: distinct-count field: owner - id: hectares_per_owner type: ratio numerator: area_total denominator: owner_count scale: 2A ratio, a mean, a percentile, an unknown id, the ratio’s own id, or the same measure on both sides is refused with breg.statistical-dataset.ratio-operand. The value is computed from the operands’ exact values, never from their rounded text, and rounded half away from zero to scale digits. A denominator of zero gives no value and the status not-applicable. A total’s ratio is the ratio of the totals, not the mean of the cells’ ratios, because averaging ratios weights a small cell like a large one.
A percentile is the value below which the given share of a field’s values fall. On the parcel register, the median parcel area is percentile: 50:
measures: - id: area_median type: percentile field: area percentile: 50 scale: 1With the cell’s n values sorted as x[1] to x[n] and q equal to percentile divided by 100, the value is (x[j] + x[j+1]) / 2 when n times q is a whole number j, and x[ceil(n q)] otherwise. This is the inverse of the empirical distribution function with averaging at discontinuities (Hyndman and Fan definition 2), so the median of 1, 2, 3, 4 is 2.5 and the median of 1, 2, 3 is 2. Records with no value for the field are left out, and the value is rounded half away from zero to scale digits. A cell with no values has no value and the status not-applicable. Spreadsheet and statistics-package defaults often use another definition (interpolation, Hyndman and Fan definition 7), so a value can differ from a spreadsheet’s PERCENTILE on a small cell.
The field must be int64 or decimal (breg.statistical-dataset.measure-field-type). It must be readable, not only filterable, by every read-live profile, by the publisher, and by the exactReads profile, and it must be classified public under exact-public-values, as for a sum or a mean. A percentile is not additive, since a total’s percentile is computed over the records, so a dataset that declares one declares at most 4 dimensions (breg.statistical-dataset.non-additive-dimensions), as for a distinct count. Adding either measure changes the definition digest and starts a new release series.
Name the disclosure method
Section titled “Name the disclosure method”A dataset’s disclosure block names how its releases are protected:
disclosure: type: minimum-count-and-rounding minimumCount: 5 roundingBase: 5The configuration reference lists every member and the refusals bregctl check reports.
Population and dimensions
Section titled “Population and dimensions”Modules cannot contribute statistical datasets. Only the root project declares them. The population uses the typed read-filter grammar and the API field names of the unit. A dimension names a logical field ID and must be a boolean or a closed vocabulary field. BReg refuses encrypted fields and consent-gated source grants.
Dimension codes
Section titled “Dimension codes”A dimension cell carries a code, not a label.
Boolean codes are true and false.
_T denotes a total, and _U denotes a null value when the field can be null; derived fields are
nullable for this purpose.
A vocabulary code beginning with _ is reserved and refused (breg.statistical-dataset.dimension-code-reserved).
A non-null value outside the declared vocabulary refuses the whole computation without disclosing
that value.
A dimension’s CSV column is named after its field identifier.
A dimension cannot use period, measure, value, or status, because the document and CSV use
those names (breg.statistical-dataset.dimension-reserved).
The periodStart and periodEnd columns cannot clash with a dimension, because field identifiers
are lowercase.
Live counts and releases
Section titled “Live counts and releases”A live value is computed on request from current data. It is exact, and filtered by the same rules as the profile’s ordinary list query, so a live count is one the profile could already obtain by listing records. A live sum, mean, distinct count, ratio, or percentile is exact and can reveal one record’s value in a small cell, so it is granted only to a profile that can read the records and the field, and it is not disclosure-controlled. Under minimum-count-and-rounding, releases carry counts, distinct counts, and sums.
A release is a stored, numbered version of one ended period, computed against one snapshot and transformed for disclosure. A final release can be corrected by a later final release, and a provisional release is refused once a final exists. Each release carries a definition digest of the population, sources, publisher visibility, dimensions, measures, and the disclosure method and its parameters. Changing who may read a dataset keeps the series. Changing what it counts starts another one, and so does adding a measure or changing the disclosure method.
Publication computes under one source snapshot and records the shared history head with that
computation.
The release’s snapshot is an opaque bookmark when history coverage is available, or null after
erasure or another coverage invalidation.
Publication continues from current data without a history rebaseline, and a rebaseline can restore
bookmarks for later releases.
Persistence then verifies the same package activation, rechecks eligibility and freshness, and
allocates the next version.
BReg refuses a computation that a newer committed computation superseded.
Immediate Actions and ordinary mutations advance the same history head.
Versions increase monotonically per dataset and period, including across changed definitions.
Latest reads skip withdrawn versions, and status=final selects only final releases.
A version from another definition stays stored but is unavailable until that exact definition is
active again, because read eligibility uses the active definition digest.
The digest covers the unit, population, period, measures, dimensions and codes, the definitions of
referenced fields and derived SQL inputs, and publisher visibility on every source dependency.
For measures it covers their ids and order, and each one’s type, field, operands, percentile, and
scale, but not display.
It also covers the disclosure method and its parameters, except dominancePercent.
The read-releases, read-live, and read-exact grants, exactReads, and firstPeriod do not
change it.
Release sums
Section titled “Release sums”Released sums are held for review. The rules below are implemented and tested, but bregctl check refuses a publish or read-releases grant on a dataset that declares a sum under minimum-count-and-rounding (breg.statistical-dataset.sum-release-held) until a statistician has reviewed the rules and their implementation. Until then, serve sums through read-live, read-exact, or a release under exact-public-values. Lifting the hold also needs the contributor computation to fit the 30-second statement budget on large registers, which a one-period release with 4 dimensions over about a million records and 200,000 contributors did not on a development machine.
A sum released under minimum-count-and-rounding needs a contributor, the party a value belongs to, and a dominance percentage:
disclosure: type: minimum-count-and-rounding minimumCount: 5 roundingBase: 5 contributor: type: field field: owner dominancePercent: 15contributor names whom a value belongs to.
type: field names a reference field of the unit, such as the owner of a parcel, and the publisher must be able to read it.
type: each-record states that every record is its own contributor.
Records with no contributor value count together as one contributor, which is the cautious reading.
dominancePercent is an integer from 1 to 100.
Both are required when a dataset that grants publish declares a sum, and refused otherwise.
There are no defaults.
In brief, the rules apply in this order:
- Every measure of a cell with at least one and fewer than
minimumCountcontributors is suppressed. Five parcels owned by one farmer are a cell of one. A sum is also suppressed when at least one and fewer thanminimumCountcontributors have a value for the summed field, so a zero sum never reveals that a small group left the field unset. A count keeps its own minimum on records as well. A suppressed count does not blank its totals, so for counts the contributor minimum is only as strong as rounding. - A sum is suppressed when the cell without its two largest contributors is smaller than
dominancePercentpercent of the largest (the p% rule). With T the cell’s sum and x1 and x2 the two largest contributor totals, the sum is suppressed when T - x1 - x2 < (p / 100) x1. The second-largest contributor can estimate the largest by subtracting its own value from the total, and the rule bounds how close that estimate gets. BReg uses the p% rule rather than the older (n,k) dominance rule, because the p% rule measures the actual risk and suppresses less. - A suppressed sum suppresses the same measure in every total that contains it, so one small district can blank a national total. BReg does not choose extra cells to suppress.
- A sum over an
int64field is rounded toroundingBase, with statusrounded. A sum over adecimalfield is exact to its scale, with statusexact. - Values must not be negative. A summed
decimalfield declares aminimumof zero or more. A publication is refused with refusal codenegative-valuewhen any value of the period’s population is negative. Serve a field that can be negative, such as a balance, through the exact paths. - Day periods are refused, a dataset declares at most 4 dimensions, and two datasets that release a sum of the same field over the same unit are refused, whatever their dimensions, populations, and granularities: any two share a total, such as the grand total, that one could be differenced against the other. Release every sum of a field in one dataset.
A suppressed cell has no value and the status suppressed.
The document never says why, because a reason would itself be a disclosure.
The release document states the contributor, dominanceRule: p-percent, and sumTotals: suppressed-when-containing-a-suppressed-sum.
It never states dominancePercent, because a reader who knows it can bound the largest contributor more tightly.
The percentage is also left out of the definition digest.
Changing the contributor starts a new release series, and changing the percentage does not.
The configuration reference lists every member and refusal code.
The sum rules leave some inference paths open, such as differencing revised versions of one period.
BREG-RES-26 lists them and what you can do about each.
A release is immutable, so dry-run a publication to see which cells and totals will be blank before you publish.
The dry run is open to the publisher only, for every dataset with releases.
The publisher sends the publication’s body to POST /v1/statistics/<dataset>/releases/<period>/versions:dry-run, with no Idempotency-Key.
The response is the release document a publication made at that moment would store, with its next version number.
A dry run takes no publication lock, so a publication made in between takes that number.
The response also carries suppressions, which gives each suppressed cell’s index in document.cells and the reason.
The reasons are minimum-count, minimum-contributors, dominance, and contains-suppressed-sum, and the list may grow.
The suppressions list adds about 50 bytes per suppressed cell, at most about 500 KB, to a document of at most 8 MiB.
A client reading the dry run of a dataset near that bound needs a response limit above its 8 MiB default.
A dry run stores nothing and reserves no version, and it writes an audit attempt and one terminal entry.
The clients offer statistics_release_dry_run (Rust and Python) and statisticsReleaseDryRun (Node.js).
Decide who reads a dataset
Section titled “Decide who reads a dataset”Each access profile that reaches it says so under permissions.datasets, beside its record permissions under permissions.records. A dataset permission holds dataset and operations, drawn from four operations:
read-live, exact live valuespublish, publishing and withdrawing releasesread-releases, released documentsread-exact, exact values for ended periods, for a named consumer
One profile at most holds publish on a dataset. Give it to a profile a person or a service uses directly: a standing agent profile, one with actorKind: agent and no taskGrant, cannot publish or withdraw a release, and bregctl check refuses the project with breg.access-profile.standing-agent-publish-forbidden. Control access explains task grants.
A publisher and every read-live profile also need a count-capable list permission on the unit. A publisher’s visibility must not depend on the caller, because the same dataset would otherwise count a different population for each caller. A profile that holds only read-releases needs no record permission. The configuration reference carries the full set of rules. Run bregctl explain access to see, for each dataset, which profiles hold each operation.
Rules the compiler enforces
Section titled “Rules the compiler enforces”bregctl check refuses a project that breaks one of these rules:
- A dataset needs at least one grant (
breg.statistical-dataset.grants-empty). - A profile names a dataset in at most one permission, and a permission on a dataset the project does
not declare is refused (
breg.access-profile.permission-dataset-unknown). - At most one profile holds
publishon a dataset (breg.statistical-dataset.publisher-multiple). - When a dataset has a publisher, the publisher and every
read-liveprofile must also holdread-releases(breg.statistical-dataset.read-releases-required), because release reads authorise the publisher, everyread-liveprofile, and every otherread-releasesprofile. read-releaseson a dataset nobody publishes is refused (breg.statistical-dataset.publisher-missing).
Every dataset profile is authenticated, and you choose one profile per request with
accessProfile.
BReg never combines profiles into a larger grant.
/v1/registry and /openapi.json filter dataset operations with the same authorisation checks, and
a release-only reader receives no Record type grant.
Live reads and the list grant
Section titled “Live reads and the list grant”The statistical query uses the same list predicates, forced row security, visibility checks, and field expressions as the ordinary list query. The list grant must therefore permit the fields and typed filter operators the population, the period or validity selection, and the dimensions use. Live reads keep the caller’s row and membership boundaries, purpose, and request visibility.
Publisher independence
Section titled “Publisher independence”A publisher’s population must not depend on the caller. The compiler checks the unit and every source Record type that a referenced derived definition reads. On each of them the publisher needs a read grant without claim-bound rows, membership boundaries, purpose filters, consent gates, or owner-dependent request visibility. Mandatory Record type boundaries also make publication ineligible. This keeps different publishers from producing different populations under one dataset identity.
Disclosure conditions
Section titled “Disclosure conditions”A record disclosure condition on a
source Record type hides matching records from every profile it does not exempt. Two rules keep a
dataset from disclosing them.
The publishing profile must be in exemptProfiles of every record condition on a source Record
type, so a release counts every record whatever the caller (breg.disclosure.statistics-publisher-bound).
A profile that reads live or exact values over a Record type with a record condition must be
exempt too, or hold read-releases instead (breg.disclosure.statistics-live-bound).
Live counts for a profile that stays bound therefore never include a withheld record, and the
check refuses a grant that would.
A derived relation that reads a field a fields condition withholds is refused unless every profile
that reaches the dataset is exempt (breg.disclosure.statistics-withheld-field).
Standing agents
Section titled “Standing agents”Publishing or withdrawing a release commits at once, with no draft for a person to confirm.
A standing agent profile therefore cannot hold publish, and the compiler holds the unit’s Record
type profile for the publisher’s id, which both operations authorise through, to the same rule.
A standing agent may hold read-live and read-releases.
It cannot hold read-exact, and a standing agent or task-grant profile cannot be a dataset’s
exactReads profile.
Periods and evaluation dates
Section titled “Periods and evaluation dates”Granularities are day, month, quarter, and year, using UTC calendar periods.
The period codes are YYYY-MM-DD, YYYY-MM, YYYY-Qn, and YYYY.
A range uses positive four-digit years, and each period’s exclusive end must also fit that date
range: 9999-11 is valid and 9999-12 is refused.
A range includes both named periods and contains at most 366 periods.
A response contains at most 10,000 cells as served: periods times dimension combinations times
measures, including totals and zero-filled domain combinations.
Canonical JSON documents and CSV responses are limited to 8 MiB.
The compiler bounds a single-period document.
If a multi-period range returns 400 query.invalid naming no parameter, its representation exceeds
that limit; reduce the range.
A flow counts the unit’s rows whose date field falls in [start, end).
A stock counts the rows valid on the period’s reference date.
A stock names its validity in one of two ways:
period: type: stock granularity: month firstPeriod: 2025-01 validity: temporalvalidity: temporal uses the Record type’s temporal declaration.
Alternatively, validity names the date fields with from and until.
The interval is [from, until), and a null end means open-ended.
When until names the unit’s lastDayField, the interval runs through that last day inclusive, as
it does under validity: temporal.
An ended period’s reference date is its final day.
The current period uses today’s date in the registry’s time zone, which a project with a
statistical dataset must declare; History reads
describes project.timezone.
Publication requires an ended period at or after firstPeriod.
A derived field that calls registry_context.evaluation_date() runs at today’s date in the
registry’s time zone for live reads and at the period’s reference date for publication.
A live read of a dataset that depends on this function accepts only its current period, which keeps
the live result count-equivalent to its ordinary list query.
A release counts the registry’s present rows evaluated at the reference date; it does not
reconstruct what the registry held on that past date.
Serve exact values to a named consumer
Section titled “Serve exact values to a named consumer”A policy-simulation or costing service sometimes needs exact statistics over records it cannot read. read-exact serves counts, sums, means, distinct counts, ratios, percentiles, and cells of one for ended periods to a profile that holds the grant, and the profile needs no record access. The dataset declares the visibility the read computes under with exactReads, and the consumer’s profile holds only read-exact:
statisticalDatasets: monthly-discharge-reports: unit: discharge-report population: "substanceCode ne null" period: type: flow field: period-start granularity: month firstPeriod: 2025-01 dimensions: - administrative-boundary measures: - id: count type: count - id: amount_total type: sum field: amount disclosure: type: minimum-count-and-rounding minimumCount: 5 roundingBase: 5 exactReads: accessProfile: statistics-scopeaccessProfiles: costing-service: permissions: datasets: - dataset: monthly-discharge-reports operations: - read-exactThe statistics-scope profile must see the same records whoever calls. bregctl check refuses it if its visibility depends on the caller (row or membership boundaries, required purposes or consent, or no read access to a record type the dataset depends on), if its list grant does not cover what the dataset filters and groups by, or if it cannot read a sum, mean, percentile, or distinct-count field. A read-exact grant without exactReads is refused with breg.statistical-dataset.exact-reads-missing, exactReads without a read-exact grant with breg.statistical-dataset.exact-reads-unused, and an unknown profile with breg.statistical-dataset.exact-reads-profile-unknown. A standing agent profile cannot hold read-exact (breg.access-profile.standing-agent-read-exact-forbidden, reported at the project profile, or at recordTypes[id=..].accessProfiles[id=..] when the unit profile of that id is the standing agent), and a standing agent or task-grant profile cannot be the exactReads profile (breg.statistical-dataset.exact-reads-profile-agent). The grant works under either disclosure method and needs no publisher, so the sum above, whose release under minimum-count-and-rounding is held for review, is still served exactly.
The exactReads profile is one the project declares or a module contributes to the unit Record type.
exactReads and read-exact grants do not change the definition digest.
The consumer reads one range of ended periods.
Both from and to are required, because the current period has not ended.
A range that reaches a period that has not ended is refused with 422 statistical_dataset.release_refused and refusal code period-not-ended.
firstPeriod applies as on a live read, and so do the cell and document size limits.
A dataset that depends on the evaluation date accepts one period per request, computed at that period’s reference date:
bregctl api \ '/v1/statistics/monthly-discharge-reports:exact?accessProfile=costing-service&from=2025-01&to=2025-03' \ --url "$BREG_URL" \ --token-file "$CONSUMER_TOKEN_FILE"Accept selects JSON or CSV, as on a live read.
The document carries exact, with evaluatedAt and the caller’s accessProfile, in place of live.
It has no release and no disclosure, and its statuses are exact and not-applicable only.
Each read is audited with the operation read-exact, the caller’s profile, and the requested range in clear (periodFrom, periodTo).
The Rust client offers statistics_exact and the Node.js client offers statisticsExact, each taking the range as from and to.
The Python client offers statistics_exact, taking the range as from_period and to_period.
Each also takes the access profile and format options of the live read.
The output is as sensitive as the records. It discloses cells of one and exact sums, and BReg cannot control what the consumer does with it. Grant read-exact to one named service under a data-sharing agreement that names the legal basis, the purpose, no onward disclosure, what the consumer may publish from its results, retention, and breach notice. Widening the exactReads profile’s list grant widens every exact read, so review a change to that profile as a disclosure decision.
BREG-RES-25 records this residual risk.
Review what a release discloses
Section titled “Review what a release discloses”A release is disclosed under the method the dataset’s disclosure.type names.
Minimum count and rounding
Section titled “Minimum count and rounding”A release under minimum-count-and-rounding suppresses positive counts below minimumCount and rounds the rest to the nearest multiple of roundingBase, halves up. Exact zeros stay zero, and each total is transformed on its own, so totals need not equal the sum of visible cells. A distinct-count cell is transformed on its own value, independently of the record count of the same cell, so a cell can show 10 parcels and a suppressed number of owners. A released sum follows the rules in Release sums.
Suppression does not keep a cell unknown. With minimum five and base five, two suppressed cells under a published total of ten must each be four. The minimum counts records, not people, so a cell can describe fewer subjects than the minimum. A suppressed cell at minimum two holds exactly one. A count below half the rounding base publishes as zero with status rounded. BReg applies no privacy budget across versions; dimensions, cadence, and readers remain your institution’s disclosure decision.
For every base cell and every margin, an exact zero stays zero with status exact, a positive count
below minimumCount becomes null with status suppressed, and every other count rounds to the
nearest multiple of roundingBase with status rounded, including a rounded zero.
True counts exist only during computation; release storage keeps the transformed document, its
digest, and lifecycle metadata.
The compiler checks only that each parameter is at least two. Three limits stay with the dataset’s author:
minimumCountis a threshold on unit rows, not on distinct people or organisations. Where one subject can hold several unit rows, a published cell can describe fewer subjects than the threshold.- A suppressed cell holds one through
minimumCountminus one. At the floor of two,suppressedmeans exactly one. - The two parameters are not checked against each other.
A count from
minimumCountup to, but not including, half ofroundingBasepublishes as zero with statusrounded, which its status tells apart from an exact zero. With minimum two and base five, a rounded zero is exactly two. AroundingBaseof at most twiceminimumCountproduces no rounded zero.
Seven positive suppressed cells under a rounded total of five pin every cell to one. Deterministic rounding also permits differencing between releases or overlapping populations, and exact zeros disclose absence and can disclose group attributes. Review each dataset’s population, dimensions, release cadence, and auxiliary information before you grant readers access.
Exact public values
Section titled “Exact public values”A register of public facts, such as licensed facilities or registered cooperatives, has nothing to protect, and suppression only makes its figures wrong. Declare type: exact-public-values and a release carries the exact value of every measure (counts, sums, means, distinct counts, ratios, and percentiles), with no suppression and no rounding:
disclosure: type: exact-public-valuesThe dataset compiles only when these are all classified public:
- the unit Record type
- every field the dataset reads: population, period, dimension, and measure fields
- every source Record type of a derived field the dataset reads
Otherwise bregctl check refuses with breg.statistical-dataset.exact-release-not-public, one diagnostic per item to reclassify.
The Record type’s own classification counts because membership of a register is itself disclosed: an exact count of one says a record exists.
A derived field’s source Record types count because a derived field labelled public can read restricted inputs.
Reclassifying is a visible, reviewable act. There is deliberately no switch that turns protection off without it.
The publisher rules do not change: under either method, the publisher must be able to read each sum, mean, percentile, or distinct-count field.
BReg checks the classification labels, not whether the data is in fact public.
A Record type or field wrongly classified public is released exactly, including cells of one.
Readers can copy the immutable release, and withdrawal erases only the engine’s stored content.
BReg also trusts a derived relation’s SQL to read only the source Record types it declares.
The check is per Record type, not per column.
So a derived field classified public whose SQL reads a restricted field of a public Record type is released exactly.
Review a classification change as a disclosure decision, and review a derived field’s SQL before you classify it public.
Keep minimum-count-and-rounding for any register whose membership is not public.
BREG-RES-24 records this residual risk.
Publish an ended period
Section titled “Publish an ended period”Obtain publisher and reader tokens into separate absolute,
owner-only files. The commands on this page use a dataset monthly-discharge-reports, published by
statistics-publisher and read by statistics-reader. BReg has no release scheduler; your own
scheduler or CI runs this command with a fresh token:
bregctl statistics publish \ --breg-url "$BREG_URL" \ --access-token-file "$PUBLISHER_TOKEN_FILE" \ --dataset monthly-discharge-reports \ --period 2025-01 \ --status final \ --profile statistics-publisher \ --idempotency-key monthly-discharge-reports-2025-01-final-1The response names the version, definition digest, content digest, and snapshot. Reuse the key to retry the same publication; choose a new key for a correction. A current or future period, or one before firstPeriod, is refused.
Publication and withdrawal require an Idempotency-Key, scoped to the caller like every BReg
mutation key.
An identical retry under the same current authority returns the retained status, headers, and body
without creating another version, for retention.receiptRetentionDays after the first commit.
After that the retry returns 410 idempotency.expired and creates nothing.
Binding the key to a different request returns 409 idempotency.key-reused.
Read a series
Section titled “Read a series”A reader names its profile with accessProfile and a period range. Ask for text/csv to receive period, periodStart, periodEnd, one column per dimension, measure, value, and status:
bregctl api \ '/v1/statistics/monthly-discharge-reports/releases:series?accessProfile=statistics-reader&from=2025-01&to=2025-03&status=final' \ --url "$BREG_URL" \ --token-file "$READER_TOKEN_FILE" \ --accept text/csvA suppressed value is blank, not zero, and a period without a release has no cells.
A JSON document lists the declared measures in dataset.measures.
Each cell names its measure in measure, with one cell per period, dimension combination, and measure.
A mean, a ratio, or a percentile is read live or exactly, or in a release under exact-public-values.
A sum can be read the same ways, and in a release under minimum-count-and-rounding once its rules are reviewed.
A sum’s, a mean’s, a ratio’s, and a percentile’s value is a decimal string such as "1234.50", not a JSON number.
It has exactly the measure’s scale digits after the point, and a count stays an integer.
A mean or a percentile over no values, and a ratio with a zero denominator, has a null value and the status not-applicable.
A release under minimum-count-and-rounding uses exact, suppressed, and rounded, and a suppressed sum has no value.
A release under exact-public-values uses exact and not-applicable only.
The status vocabulary can grow, so treat an unknown status as no usable value.
List and withdraw releases
Section titled “List and withdraw releases”GET /v1/statistics/<dataset>/releases lists version headers of the active definition, newest first, up to 100 a page ($top, $skiptoken), withdrawn versions included.
Withdrawal deletes a version’s stored content but keeps its header and reason. It cannot recall a copy a reader already downloaded. The reason is computation-error, source-data-error, or disclosure-risk:
bregctl statistics withdraw \ --breg-url "$BREG_URL" \ --access-token-file "$PUBLISHER_TOKEN_FILE" \ --dataset monthly-discharge-reports \ --period 2025-01 \ --version 1 \ --reason computation-error \ --profile statistics-publisher \ --idempotency-key monthly-discharge-reports-2025-01-withdraw-1A direct read of that version then returns 410 with the reason, and a latest read falls back to the previous eligible version. Every package installs the release store, and the runtime database role cannot update or delete it, so keep the separate migration credential.
The database records the withdrawal and deletes the content in one fixed PostgreSQL function, and
the immutable version header remains.
A direct read of the withdrawn version returns 410 statistical_dataset.version_withdrawn with the
reason code.
A second withdrawal is refused, and an identical idempotent retry returns its original response.
A withdrawn header omits contentDigest in the withdrawal response, in its audit entry, and in every
later listing.
The digest is an unsalted hash of a document whose members other than the cells can be derived from
the header and the dataset metadata, so serving it would let a reader confirm guessed cell values
offline after the content is gone.
The stored header row and the publication’s own audit entry keep the digest for operators, and an
identical retry of the publication returns the response the publisher first received.
Representations
Section titled “Representations”Live and series reads use from and to, and a series and an exact read require both.
Latest and series reads accept status=final.
Header listing accepts $top from one through 100 and an opaque $skiptoken.
The cursor binds the activation, dataset definition, selected profile, principal, purpose, and page
size, so reauthorise before you open it.
Listings order periods newest first, then versions newest first, and a consumer should tolerate
concurrent publications while paging.
A document contains dataset, periods, dimensions, and cells, plus live, exact, or
release metadata.
A released document also describes disclosure.
Under minimum-count-and-rounding that is an object with method, minimumCount, roundingBase,
roundingRule, and totals.
A dataset that releases a sum adds contributor, dominanceRule, and sumTotals, but never the
dominance percentage.
Under exact-public-values it is exactly {"method": "exact-public-values"}.
dataset.measures lists the declared measures in declared order:
- a count has
idandtype - a sum and a mean have
id,type,field, andscale, where a sum’s scale is its field’s scale, 0 for anint64field - a distinct count has
id,type, andfield - a ratio has
id,type,numerator,denominator, andscale - a percentile has
id,type,field,percentile, andscale
A cell contains period, its dimension codes, measure (a measure id), value, and status.
There is one cell per period, dimension combination, and measure.
A released series represents missing periods explicitly and does not invent cells for them.
The type of value follows the measure type and nothing else.
A count and a distinct count are JSON integers, and an empty cell is 0.
A sum, a mean, a ratio, and a percentile are decimal strings such as "1234.50", also when the field
is an integer.
A sum is a string because it can pass 2^53, where a JSON number stops being exact.
The string matches ^-?(0|[1-9][0-9]*)(\.[0-9]+)?$ and has exactly scale digits after the point.
A sum of an int64 field has scale 0, so its string has no decimal point.
value is null when a count or a sum is suppressed, when a mean or a percentile has no values, or
when a ratio’s denominator is zero.
A record whose field has no value is left out of a sum and a mean.
The sum of a cell with no values is zero at the measure’s scale, such as "0.00", with status
exact.
In a protected release, such a cell with fewer than minimumCount contributors is suppressed instead.
The mean of a cell with no values has a null value and the status not-applicable, because there is
no value and nothing was withheld.
Otherwise the mean is rounded half away from zero to scale digits.
The mean of a total (_T) is the total sum divided by the total number of values, not a mean of the
cells’ means.
PostgreSQL computes every value, totals included, in exact decimal arithmetic.
The statuses are exact, suppressed, rounded, and not-applicable.
The vocabulary can grow, so treat an unknown status as no usable value, rather than fail or guess.
An absent or unmatched Accept header selects JSON.
Use Accept: application/json or Accept: text/csv for live, exact, latest, version, and series
reads.
CSV follows RFC 4180 quoting with these columns:
period,periodStart,periodEnd,<dimension field IDs...>,measure,value,statusThe CSV value column carries a decimal string as it is, and is empty for a null value.
Suppressed values are blank in CSV.
Plot periodStart against value, filter on measure and dimension codes before plotting, and keep
status so a blank cell cannot be mistaken for zero.
Release listings and mutation responses are JSON.
Stored JSON is canonicalised with RFC 8785 and hashed with SHA-256.
Repr-Digest uses RFC 9530 syntax and hashes the exact response bytes, so a CSV digest differs from
its JSON digest.
Responses send Cache-Control: no-store and Vary: authorization, accept, without a strong ETag.
Statistical dataset routes lists the routes.
Operate statistical releases
Section titled “Operate statistical releases”Release tables are engine-owned and installed in every package. The runtime can insert and select headers and content and select withdrawals, but it cannot update or delete those tables. Only the migration-owned withdrawal function can delete content, while it records the withdrawal. Catalog verification covers that function’s owner, body, language, volatility, privileges, and fixed search path.
Every protected request has an audit attempt before database I/O and an accepted terminal entry
before bytes are returned.
A publication or withdrawal whose commit fails, or whose deadline passes while the commit is in
flight, has no proven outcome.
It returns 503 source.unavailable and appends no terminal entry, so its attempt is answered
unfinished, never refused.
Retry with the same Idempotency-Key: a write that did commit returns its retained response.
Audit entries contain keyed references and lifecycle metadata, never cell values or unit counts.
Aggregate reads add no individual subject access-log hits.
A computation consumes the HTTP request deadline, including pool acquisition, locks, the grouped statement, and persistence. The statement budget is capped at 30 seconds. BReg has no release cache and no background scheduler: schedule the publish command from your institution’s cron or CI with a token file. A dashboard reader needs an OAuth client that can satisfy the deployed issuer and the selected profile, so verify that authentication journey for your dashboard connector before you configure it.
The statistical API is a native aggregate-document API with standard JSON, CSV, HTTP digest, and calendar conventions. It does not implement the full SDMX REST API or a JSON-stat representation.
Cookies on Registry Stack
We use optional cookies to understand how you use the main Registry Stack website and this documentation. If you contact us, we may link this activity to your enquiry. You can change your choice at any time. Read the privacy policy.
Your browser asks sites not to track you, so optional tracking stays off.
We could not use or save that choice. Optional tracking remains off.