-
Notifications
You must be signed in to change notification settings - Fork 1
Reconcile SKR03 and SKR04 datasets with DATEV 2026 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JUVOJustin
wants to merge
10
commits into
scka-de:main
Choose a base branch
from
JUVOJustin:agent/fix-skr03-skr04-dataset
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
09671bc
Reconcile SKR datasets with DATEV 2026 charts
JUVOJustin 4c38e20
Restore verified SKR cross-references
JUVOJustin 1272c83
Validate MCC and account metadata integrity
JUVOJustin a88ab73
Document MCC sources and correct network ranges
JUVOJustin 388f7a3
Complete DATEV 2026 dataset reconciliation
JUVOJustin 1f7c6b3
Fix chart-verified dataset defects; add DATEV verification tooling
JUVOJustin af2f068
Re-anchor MCC mapping and SKR04 VAT metadata after relabeling
JUVOJustin 54a078a
Fix remaining stale gruppe/typ metadata via exhaustive audit
JUVOJustin fd8195f
Add prepare script so installs from git build dist/
JUVOJustin bac1dfa
Audit remaining semantic axes: notes, conditions, and VAT contradictions
JUVOJustin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| # Verifying the datasets against the official DATEV charts | ||
|
|
||
| The SKR03/SKR04 datasets in this package claim to match the official DATEV | ||
| charts. `scripts/verify-datev.mjs` makes that claim testable: it parses the | ||
| official DATEV chart PDFs and checks every account in | ||
| [`src/data/skr03.json`](../src/data/skr03.json) and | ||
| [`src/data/skr04.json`](../src/data/skr04.json) against them. | ||
|
|
||
| Use it whenever the datasets change, and — most importantly — when a **new | ||
| chart year** is published, to find every account whose number, reservation | ||
| status, or designation changed. | ||
|
|
||
| ## 1. Download the charts from DATEV | ||
|
|
||
| DATEV publishes the chart PDFs publicly: | ||
|
|
||
| | Chart | Document | DATEV Art.-Nr. | | ||
| |---|---|---| | ||
| | SKR 03 | "DATEV-Kontenrahmen Standardkontenrahmen – Prozessgliederungsprinzip (SKR 03)" | 11174 | | ||
| | SKR 04 | "DATEV-Kontenrahmen Standardkontenrahmen – Abschlussgliederungsprinzip (SKR 04)" | 11175 | | ||
|
|
||
| Find them via [datev.de](https://www.datev.de) (search for "Kontenrahmen | ||
| SKR 03" / "SKR 04" or the Art.-Nr.) and download the PDF for the year you want | ||
| to verify against. Save both files into a `datev/` folder in the repository | ||
| root, e.g.: | ||
|
|
||
| ``` | ||
| datev/skr03-2026.pdf | ||
| datev/skr04-2026.pdf | ||
| ``` | ||
|
|
||
| > **Never commit these PDFs.** They are DATEV's copyrighted documents | ||
| > ("Eigenformular, Nachdruck – auch auszugsweise – nicht gestattet") and must | ||
| > stay out of the repository. The `datev/` folder is gitignored for that | ||
| > reason. This is also why CI cannot run this check — it is a local, | ||
| > deterministic end-to-end test. | ||
|
|
||
| ## 2. Run the verification | ||
|
|
||
| ```bash | ||
| npm ci | ||
| npm run verify:datev -- datev/skr03-2026.pdf datev/skr04-2026.pdf | ||
| ``` | ||
|
|
||
| Exit code `0` means both datasets are fully consistent with the charts. A | ||
| clean run looks like: | ||
|
|
||
| ``` | ||
| SKR03: chart has 2149 named + 1214 reserved accounts; dataset 286 accounts, 286 verified, 0 findings | ||
| SKR04: chart has 2329 named + 1451 reserved accounts; dataset 222 accounts, 222 verified, 0 findings | ||
| ``` | ||
|
|
||
| For every dataset account the script checks that: | ||
|
|
||
| 1. the account **number exists** as a named account in the chart, | ||
| 2. the number is **not marked `R` (reserved)** in the chart, and | ||
| 3. the dataset **designation matches** the chart designation | ||
| (whitespace-, hyphenation- and footnote-normalized, case-insensitive). | ||
|
|
||
| It does **not** verify the enriched metadata (`typ`, `gruppe`, | ||
| `ust_relevant`, `steuerschluessel`, MCC suggestions) — the chart PDFs do not | ||
| carry that information in machine-checkable form. Structural rules for those | ||
| fields live in `tests/data_integrity.test.ts`. | ||
|
|
||
| ## 3. Upgrading to a new chart year | ||
|
|
||
| 1. Download the new year's PDFs (see above) into `datev/`. | ||
| 2. Run the script against them. Every finding is an account whose number was | ||
| freed/reserved or whose designation changed in the new year. | ||
| 3. Update `src/data/skr03.json` / `src/data/skr04.json` accordingly | ||
| (designations must be copied verbatim from the chart), and review the | ||
| enriched metadata of every changed account by hand. | ||
| 4. Bump `meta.version`, `meta.source`, and `meta.last_updated` in both data | ||
| files. | ||
| 5. Re-run the script until it is clean, then run `npm test`. | ||
|
|
||
| ## How the parser works (maintenance notes) | ||
|
|
||
| The chart PDFs are two-column pages; each half-page column is | ||
| `sidebar | function code | account number | designation`. The parser | ||
| (`scripts/verify-datev.mjs`, using the [`mupdf`](https://www.npmjs.com/package/mupdf) | ||
| WASM bindings as a dev dependency) reconstructs words with x/y positions and | ||
| applies the chart's layout grammar: | ||
|
|
||
| - **Per-page calibration**: the left number column x is the mode of all | ||
| 4-digit token positions in a fixed band; the right column sits a constant | ||
| offset (`HALF_OFFSET`) to its right. Pages with fewer than 10 number tokens | ||
| (title, legend, footnotes) are skipped. | ||
| - **Zones**: only words within `ZONE_WIDTH` right of a number column belong | ||
| to that column's entries; this excludes the neighbouring sidebar. | ||
| - **Entries**: a line starting with a 4-digit number (optionally prefixed by | ||
| a DATEV function code such as `AM`, `AV`, `F`, `K`, `R`, `S`) starts an | ||
| account; following lines in the zone are designation continuations. | ||
| `R`-rows without text are reserved numbers; `-NN` tokens extend an entry to | ||
| a number range (e.g. `3300 -09`). | ||
| - **Headings**: bold lines that neither start an entry nor continue a bold | ||
| entry are section headings and end the current entry. (DATEV prints main | ||
| accounts bold too, so boldness alone does not identify a heading.) | ||
| - **Cleanup**: footnote markers (`Rücklagen17)`) are stripped and hyphenated | ||
| line wraps (`gegen-` + `über`) are rejoined. | ||
|
|
||
| If DATEV changes the page geometry in a future year, re-derive the constants | ||
| at the top of the script (they are documented inline) by dumping word | ||
| positions for one page. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| { | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "$id": "https://github.com/german-accounting/skr04.schema.json", | ||
| "title": "SKR04 Kontenrahmen", | ||
| "description": "German Standard Chart of Accounts (Standardkontenrahmen 04) with enriched metadata", | ||
| "type": "object", | ||
| "required": ["meta", "klassen", "konten"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "meta": { | ||
| "type": "object", | ||
| "required": ["version", "source", "last_updated"], | ||
| "properties": { | ||
| "version": { "type": "string" }, | ||
| "source": { "type": "string" }, | ||
| "last_updated": { "type": "string" }, | ||
| "description": { "type": "string" } | ||
| } | ||
| }, | ||
| "klassen": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "object", | ||
| "required": ["klasse", "name"], | ||
| "properties": { | ||
| "klasse": { "type": "integer", "minimum": 0, "maximum": 9 }, | ||
| "name": { "type": "string" } | ||
| } | ||
| } | ||
| }, | ||
| "konten": { | ||
| "type": "array", | ||
| "items": { "$ref": "#/$defs/Konto" } | ||
| } | ||
| }, | ||
| "$defs": { | ||
| "Konto": { | ||
| "type": "object", | ||
| "required": ["konto", "name", "klasse", "typ", "gruppe", "ust_relevant", "steuerschluessel"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "konto": { | ||
| "type": "string", | ||
| "pattern": "^\\d{4}$", | ||
| "description": "4-digit account number, zero-padded" | ||
| }, | ||
| "name": { "type": "string", "minLength": 1 }, | ||
| "klasse": { "type": "integer", "minimum": 0, "maximum": 9 }, | ||
| "typ": { | ||
| "type": "string", | ||
| "enum": ["aufwand", "ertrag", "aktiv", "passiv"] | ||
| }, | ||
| "gruppe": { "type": "string", "minLength": 1 }, | ||
| "untergruppe": { "type": "string" }, | ||
| "ust_relevant": { "type": "boolean" }, | ||
| "steuerschluessel": { | ||
| "type": "array", | ||
| "items": { "type": "integer" } | ||
| }, | ||
| "skr03": { | ||
| "oneOf": [ | ||
| { "type": "string", "pattern": "^\\d{4}$" }, | ||
| { "type": "null" } | ||
| ], | ||
| "description": "Cross-reference to the corresponding SKR03 account number" | ||
| }, | ||
| "notes": { | ||
| "oneOf": [ | ||
| { "type": "string" }, | ||
| { "type": "null" } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The manifest is bumped to 0.2.0, but both the top-level
versionandpackages[""] .versioninpackage-lock.jsonremain 0.1.0. This leaves the committed dependency-tree metadata inconsistent with the package being released and causes tooling that reads the lockfile to report the old package version; regenerate or update the lockfile as part of the version bump.Useful? React with 👍 / 👎.