Add Eurostat COFOG adapter and Irish budget pilot - #6
Merged
Merged
Conversation
Eurostat publishes general government expenditure by function for every EU member state using COFOG - the classification the budget profile adopted, maintained by the authority that defines it. That makes it the most direct test available of whether the profile holds real fiscal data from outside the US. Ireland 2022: 79 budget lines across 10 COFOG divisions. One defect, the same shape as the areaServed finding from UK Contracts Finder. The budget arithmetic check demanded exact equality between a parent line and the sum of its parts, which no statistical publisher can satisfy. Four of ten Irish divisions failed by 100,000 to 200,000 euro on figures of 10 billion - 0.002%, and rounding rather than error, because Eurostat reports in millions to one decimal place and independently rounded sub-groups cannot sum exactly to an independently rounded division. The check now infers the publisher's rounding unit from the greatest common divisor of the amounts and allows half a unit per figure. It is self-calibrating, so the publisher declares nothing, and real discrepancies are still caught - a fixture 75% out still fails, with the tolerance reported alongside. Deliberately not added: a precision or unit-multiplier field on amount. Eurostat reports in millions and the adapter multiplies to whole euro, which implies precision the source lacks, but the granularity is already recoverable from the data - every figure here is a multiple of 100,000 euro, which is exactly what the tolerance inference reads. A declared field would restate what the numbers say and add one more thing a publisher can omit or get wrong. Two structural traps handled: a TOTAL row sits alongside the breakdown and would double every figure if imported as a line, so it becomes the budget total; and divisions arrive in the same response as their sub-groups, so they nest through isPartOf rather than flattening. administrativeClassification is empty across all 79 lines. Eurostat's publisher is ESA 2010 sector S13, a statistical sector rather than a body, so there is no org chart to join to. Not a defect, but a real limit on what statistical fiscal sources can express. Six datasets now run in the check pipeline.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Eurostat publishes general government expenditure by function for every EU member state using COFOG - the classification the budget profile adopted, maintained by the authority that defines it. That makes it the most direct test available of whether the profile holds real fiscal data from outside the US.
Ireland 2022: 79 budget lines across 10 COFOG divisions.
One defect, the same shape as the areaServed finding from UK Contracts Finder. The budget arithmetic check demanded exact equality between a parent line and the sum of its parts, which no statistical publisher can satisfy. Four of ten Irish divisions failed by 100,000 to 200,000 euro on figures of 10 billion - 0.002%, and rounding rather than error, because Eurostat reports in millions to one decimal place and independently rounded sub-groups cannot sum exactly to an independently rounded division.
The check now infers the publisher's rounding unit from the greatest common divisor of the amounts and allows half a unit per figure. It is self-calibrating, so the publisher declares nothing, and real discrepancies are still caught - a fixture 75% out still fails, with the tolerance reported alongside.
Deliberately not added: a precision or unit-multiplier field on amount. Eurostat reports in millions and the adapter multiplies to whole euro, which implies precision the source lacks, but the granularity is already recoverable from the data - every figure here is a multiple of 100,000 euro, which is exactly what the tolerance inference reads. A declared field would restate what the numbers say and add one more thing a publisher can omit or get wrong.
Two structural traps handled: a TOTAL row sits alongside the breakdown and would double every figure if imported as a line, so it becomes the budget total; and divisions arrive in the same response as their sub-groups, so they nest through isPartOf rather than flattening.
administrativeClassification is empty across all 79 lines. Eurostat's publisher is ESA 2010 sector S13, a statistical sector rather than a body, so there is no org chart to join to. Not a defect, but a real limit on what statistical fiscal sources can express.
Six datasets now run in the check pipeline.