Skip to content

DK support multiple years - #258

Open
ivorbosloper wants to merge 1 commit into
mainfrom
split/dk
Open

ivorbosloper wants to merge 1 commit into
mainfrom
split/dk

Conversation

@ivorbosloper

@ivorbosloper ivorbosloper commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

19 years of data, the converter handles the variability

Marknr numbers a field within one application, so on its own it repeats across
holdings — 38 of 100 sampled 2026 rows shared one. From 2014 the source names
the application (Journalnr) and the pair identifies a field; where the
application is missing (70 of 599,008 rows in 2015, the worst edition) the id is
left empty and the row is dropped downstream, rather than every such row sharing
an id of "nan".

The older editions name the applicant instead — Ansoeger until 2011, KUNDE_LB in
2012 and 2013 — and that pair genuinely repeats: 5,124 keys cover 11,534 of the
678,347 fields of 2008, mostly distinct polygons of distinct size. Nothing there
identifies a field, so the row index does, which is safe because an edition is
one file.

2008 and 2009 carry no crop columns at all. The HCAT mixin now returns the frame
untouched when an edition has none, instead of failing on a column it cannot
find, so those two convert as boundaries.

A fixture for 2008 covers the older shape, through an entry of the form
"<id>#<label>" that runs a second edition of one converter from the same folder
of input files.

Nineteen editions (2008-2026) are built and published, 11.4M field-years.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DVx9uQV2QPM8ecPAY3ZjXG
@ivorbosloper ivorbosloper changed the title DK: an id per edition, and two editions with no crop at all DK support multiple years Sep 13, 2026
@ivorbosloper
ivorbosloper requested a review from m-mohr September 14, 2026 07:24
Comment thread fiboa_cli/datasets/dk.py
Comment on lines +38 to +42
if "Journalnr" in gdf.columns:
key = gdf["Journalnr"].astype(str) + ":" + gdf["Marknr"].astype(str)
gdf["id"] = key.where(gdf["Journalnr"].notna() & gdf["Marknr"].notna())
else:
gdf["id"] = gdf.index

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question as usual: Should the IDs be consistent over years?

Comment thread fiboa_cli/datasets/dk.py
gdf["id"] = gdf.index

if "Afgkode" in gdf.columns:
gdf["Afgkode"] = gdf["Afgkode"].astype(float).fillna(value=0).astype(int).astype(str)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks suspicious: float -> int -> str? Why two different numerical types?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants