Skip to content

[#1099] Generate election definition - #1015

Draft
michielp1807 wants to merge 4 commits into
mainfrom
eml110a
Draft

[#1099] Generate election definition#1015
michielp1807 wants to merge 4 commits into
mainfrom
eml110a

Conversation

@michielp1807

@michielp1807 michielp1807 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

DOD checklist

TODO:

  • Add diff tests to prevent unexpected changes, like we did for the 210s
  • Is it correct that max_votes is always an empty tag? Seems to be the case in the files I checked.
  • Do we need to specify a proper managing authority? Seems like the election definitions don't include this for the 110a.
  • Registered party names should not come from the loaded streams, but from the known registered parties that previously registered at the Kiesraad, right? -> part of Implement a standard list of appellations (aanduidingen) to select #1016
  • Including (the relevant part of) the election tree in the definition is still w.i.p. for rust-eml-nl
    • Add the relevant Committees to the election tree
    • Also use Council's NumberOfSeats instead of configuring it in the election config? -> PS/WS don't have the NumberOfSeats specified in the MET currently, maybe add it? -> No, it is the responsibility of the GR/PS/WS to define their own NumberOfSeats -> eventually we should allow them to configure this in e-KS
    • Why is there a municipality NBSB in Den Haag? <Region RegionNumber="9010" RegionCategory="GEMEENTE"> - it doesn't show up in PS23 -> this is the "Nationaal Brief Stembureau"
    • Currently we have an ugly solution to support municipalities that are in both waterschap Fryslan and another waterschap where they are only allowed to export frisian for the part that is in waterschap Fryslan. This is done by duplicating these gemeentes. Perhaps a nicer solution would be to just not export the frysian export allowed for subregions, since we only care about the frisian exports flag on the top level of the election. This would be a small division from what OSV does, but possibly nicer?
    • Make PR for Rust EML NL for MET parsing

Converting MasterElectionTree.xml (MET) => ElectionTree

  • Get top level Region for election ("STAAT" for EK/TK)
  • Get all sub regions (but skip e.g. "PROVINCIAAL_KIESKRING" because we don't use that one?) -> how do we know which regions we want to include? maybe only top, bottom, and those with a relevant committee?
  • Get Committees for the current ElectionCategory

See kiesraad/rust-eml-nl#41 (comment):

  • TK25: STAAT, KIESKRING, GEMEENTE
  • EK23: STAAT, PROVINCIE, STEMBUREAU (in MET: PROVINCIAAL_STEMBUREAU and also KIESCOLLEGE)
  • PS23: PROVINCIE, KIESKRING, GEMEENTE (in MET: PROVINCIAAL_KIESKRING)
  • AB23: WATERSCHAP, KIESKRING, GEMEENTE (in MET: WATERSCHAP_KIESKRING, WATERSCHAP_GEMEENTE)

(MET parsing still needs to be build)

The MET also includes two new region types:

This PR also configures the CI to run cargo clippy and cargo test on the entire workspace.

For PR maintainer

Perform these checks before marking the PR as ready:

  • I have linked the PR to at least one issue.
  • I assigned the PR to myself.
  • I have added a description how to test this PR (see "Review Instructions").
  • I have added documentation where necessary.

For reviewer

  • I have read all code changes.
  • I have audited the code quality.
  • I have tested the changes either or both:
    • locally
    • on the test environment (preferred)
  • I have validated that the PR is functionally correct (use-cases, figma designs, etc.)

Review instructions

image

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown

Sigrid maintainability feedback


🔒Enable security insights in your CI pipeline to detect vulnerabilities early.
Start using Sigrid CI for Security today. Learn more.


✅ You wrote maintainable code and achieved your objective of 3.5 stars.

Show details

Sigrid compared your code against the baseline of 2026-08-27.

👍 What went well?

You fixed or improved 11 refactoring candidates.

Risk System property Location
🔴 Duplication
(Fixed)
src/app/middleware/session.rs line 91-104
src/app/middleware/session.rs line 138-147
🔴 Duplication
(Fixed)
src/core/election/macros.rs line 45-50
src/core/election/macros.rs line 60-65
🔴 Duplication
(Fixed)
src/core/election/regions.rs line 38-47
src/core/election/regions.rs line 121-130
🟠 Unit Size
(Improved)
src/csb/examination/pages/omission/mod.rs
OmissionTarget.render_add_form(FormData<OmissionForm>,QueryParamState,CsbContext,CsbStore)
🟠 Module Coupling
(Improved)
src/core/election/macros.rs
🟡 Unit Size
(Fixed)
src/core/election/regions.rs
ElectoralDistrict.from(Province)
🟡 Unit Size
(Fixed)
frontend/styles/button.css
button.css:button.button, a.button, label.button
🟡 Unit Size
(Fixed)
src/core/election/regions.rs
ElectoralDistrict.from(WaterCouncil)
⚪️ + 3 more

👎 What could be better?

Unfortunately, 14 refactoring candidates were introduced or got worse.

Risk System property Location
🔴 Duplication
(Introduced)
src/app/middleware/session.rs line 94-107
src/app/middleware/session.rs line 141-150
🔴 Duplication
(Introduced)
src/core/election/macros.rs line 44-49
src/core/election/macros.rs line 59-64
🟠 Unit Size
(Introduced)
src/models/eml/eml110a.rs
ElectionConfig.build_election_tree()
🟠 Unit Size
(Introduced)
src/models/eml/eml210.rs
eml210(PgStore,ElectionConfig,PoliticalGroup,CandidateListId,ModelLocale)
🟠 Unit Size
(Introduced)
src/models/eml/eml210.rs
try_into()
🟠 Unit Size
(Introduced)
src/models/eml/mod.rs
ElectionSubcategory.from(ElectionConfig)
🟠 Unit Interfacing
(Introduced)
src/models/eml/eml210.rs
eml210(PgStore,ElectionConfig,PoliticalGroup,CandidateListId,ModelLocale)
🟡 Unit Size
(Introduced)
src/models/eml/eml110a.rs
eml110a(ElectionConfig,Vec<String>)
⚪️ + 6 more

📚 Remaining technical debt

40 refactoring candidates didn't get better or worse, but are still present in the code you touched.

View this system in Sigrid to explore your technical debt

⭐️ Sigrid ratings

System property System on 2026-08-27 Before changes New/changed code
Duplication 5.3 4.9 5.2
Unit Size 3.3 3.3 2.7
Unit Complexity 4.6 5.5 5.5
Unit Interfacing 2.5 1.9 2.0
Module Coupling 3.0 2.6 3.1
Component Independence 5.4 5.5 5.5
Component Entanglement N/A N/A N/A
Maintainability 4.0 3.9 3.9

💬 Did you find this feedback helpful?

We would like to know your thoughts to make Sigrid better.
Your username will remain confidential throughout the process.


View this system in Sigrid

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown

PDF diff summary

Template Input Status
model-h1 model-h1-example-1.pdf 🔵 identical
model-h1 model-h1-example-2.pdf 🔵 identical
model-h1 model-h1-example-3.pdf 🔵 identical
model-h3-1 model-h3-1-example-1.pdf 🔵 identical
model-h3-1 model-h3-1-example-2.pdf 🔵 identical
model-h3-1 model-h3-1-example-3.pdf 🔵 identical
model-h3-2 model-h3-2-example-1.pdf 🔵 identical
model-h3-2 model-h3-2-example-2.pdf 🔵 identical
model-h3-2 model-h3-2-example-3.pdf 🔵 identical
model-h4 model-h4-example-1.pdf 🔵 identical
model-h4 model-h4-example-2.pdf 🔵 identical
model-h4 model-h4-example-3.pdf 🔵 identical
model-h9 model-h9-example-1.pdf 🔵 identical
model-h9 model-h9-example-2.pdf 🔵 identical
model-h9 model-h9-example-3.pdf 🔵 identical
model-i1 model-i1-example-1.pdf 🔵 identical
model-i1 model-i1-example-2.pdf 🔵 identical
model-i4 model-i4-example-1.pdf 🔵 identical
model-i4 model-i4-example-2.pdf 🔵 identical

@michielp1807
michielp1807 force-pushed the eml110a branch 6 times, most recently from 702884e to 9b44ca0 Compare August 25, 2026 09:22
@michielp1807 michielp1807 changed the title Generate election definition [#1099] Generate election definition Aug 27, 2026
@michielp1807 michielp1807 linked an issue Aug 27, 2026 that may be closed by this pull request
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
67.2% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

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.

EML110a: Election Definition

1 participant