-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds new field
KeyWord.linked_to_cases
- Loading branch information
Showing
10 changed files
with
178 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -282,6 +282,7 @@ class Meta: | |
"id", | ||
"name", | ||
"part_of", | ||
"linked_to_cases", | ||
] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
archiv/migrations/0020_keyword_linked_to_cases_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Generated by Django 5.0 on 2024-07-08 05:58 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("archiv", "0019_alter_yearbook_options_remove_court_legacy_id_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="keyword", | ||
name="linked_to_cases", | ||
field=models.BooleanField( | ||
default=True, | ||
help_text="can be linked to cases", | ||
verbose_name="can be linked to cases", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="courtdecission", | ||
name="file_number", | ||
field=models.CharField( | ||
blank=True, | ||
help_text="Case number (file number/reference as cited in the given legal system, e.g. '[2010] UKSC 33' for a UK Supreme Court decision or 'VI ZR 548/12' for a German BGH decision)", | ||
max_length=250, | ||
verbose_name="Case number", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "5f8bcf70", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"items = KeyWord.objects.filter(rvn_courtdecission_keyword_keyword=None)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "ca0c2a1b", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"55" | ||
] | ||
}, | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"items.count()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "d860cbdb", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"for x in items:\n", | ||
" x.linked_to_cases = False\n", | ||
" x.save()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "9697abd3", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"data = {}\n", | ||
"for gr, ndf in df.groupby('legal_system__name'):\n", | ||
" data[gr] = ndf.to_dict('records')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "779ed74b", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"for key, value in data.items():\n", | ||
" print(key)\n", | ||
" for x in value:\n", | ||
" print(x[\"name\"])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "f5d743b9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"ndf = pd.DataFrame(new_data).reset_index().rename(columns={0: \"court_decissions\", \"keyword__count\": \"keywords\"})" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "ee0445f9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"ndf" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "c5c34f69", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"for x in Court.objects.filter(orig_data_csv__icontains='gericht_hoechstgericht\": 1'):\n", | ||
" x.is_high_court = True\n", | ||
" x.save()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "e68f2cae", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Django Shell-Plus", | ||
"language": "python", | ||
"name": "django_extensions" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.12" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"cells": [], | ||
"metadata": {}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |