Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions emlconv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <set>
#include <filesystem>
#include "sqlwriter.hh"
#include "string.h"
using namespace std;

/* Every election has one or more KIESKRINGs.
Expand Down Expand Up @@ -779,6 +780,43 @@ Regio,RegioCode,OuderRegioCode

// cout<<" uncountedvotes "<<s2.begin()->value()<<", reason: "<<reason<<endl;
}
else if(lname=="kr:ReportingUnitInvestigations") {

for(const auto& s3 : s2) {
string invname = s3.name();
// Extra metadata, used in GR2026
// <kr:ReportingUnitInvestigations>
// <kr:Investigation ReasonCode="toegelaten kiezers opnieuw vastgesteld">false</kr:Investigation>
// <kr:Investigation ReasonCode="onderzocht vanwege andere reden">false</kr:Investigation>
// <kr:Investigation ReasonCode="stembiljetten deels herteld">false</kr:Investigation>
// </kr:ReportingUnitInvestigations>

if(invname== "kr:Investigation") {

string reason = s3.attribute("ReasonCode").value();
string val = "";
if (strncmp(s3.begin()->value(), "true", 4) == 0) {
val = "1";
}
else if (strncmp(s3.begin()->value(), "false", 5) == 0) {
val = "0";
}

if (val[0] != '\0') {
sqw.addValue({{"electionId", electionId},{"kieskring", kieskringName}, {"kieskringHSB", kieskringHSB}, {"kieskringId", kieskringId},
{"formid", formid}, {"gemeente", gemeente},
{"gemeenteId", gemeenteId},
{"stembureau", stembureau},
{"stembureauId", stembureauId},
{"postcode", postcode},{"category", lname},{"kind", reason}, {"value", val}}, "rumeta");
}
}
else
cout<<"Unknown 510 field in ReportingUnitInvestigations: '"<<invname<<"'"<<endl;

}

}
else
cout<<"Unknown 510 field in ReportingUnit: '"<<lname<<"'"<<endl;

Expand Down