Skip to content

Feat/layout export enumeration values - #352

Merged
andres-sole merged 11 commits into
masterfrom
feat/layout-export-enumeration-values
Sep 11, 2026
Merged

andres-sole merged 11 commits into
masterfrom
feat/layout-export-enumeration-values

Conversation

@antonio-olleros

Copy link
Copy Markdown
Contributor

Summary

Several fixes to the Excel Export to be deployed in PROD to the DPM Studio

Checklist

  • Code quality checks pass (ruff format, ruff check, mypy)
  • Tests pass (pytest) with 100% branch coverage (coverage report --fail-under=100)
  • Documentation updated (if applicable)

Impact / Risk

  • Breaking changes? (public API / CLI / REST endpoints / Django models) no
  • Database schema or migration concerns? no
  • Notes for release/changelog? no

An enumerated cell's comment now lists the values that may be reported
in it, as "(signature) label", indented by hierarchy level.

The values come from the SubCategoryVersion of the header bounding the
cell — a variable carries no value list of its own, and
VariableVersion.subcategory_vid is unpopulated. Open tables key their
rows off a column and their sheets off the Z header; both now carry
the list, and key cells of open-row tables get a comment at all for
the first time.

Codes and signatures are release-versioned, so they are read in the
release window of the version being exported (the module version's,
or the table version's outside a module): of the versions starting
inside the window the latest wins, and when none starts inside, the
one in force when the window opened is used. That criterion now drives
every ItemCategory and PropertyCategory lookup of the exporter, which
until now always read the currently-active row and so showed today's
codes on an older release's workbook.

Comment boxes grow with their content, and a tooltip is cut on a line
boundary at 30,000 characters: Excel rejects a longer comment and asks
to repair the whole workbook.
@andres-sole
andres-sole requested a review from ruizmaa September 7, 2026 15:43
A table under construction has cells before it has variables, and the
exporter depended on them entirely: a reportable cell without one fell
through every branch of the writer and came out blank with a border,
an open table's rows went grey as if nothing were reportable, and key
columns lost their fill.

The datapoint each cell is meant to hold is knowable without the
variable. Its property is the one on the header bounding it — the
column's, else the row's, else the sheet's, which matches the
variable's property in 314,207 of the 314,255 cells of the 4.2.1
dictionary — and its dimensions are those headers' categorisations
plus the table's own, which reproduces the variable's context exactly
in 99.7% of them. Key headers name their own property (821 of 821).

Cells are therefore completed from the table structure: data type,
domain, dimension tooltip and the possible values of enumerated cells
all appear, and key columns stay keys. They are shaded (FDE9D9) and
say so in their comment, the body starts at the data type since there
is no variable id to show, and the index sheet counts what is still
pending. Identities stay absent: cells cannot be known to share a
datapoint before the datapoints exist.

ExportConfig.derive_missing_variables turns the fallback off
(--no-derive-missing-variables); cells are then only marked, not
completed. A finished dictionary exports byte for byte as before.
Comment thread src/dpmcore/services/layout_exporter/processing.py
Comment thread src/dpmcore/services/layout_exporter/excel_writer.py Outdated
@guillermo-garcia-1

Copy link
Copy Markdown
Contributor

This PR adds a user-facing CLI flag (--derive-missing-variables/--no-derive-missing-variables) and two new visible export behaviors (possible values in enumerated-cell comments, pending-cell shading/index column), but docs/cli.rst wasn't updated to cover any of them.

@andres-sole

Copy link
Copy Markdown
Collaborator

@guillermo-garcia-1 Added the flag info to the docs

Comment thread src/dpmcore/services/layout_exporter/excel_writer.py
Comment thread src/dpmcore/services/layout_exporter/queries.py Outdated
Comment thread src/dpmcore/services/layout_exporter/excel_writer.py
Comment thread src/dpmcore/services/layout_exporter/processing.py
@andres-sole
andres-sole merged commit d5e945e into master Sep 11, 2026
20 checks passed
@andres-sole
andres-sole deleted the feat/layout-export-enumeration-values branch September 11, 2026 17:15
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.

4 participants