Coder Social home page Coder Social logo

edvinpohto / election-xml-to-csv-parser Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 7 KB

A two part script that takes in an XML file and outputs a CSV file with information about candidate double mandates.

License: MIT License

JavaScript 100.00%

election-xml-to-csv-parser's Introduction

election-xml-to-csv-parser

A two part Node.js script that takes in an XML file about Finnish elections and outputs a CSV file with information about candidate double mandates.

The script can easily be modified to take into account any other data that may be presented in the XML file.

The required XML files can be found on the Tulospalvelu website. From there you can navigate to any of the listed elections, select Tulokset (results), and finally Ladattavat tiedostot (downloadable files) on the right hand side. Presented with the download options, select Tulokset ehdokkaittain (results per candidate) under the XML-teidostot header.

Unzip the file (warning, it may be very large and often contains over a million lines of XML) and place in the same directory as your scripts.

Finally, make sure you set the filepath to your own XML file at the bottom of the main script file. Also create an "output" directory in the same location as your other files where the output CSV file will go.

Run npm install to install relevant dependencies.

Now you can run node nodeXmlParser.js to run the scripts.

Depending on the XML file size the execution may take a while.

election-xml-to-csv-parser's People

Contributors

edvinpohto avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.