https://github.com/ttitcombe/parliamentarypetitionparser
A handy code wrapper to retrieve and parse data from the UK Parliamentary Petitions website
https://github.com/ttitcombe/parliamentarypetitionparser
choropleth data-mining data-science parliament parliamentary-data political-science politics python uk-politics
Last synced: 9 months ago
JSON representation
A handy code wrapper to retrieve and parse data from the UK Parliamentary Petitions website
- Host: GitHub
- URL: https://github.com/ttitcombe/parliamentarypetitionparser
- Owner: TTitcombe
- License: mit
- Created: 2019-03-27T11:16:30.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-28T08:15:49.000Z (over 6 years ago)
- Last Synced: 2024-12-27T12:11:35.738Z (10 months ago)
- Topics: choropleth, data-mining, data-science, parliament, parliamentary-data, political-science, politics, python, uk-politics
- Language: Python
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ParliamentaryPetitionParser
A handy code wrapper to retrieve and parse data from the [UK Parliamentary Petitions website](https://petition.parliament.uk/).
This code accepts petition numbers, and automatically collects, parses, and saves data associated with that petition.
The data collected and parsed from the petition can be saved in a time-separated manner to allow analysis of the petition's evolution over time.
## Requirements
This repo is written for Python 3. Python 2 compatibility is not guaranteed.
See requirements.txt for a list of python packages this code depends on.
## How To Use
*This repo is in the early stages of development*
1. Clone this repo and install the required packages.
2. Find out the petition number of the petition for which you would like to collect data
3. Find the path to the directory to which you would like data to be saved, *relative to the top-level* **ParliamentaryPetitionParser** *directory*. This defaults to **data/**.
4. In the **ParliamentaryPetitionParser** directory, run `python -m src.petition --petition_number=NUM --output_dir=DIR`,
where NUM is the petition number and DIR is the save directory.
5. Check your output directory location. You will have two files: **constituency** and **country**, which
are prefixed by year_month_day_hour_minute_ and suffixed by the petition number.
You can also set **ParliamentaryPetitionParser** to collect data every X minutes. To do this, run
`python -m src.petition --petition_number=NUM --output_dir=DIR --frequency=X`