# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# + [markdown] pycharm={"name": "#%% md\n"}
# # Let's grab some information
#
# In this notebook, we try our very best to get some key information
# from the text versions of the pdpc decisions.
# This key information is meant to enhance the pdpc decisions database.
#
# ## Table of contents
# 1. Citation
# 2. DP Case Number
# 3. Cases cited in the decision
# 4. Result (warning, directions, penalties)

# + pycharm={"is_executing": false, "name": "#%% \n"}
# We set up the environment

import pandas as pd
import spacy

# %run ../set_up_zeekerDB.ipynb

# +
# We sample some decisions to check if our code is working

sample = data_collection.aggregate(
   [ { "$sample": { "size": 7 } } ]
)

sample_df = pd.DataFrame([ {'id': result['_id'], 'respondent': result['respondent']} for result in sample])

sample_df


# +
def citation_search(text):
    import re
    citation_search = re.compile(r'\s+\[\d{4}]\s+(?:\d\s+)?[A-Z|()]+\s+\d+[\s.]?\s+')
    
    match = re.search(citation_search, text)
    print(match)

    


StarcoderdataJupyterScriptsDedupFiltered