<jupyter_start><jupyter_text>Enrich the nodes<jupyter_code>eclis = list(cases['ecli'])
nodes_enriched = []
eclis_enriched = set([c['ecli'] for c in nodes_enriched])
len(eclis_enriched)
batch_size = 1000
for i in range(0, len(eclis), batch_size):
    print(i)
    batch = set(eclis[i:i+batch_size]).difference(eclis_enriched)
    nodes_enriched += caselawnet.enrich_eclis(batch, 
                                               rootpath='/media/sf_VBox_Shared/CaseLaw/OpenDataUitspraken/')
len(eclis), len(nodes_enriched)
nodes_enriched_df = pd.DataFrame(nodes_enriched)
nodes_enriched_df.head()
nodes_enriched_df.to_csv(os.path.join(outpath, 'hr_enriched_nodes_1.csv'), index=False)
cases_merged = cases.merge(nodes_enriched_df[['ecli', 'subject', 'creator', 'year', 'date', 'abstract']], on='ecli')
cases_merged['creator'] = [c['creator_x'] if c['creator_x'] else c['creator_y'].split('/')[-1].replace('_', ' ')
                           for i, c in cases_merged.iterrows()]
cases_merged = cases_merged[['id', 'ecli', 'title', 'subject', 'creator', 'year', 'date', 'abstract']]
cases_merged.head()
cases_merged.to_csv(os.path.join(outpath, 'hr_enriched_nodes_2.csv'), index=False)
links = links.rename(columns={'link_id': 'id'})
cases_network, links_network = caselawnet.network_analysis.add_network_statistics(
    cases_merged.to_dict(orient='records'), links.to_dict(orient='records'))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1649048625792812, 'fraction_numerical': 0.005637773079633545, 'mean_word_length': 5.794258373205742, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '524301', 'license': 'Apache-2.0', 'n_tokens_mistral': 547, 'n_tokens_neox': 513, 'n_words': 74, 'path': 'notebooks/archived/HR_network_from_sparql.ipynb', 'repo_name': 'caselawanalytics/case-law-research', 'size': '1419'}