- Rust 100%
* Add committee element * Make committee attributes public * Add region element * Add region element * Update ElectionTree and add tests * Update region number to match xml short as i16 * Add region test for too many committees to test no more than 3 as xml schema dictates * Update region to uphold maximum 3 committee rule * Add election tree to election definition * Document Committee attributes * Expose region and committee in mod file * Add too many elements error variant to eml error kind * Update expected output of election definition construction * Cargo fmt --all * Update casing on category variants * Fixed failing tests after merge * Document options, translate enums * Move CommitteeCategory and RegionCategory to utils folder like the rest of these kinds of enums * Fix consistency with Box<str> * Fix doc inconsistencies * Fix typo * Add builder methods for region committees * Ensure election tree has at least one region * Fix test so we emit valid ElectionTree * Add ElectionTreeHierarchy, add error conversions for util types * Allow manipulation of region nodes outside tree hierarchy * Clear up usage of region-prefixed region categories --------- Co-authored-by: Tikitikitikidesuka <deesneakygerbil@gmail.com> |
||
|---|---|---|
| .config | ||
| .github | ||
| bin | ||
| eml-nl@ee0a64e92c | ||
| src | ||
| test-files | ||
| .gitattributes | ||
| .gitignore | ||
| .gitmodules | ||
| Cargo.lock | ||
| Cargo.toml | ||
| LICENSE | ||
| README.md | ||
| SECURITY.md | ||
Kiesraad EML_NL Reader/Writer
This is a Rust crate that parses/emits EML_NL XML documents. Within this repository we sometimes interchangeably use EML and EML_NL, but the software only supports the EML_NL specification.
Multiple versions of the EML_NL specification exist. For more details on the specification you can visit the Kiesraad website. For the schema definitions you can also visit the EML_NL repository on GitHub. The version of EML_NL that the current code supports is always linked as a git submodule on this repository as well. This current branch is aiming to support EML_NL versions 1.2.1 and 1.2.2.
This library requires the entire EML_NL file to be available in memory at once and does not support streaming while reading or writing the document. The memory overhead of a parsed document is relatively low however. It is able to parse the entire GR2022 election definitions, candidate lists, counts and results of all municipalties that participated at that time in approximately 5 seconds (a little under 500MB of XML data) on a small laptop. The library should be functional on virtually any supported Rust target (including most desktop and mobile OSes and the web).
Library usage
For information on how to use this library please reference the generated rust docs. For the newest released version you can check these on docs.rs.
Existing EML_NL data
The Kiesraad releases EML_NL documents for each election. To find these, you can visit data.overheid.nl and go to the Kiesraad organization page. Once you find the election you are interested in, you can download the EML_NL documents from the 'Databronnen' page (look for EML in the title of the data source).
Utilities
Aside from the library this repository also includes some helpful tools that use the library to offer separate functionality. These tools are described below.
EML Validator
The EML validator is a validator for EML_NL documents. It will output any
warnings and errors that are contained within a document. If you have a document
with known issues that don't get reported, or if you found an EML_NL file that
incorrectly emits a warning or error, please report an issue. The validator will
also emit the size of a document and its hash. You can also print an internal
representation of the document using the --debug flag and print an emitted
pretty printed document by using the --print flag. For more information about
the capabilities of the validator you can run --help.
eml2csv
This is a direct conversion of the eml2csv tool. This tool can be used to transform the combination of an EML-230b candidate list and EML-510b municipal count document to generate a CSV file in 'osv4-3' format. The input of this tool is a little more flexible, you may provide the required files in any order you want. You also have a couple of options to customize the output format for when you are not working with Excel (omitting the UTF-8 BOM and including a final newline).