<jupyter_start><jupyter_text>Find all the relevant cases Find the case numbers of Judgements for which a form is present<jupyter_code>#Imports
import numpy as np
import pandas as pd

import json

import functions 
clean = functions.clean()
path = "/Users/conorosully/Documents/Legal-Case-Prediction/data/preclean/forms.json"
import json
with open(path, 'r') as outfile:
    forms = json.load(outfile)
    
forms['law']
# Get attributes
att = pd.read_csv("/Users/conorosully/Documents/Legal-Case-Prediction/data/preclean/case_attributes.csv",'#')
print(len(att))
att.head(1)
id_form = {}
relevant_ID = []
for i in att['id']:
    try:
        case = clean.getCase(i)[i]
    except: 
        print(i)
    form = clean.getForm(case,forms)
    if clean.checkForm(form):
        relevant_ID.append(i) 
        id_form[i] = form
        
        #Add case ID if a form exists
len(relevant_ID)
id_form["HUDOC-ECHR-2009-001-93695"]
path = "/Users/conorosully/Documents/Legal-Case-Prediction/data/preclean/id_form.json"
with open(path, 'w') as outfile:
    json.dump(id_form, outfile)

relevant_ID = pd.Series(relevant_ID,name='ID')
path = "/Users/conorosully/Documents/Legal-Case-Prediction/data/preclean/relevantID.csv"
relevant_ID.to_csv(path,index=False)<jupyter_output>/Users/conorosully/miniconda3/lib/python3.6/site-packages/ipykernel_launcher.py:2: FutureWarning: The signature of `Series.to_csv` was aligned to that of `DataFrame.to_csv`, and argument 'header' will change its default value from False to True: please pass an explicit value to suppress this warning.
{'fraction_non_alphanumeric': 0.12012779552715655, 'fraction_numerical': 0.010862619808306708, 'mean_word_length': 4.418685121107266, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '555269', 'license': 'MIT', 'n_tokens_mistral': 562, 'n_tokens_neox': 533, 'n_words': 122, 'path': 'src/Archive/find_relevant_cases.ipynb', 'repo_name': 'conorosully/legal-case-prediction', 'size': '1565'}