Git Product home page Git Product logo

ukpetitionjsontocsv's Introduction

UKPetitionJSONtoCSV

Convert UK Parlimentary Petition data from JSON to CSV format readable in most data packages (Excel, SAS, Tableu, Google Data Studio etc)

This script is provided "AS IS" for the purposes of converting UK Parlimentary Petition data to a CSV format readable in most data processing/visualisation packages (Excel, SAS, Tableu, Google Data Studio etc). This file will create 3 csv files in directory:

  • Signatures by Country
  • Signatures by Region
  • Signatures by Constituency

Please note:

  • Field titles shall be saved as presentend by the UK Parlimentary Petitions data source and as such may require additional editing/scripting to suit your needs
  • This script has been written to be compatible as of April 2022. Pettitions prior to this date may not work with this script without modification.

This script is made available under GNU General Public License v3.0 License, No garuntees are expressed or implied by the author in making this script available.

This script utalises PANDAS which can be found at https://github.com/pandas-dev/pandas and is distributed under BSD 3-Clause License found here: https://github.com/pandas-dev/pandas/blob/main/LICENSE

The author makes ABSOLUTELY NO claims of affilitation with or of rights to the PANDAS project(s) but thanks them for their continued work for the good of the data science community.

Acknowledgement in final outputs that have used this script are appreciated.

Usage Guide

--

Requirements:

  • This module Requires internet access to function and availability of the UK Parlimentary Pettions Website
  • This module requires the ID of the Parlimentary Petition you wish to obtain CSV data from. This can usually be found as the last segment of the Pettition page URL
  • This script requires Pandas to be installed within your python enviroment [ pip install pandas ]

This function is designed to be very simple to use with both a "Manual" and "automated" option available. By default, outputs will be exported to the DIR from which code is being run.

Manual:

In order to use this Function in Manual Mode import this module and call the function without arguments, the script will automaticcaly enable verbose logging and request required information from the user

Automate:

To use the Function in Automatic mode please pass the following Arguments

  • automate (1, 0)
    • Must be set as 1 for automation
  • petitionID (string)
    • The pettition ID for the pettition you wish to convert (ie the last part of the pettition URL)
  • outputName (string)
    • The prefix of output files for easier identification when workingg with multiple petitions
  • CountryOutput (1, 0)
    • Enabled/Disable Output data relating to number of signitures recieved from different Countries
  • RegionOutput = (1, 0)
    • Enabled/Disable Output data relating to number of signitures recieved from different Regions
  • constituencyOutput = (1, 0)
    • Enabled/Disable Output data relating to number of signitures recieved from different Constituencies.
  • verbose = (1, 0)
    • Enabled/Disable Verbose Logging

ukpetitionjsontocsv's People

Contributors

bditto 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.