Skip to main content

pdpc-decisions

GitHub last commit Build Status Docker Cloud Automated build PyPI version

This package contains utilities which allow you to create a corpus of decisions from the Personal Data Protection Commission of Singapore's Data Protection Enforcement Cases.

The primary use of such a corpus is for studying, possibly using data science tools such as natural language processing.

It currently has the following features:

  • Visit the Personal Data Protection Commission of Singapore's Data Protection Enforcement Cases and compile a table of decisions with information from the summaries provided by the PDPC for each case.
  • Save this table of decisions as CSV
  • Download all the PDF files of the decisions from the PDPC's website. If the decision is not a PDF, collects the information provided on the decision web page and saves it as a text file.
  • Convert the PDF files into text files

Features provided by scraper

  • Published date
  • Respondent
  • Title
  • Summary
  • URL of PDF of decision

The features are discovered by passing --extras to the command.

  • [Extras] Citation
  • [Extras] Basic enforcement information (Financial penalty, warning, directions)
  • [Extras] References (referred by, referring to)

What pdpc-decisions uses

  • Python 3
  • PDF Miner
  • Selenium
  • Chrome
  • spaCy

Installation

Docker Image

I dockerised the application for my personal ease of use. It is probably the easiest and most straight-forward way to use the application and I recommend it too. The dockerised application also contains all pre-requisites so there is no need for any manual installs.

You need to have docker installed. Pull the image from docker hub.

docker pull houfu/pdpc-decisions

After that you can run the image and pass commands and arguments to it. For example, if you would like the application to do all actions.

docker run houfu/pdpc-decisions all

This isn't clever because downloads will be stored in the docker image and not easily accessed. Bind a volume in your filesystem and use the --root option to direct the application to save the files there. For example:

docker run \ 
  --mount type=bind,source="$(pwd)"/target,target=/code/download \ # Target directory must exist!
  houfu/pdpc-decisions \
  all \
  --root /code/download/

Local install

  • Install via PIP
pip install pdpc-decisions
  • Once the package is installed, used the command line tool pdpc-decisions to use the script.

  • If necessary, install Chrome and ChromeDriver for Selenium to work.

The main entry point for the script is pdpcdecision.py

Usage

The script accepts the following actions and options:

Accepts the following actions.

"all" Does all the actions (scraping the website, saving a csv, downloading all files and creating a corpus).

"corpus" Converts PDF format of decisions into plain text files.

"csv" Save the items gathered by the scraper as a csv file.

"files" Downloads all the decisions from the PDPC website into a folder.

Options:

--csv FILE Filename for saving the items gathered by scraper as a csv file. [default: scrape_results.csv]

--download DIRECTORY Destination folder for downloads of all PDF/web pages of PDPC decisions [default: download/]

--corpus DIRECTORY Destination folder for PDPC decisions converted to text files [default: corpus/] -r, --root DIRECTORY Root directory for downloads and files [default: Your current working directory]

--extras/--no-extras Add extra features to the data collected. This increases processing time. This feature is ignored if action is files or downloads. (Experimental and requires reading of actual decisions) [default: False, '--no-extras']

--extra-corpus/--no-extra-corpus Enable experimental features for corpus. This increases processing time.

--verbose Verbose output

--help Show this message and exit.

Contact

Feel free to let me have your suggestions, comments or issues using the issue tracker or by emailing me.

It would also be nice to hear how you have used this corpus by using the above contacts.

Metadata

Release files for pdpc-decisions 1.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pdpc-decisions 1.3.2
File Size Uploaded
pdpc-decisions-1.3.2.tar.gz 21.1 kB Details

Release files / pdpc-decisions-1.3.2.tar.gz

Download URL pdpc-decisions-1.3.2.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6023348d70f4edd81acfb85820d049fef60c3f64d9470bc99db6f1c9dc57fb5e
BLAKE2b-256 checksum
How to use checksums
d7aeb7521145f9be4f6352ecf313ac32a7c9d6fc962bee44f23cb1593fb88e62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.8.0 tqdm/4.47.0 CPython/3.8.1

Release history Release notifications | RSS feed

This release

1.3.2 This release

1 release file

1.3.1

1 release file

1.3.0

1 release file

1.2.2

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

2 release files

1.0.2

1 release file

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page