EU CJ pass 19: data/cases-00018.parquet + packs/eu_cj_19 (CoS GO)
Browse files- data/cases-00018.parquet +3 -0
- packs/eu_cj_19/README_ADDENDUM.md +64 -0
- packs/eu_cj_19/SHA256SUMS +19 -0
- packs/eu_cj_19/code.json +117 -0
- packs/eu_cj_19/manifests/MANIFEST.md +60 -0
- packs/eu_cj_19/scrapers/cellar_selection_pack19.json +0 -0
- packs/eu_cj_19/scrapers/collect_cellar_cj19.py +66 -0
- packs/eu_cj_19/scrapers/excluded_celex.json +0 -0
- packs/eu_cj_19/scrapers/minors_text_screen.VERSION +1 -0
- packs/eu_cj_19/scrapers/minors_text_screen.py +50 -0
- packs/eu_cj_19/scrapers/minors_text_screen_README.md +5 -0
- packs/eu_cj_19/scrapers/named_minor_screen.py +97 -0
- packs/eu_cj_19/scrapers/normalize_cellar_cj19.py +193 -0
- packs/eu_cj_19/scrapers/requirements.txt +3 -0
- packs/eu_cj_19/scrapers/sealed_screen.py +19 -0
- packs/eu_cj_19/scrapers/sexual_exploitation_screen.py +76 -0
- packs/eu_cj_19/scrapers/test_minors_text_screen.py +16 -0
- packs/eu_cj_19/scrapers/test_youth_text_screen.py +25 -0
- packs/eu_cj_19/scrapers/youth_text_screen.VERSION +1 -0
- packs/eu_cj_19/scrapers/youth_text_screen.py +35 -0
data/cases-00018.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:20c3555076e9095db44d7e77bed7a52b5002b0d0084f82d8fc2348993bd809e3
|
| 3 |
+
size 1706353
|
packs/eu_cj_19/README_ADDENDUM.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Add-on pack eu_cj_19: Court of Justice of the European Union, English judgments (pack 19)
|
| 2 |
+
|
| 3 |
+
Add-on to `endomorphosis/ipfs_eu_caselaw`, built against live tip a3692604; the actual parent is recorded by the commit. The data file is `data/cases-00018.parquet`. It holds 187 Court of Justice judgments (CELEX `6YYYYCJNNNN`) that have an English xhtml version, with decision dates 2017-01-26 .. 2017-07-26.
|
| 4 |
+
|
| 5 |
+
Some CELEX are listed in `packs/eu_cj_19/scrapers/excluded_celex.json` (3327 distinct CELEX) and were left out, so there is no overlap. The list covers:
|
| 6 |
+
- the live data files cases-00000 .. cases-00017;
|
| 7 |
+
- the selection lists of earlier passes;
|
| 8 |
+
- the decisions fetched in passes 16-18;
|
| 9 |
+
- CELEX excluded by earlier rulings, including the 21 removed by the minors fix pack and 62021CJ0621 (removed by eu_fix_minors_2), plus 62023CJ0460 and 62016CJ0367. None of these are re-added.
|
| 10 |
+
|
| 11 |
+
The columns, parser (eu-cj-1.0), licence label and exclusion rules are the same as in the earlier packs; see the repository README.
|
| 12 |
+
|
| 13 |
+
Selection: the 16 CELEX that pass 18 selected but did not fetch came first. Then one Cellar SPARQL query (LIMIT 799) asked for English xhtml CJ judgments dated 2016-01-01 .. 2017-07-13, newest first. CELEX on the exclusion list were dropped after the query, and the first 199 remaining were kept, so 215 were selected in all. To stay within about 200 pulls in all, only the first 199 were fetched. The other 16 were selected but not fetched and are left for the next pass. Of the 199 fetched, 12 were excluded by the screens and hand reads below, and every other one is included. The query and its SHA256 are in `packs/eu_cj_19/scrapers/cellar_selection_pack19.json`.
|
| 14 |
+
|
| 15 |
+
## Licence
|
| 16 |
+
`EU reuse (2011/833/EU; CURIA statement)`, the same basis as the earlier packs. CURIA: "The texts available on this site may be reproduced provided the source is acknowledged as well as the fact that they are not authentic and are free of charge." Decision 2011/833/EU Art. 6(1): documents are available for reuse without application.
|
| 17 |
+
|
| 18 |
+
**Source acknowledged:** Court of Justice of the European Union (curia.europa.eu), obtained through the EU Publications Office (Cellar). **These texts are not authentic.** Only the versions published in the European Court Reports and the Official Journal of the European Union are authentic. This dataset is provided free of charge.
|
| 19 |
+
|
| 20 |
+
## Exclusions and screens
|
| 21 |
+
Whole decisions are excluded (no redaction) in these cases:
|
| 22 |
+
- family-law matters, from the official title or from the sentence stating what the main proceedings concern;
|
| 23 |
+
- juvenile-justice matters;
|
| 24 |
+
- sexual offences against minors;
|
| 25 |
+
- named minors (shared named_minor_screen v2, rules A and B);
|
| 26 |
+
- the shared sexual_exploitation_screen v1;
|
| 27 |
+
- the English full-text youth screen (youth_text_screen v1);
|
| 28 |
+
- the minors text screen (minors_text_screen v2);
|
| 29 |
+
- the confidential/public-version screen;
|
| 30 |
+
- when in doubt.
|
| 31 |
+
|
| 32 |
+
Every hit of the youth, minors and named-minor screens, and every family-term mention, was read by hand with names masked. The facts-at-the-time rule applies: a person who was a minor at the time of the facts, with health, abuse, care, injury, foster, custody or marriage facts, is excluded, and doubt means exclusion.
|
| 33 |
+
|
| 34 |
+
12 decisions were excluded:
|
| 35 |
+
- 62014CJ0562: health
|
| 36 |
+
- 62015CJ0133: care
|
| 37 |
+
- 62015CJ0499: family: parental responsibility / child abduction / Brussels II
|
| 38 |
+
- 62015CJ0503: family: main proceedings concern divorce / parental responsibility / maintenance
|
| 39 |
+
- 62015CJ0541: custody/adoption
|
| 40 |
+
- 62015CJ0652: custody/child
|
| 41 |
+
- 62016CJ0013: injury
|
| 42 |
+
- 62016CJ0193: abuse
|
| 43 |
+
- 62016CJ0283: family: maintenance / matrimonial / child adoption
|
| 44 |
+
- 62016CJ0578: health
|
| 45 |
+
- 62016CJ0638: care/risk
|
| 46 |
+
- 62017CJ0111: family: parental responsibility / child abduction / Brussels II
|
| 47 |
+
|
| 48 |
+
The other screen hits were read and kept as incidental (VAT legislation on goods or education, the age of information, company names, quoted provisions, benefit rules). They are listed by CELEX in the manifest. Exclusions are logged by CELEX and reason only.
|
| 49 |
+
|
| 50 |
+
## Personal data
|
| 51 |
+
Party names are as published by the Court, which uses initials or pseudonyms in most cases; its anonymisation is kept as-is, and no re-identification was attempted. The PII sweep (national ID numbers with at least 4 digits, IBANs, Luhn-valid card numbers, personal webmail) found nothing to redact in this pack.
|
| 52 |
+
|
| 53 |
+
## Columns
|
| 54 |
+
25 string columns, with the same names and order as cases-00017. Empty columns, per column, in all 187 rows each:
|
| 55 |
+
- `issued`, `subject`, `procedure`, `judges` and `inhoudsindicatie` are null;
|
| 56 |
+
- `parties` is an empty string. It is not extracted, and `parties_note` says so. This is also the case in every row of the earlier EU packs.
|
| 57 |
+
|
| 58 |
+
The other 19 columns have a value in every row.
|
| 59 |
+
|
| 60 |
+
## Provenance and robots
|
| 61 |
+
Cellar SPARQL and document requests ran on 2026-10-29 21:22 PT - 21:29 PT in one session. There were 200 requests (1 query and 199 documents) and 0 failures, with at least 1 s between requests, one connection, https only, and no PDFs. The op.europa.eu robots.txt allows these paths. curia.europa.eu and eur-lex.europa.eu were not crawled. Builders are in `packs/eu_cj_19/scrapers/` (hashes in `packs/eu_cj_19/code.json`).
|
| 62 |
+
|
| 63 |
+
## Disclaimer and takedown
|
| 64 |
+
This dataset is provided for research and is not legal advice. It is not published by or affiliated with the Court of Justice of the European Union or the Publications Office. To have a record removed or corrected, open a discussion on `endomorphosis/ipfs_eu_caselaw` with the ECLI or CELEX number.
|
packs/eu_cj_19/SHA256SUMS
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
20c3555076e9095db44d7e77bed7a52b5002b0d0084f82d8fc2348993bd809e3 data/cases-00018.parquet
|
| 2 |
+
ff0dd6b203dd4b8c053950c61a45ce88b2371df1cb449a126dc52caab2db3241 packs/eu_cj_19/README_ADDENDUM.md
|
| 3 |
+
e5135f48a07b62796d716d6d99bd343287454f20ccefe03ad1355fbc4cc698e8 packs/eu_cj_19/code.json
|
| 4 |
+
99db3e41ad6f9d972ee07ac5a75ae949c8573505165a642107af1fc8d304263e packs/eu_cj_19/manifests/MANIFEST.md
|
| 5 |
+
3277186e7f7da75ff41deb142ca238ccc2b1cb32ee539fd275c5cf9caa57324f packs/eu_cj_19/scrapers/cellar_selection_pack19.json
|
| 6 |
+
6491a1e1cbb8cc0c33fd0c41096d7ae11dd1c55b60718ad290034d605a064915 packs/eu_cj_19/scrapers/collect_cellar_cj19.py
|
| 7 |
+
b5b9a563ceee8a64d68a40f564b0d805afe8b22bba0106094bbee49d9fbc443b packs/eu_cj_19/scrapers/excluded_celex.json
|
| 8 |
+
81db67b6a5702b9b68f0016f061c409bf3fb16d062fc854d1b424bb4e9c28c56 packs/eu_cj_19/scrapers/minors_text_screen.VERSION
|
| 9 |
+
1a2797609693430b3975480d872062ca7b1b27a2d1bf3ec20f466df716484396 packs/eu_cj_19/scrapers/minors_text_screen.py
|
| 10 |
+
03bd2d8045b428430c92fc59adf6a868d86503c93c67100cc2d294c69f636181 packs/eu_cj_19/scrapers/minors_text_screen_README.md
|
| 11 |
+
d9c807d7f6a62e46e3fb2d731c8bb6df0cfc4d9c8fa749eb4679c558914ed954 packs/eu_cj_19/scrapers/named_minor_screen.py
|
| 12 |
+
6597b71238b225b7ab5af2c0d8db280cbfa2672440f1c28785aa3d208d0f8db0 packs/eu_cj_19/scrapers/normalize_cellar_cj19.py
|
| 13 |
+
f19ad9a9cbd67e5ce727c02b778ebd908b55231405c607381e1b0ea435aa5d43 packs/eu_cj_19/scrapers/requirements.txt
|
| 14 |
+
0404cfb5406a156fc0d1a21fecbe15240b4316d35c9e67eda2e472be366cbfa0 packs/eu_cj_19/scrapers/sealed_screen.py
|
| 15 |
+
e2cad85460b8aaa33b685e42a0cadb2df79a53b4c274e5815cc596ac3e7c091e packs/eu_cj_19/scrapers/sexual_exploitation_screen.py
|
| 16 |
+
6a4df5e82cbb5de2defe9ae4215aa69bbb645afe2d75b50ec0a93a4d51498598 packs/eu_cj_19/scrapers/test_minors_text_screen.py
|
| 17 |
+
1898fab147325b1300184321b5c3a29ffff18984a36f286dcf4f7d6e75c2d968 packs/eu_cj_19/scrapers/test_youth_text_screen.py
|
| 18 |
+
2d27fbdf4e8ca207afbfa388ca9172fbcc6c70e534af2476b3b704f87debadcf packs/eu_cj_19/scrapers/youth_text_screen.VERSION
|
| 19 |
+
1c350cdbe3706e44702b86f2b131a3c680edd9d2f52a15e2323b7ef530b6d996 packs/eu_cj_19/scrapers/youth_text_screen.py
|
packs/eu_cj_19/code.json
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"files": [
|
| 3 |
+
"packs/eu_cj_19/scrapers/cellar_selection_pack19.json",
|
| 4 |
+
"packs/eu_cj_19/scrapers/collect_cellar_cj19.py",
|
| 5 |
+
"packs/eu_cj_19/scrapers/excluded_celex.json",
|
| 6 |
+
"packs/eu_cj_19/scrapers/minors_text_screen.VERSION",
|
| 7 |
+
"packs/eu_cj_19/scrapers/minors_text_screen.py",
|
| 8 |
+
"packs/eu_cj_19/scrapers/minors_text_screen_README.md",
|
| 9 |
+
"packs/eu_cj_19/scrapers/named_minor_screen.py",
|
| 10 |
+
"packs/eu_cj_19/scrapers/normalize_cellar_cj19.py",
|
| 11 |
+
"packs/eu_cj_19/scrapers/requirements.txt",
|
| 12 |
+
"packs/eu_cj_19/scrapers/sealed_screen.py",
|
| 13 |
+
"packs/eu_cj_19/scrapers/sexual_exploitation_screen.py",
|
| 14 |
+
"packs/eu_cj_19/scrapers/test_minors_text_screen.py",
|
| 15 |
+
"packs/eu_cj_19/scrapers/test_youth_text_screen.py",
|
| 16 |
+
"packs/eu_cj_19/scrapers/youth_text_screen.VERSION",
|
| 17 |
+
"packs/eu_cj_19/scrapers/youth_text_screen.py"
|
| 18 |
+
],
|
| 19 |
+
"files_sha256": {
|
| 20 |
+
"packs/eu_cj_19/scrapers/cellar_selection_pack19.json": "3277186e7f7da75ff41deb142ca238ccc2b1cb32ee539fd275c5cf9caa57324f",
|
| 21 |
+
"packs/eu_cj_19/scrapers/collect_cellar_cj19.py": "6491a1e1cbb8cc0c33fd0c41096d7ae11dd1c55b60718ad290034d605a064915",
|
| 22 |
+
"packs/eu_cj_19/scrapers/excluded_celex.json": "b5b9a563ceee8a64d68a40f564b0d805afe8b22bba0106094bbee49d9fbc443b",
|
| 23 |
+
"packs/eu_cj_19/scrapers/minors_text_screen.VERSION": "81db67b6a5702b9b68f0016f061c409bf3fb16d062fc854d1b424bb4e9c28c56",
|
| 24 |
+
"packs/eu_cj_19/scrapers/minors_text_screen.py": "1a2797609693430b3975480d872062ca7b1b27a2d1bf3ec20f466df716484396",
|
| 25 |
+
"packs/eu_cj_19/scrapers/minors_text_screen_README.md": "03bd2d8045b428430c92fc59adf6a868d86503c93c67100cc2d294c69f636181",
|
| 26 |
+
"packs/eu_cj_19/scrapers/named_minor_screen.py": "d9c807d7f6a62e46e3fb2d731c8bb6df0cfc4d9c8fa749eb4679c558914ed954",
|
| 27 |
+
"packs/eu_cj_19/scrapers/normalize_cellar_cj19.py": "6597b71238b225b7ab5af2c0d8db280cbfa2672440f1c28785aa3d208d0f8db0",
|
| 28 |
+
"packs/eu_cj_19/scrapers/requirements.txt": "f19ad9a9cbd67e5ce727c02b778ebd908b55231405c607381e1b0ea435aa5d43",
|
| 29 |
+
"packs/eu_cj_19/scrapers/sealed_screen.py": "0404cfb5406a156fc0d1a21fecbe15240b4316d35c9e67eda2e472be366cbfa0",
|
| 30 |
+
"packs/eu_cj_19/scrapers/sexual_exploitation_screen.py": "e2cad85460b8aaa33b685e42a0cadb2df79a53b4c274e5815cc596ac3e7c091e",
|
| 31 |
+
"packs/eu_cj_19/scrapers/test_minors_text_screen.py": "6a4df5e82cbb5de2defe9ae4215aa69bbb645afe2d75b50ec0a93a4d51498598",
|
| 32 |
+
"packs/eu_cj_19/scrapers/test_youth_text_screen.py": "1898fab147325b1300184321b5c3a29ffff18984a36f286dcf4f7d6e75c2d968",
|
| 33 |
+
"packs/eu_cj_19/scrapers/youth_text_screen.VERSION": "2d27fbdf4e8ca207afbfa388ca9172fbcc6c70e534af2476b3b704f87debadcf",
|
| 34 |
+
"packs/eu_cj_19/scrapers/youth_text_screen.py": "1c350cdbe3706e44702b86f2b131a3c680edd9d2f52a15e2323b7ef530b6d996"
|
| 35 |
+
},
|
| 36 |
+
"data": {
|
| 37 |
+
"data/cases-00018.parquet": "20c3555076e9095db44d7e77bed7a52b5002b0d0084f82d8fc2348993bd809e3"
|
| 38 |
+
},
|
| 39 |
+
"parser_version": "eu-cj-1.0",
|
| 40 |
+
"parent_commit": null,
|
| 41 |
+
"parent_note": "built against live tip a3692604; the actual parent is recorded by the commit",
|
| 42 |
+
"built_against_tip": "a3692604",
|
| 43 |
+
"counts": {
|
| 44 |
+
"selected": 215,
|
| 45 |
+
"carried_over": 16,
|
| 46 |
+
"fetched": 199,
|
| 47 |
+
"selected_not_fetched": 16,
|
| 48 |
+
"excluded": 12,
|
| 49 |
+
"beyond_cap": 0,
|
| 50 |
+
"rows": 187,
|
| 51 |
+
"requests": 200,
|
| 52 |
+
"exclusion_list": 3327
|
| 53 |
+
},
|
| 54 |
+
"past_cap_for_pass20": [
|
| 55 |
+
"62015CJ0247",
|
| 56 |
+
"62014CJ0421",
|
| 57 |
+
"62013CJ0644",
|
| 58 |
+
"62013CJ0642",
|
| 59 |
+
"62013CJ0638",
|
| 60 |
+
"62013CJ0637",
|
| 61 |
+
"62013CJ0636",
|
| 62 |
+
"62013CJ0626",
|
| 63 |
+
"62013CJ0625",
|
| 64 |
+
"62013CJ0619",
|
| 65 |
+
"62013CJ0618",
|
| 66 |
+
"62013CJ0614",
|
| 67 |
+
"62013CJ0613",
|
| 68 |
+
"62013CJ0611",
|
| 69 |
+
"62013CJ0609",
|
| 70 |
+
"62013CJ0604"
|
| 71 |
+
],
|
| 72 |
+
"gates": {
|
| 73 |
+
"fetch": {
|
| 74 |
+
"gate": "MemAvailable >= 2.6 GiB to start, stop below 2.2 GiB (checked before every request), load < 8, free disk >= 12,800 MiB",
|
| 75 |
+
"mem_available_at_start_kB": 5906212,
|
| 76 |
+
"free_disk_MiB": 14449
|
| 77 |
+
},
|
| 78 |
+
"normalise": {
|
| 79 |
+
"gate": "normalise-only step: MemAvailable >= 5.0 GiB to start, stop under 4.5 GiB; started only at >= 5.5 GiB because the verifier may run",
|
| 80 |
+
"mem_available_at_start_kB": 5777012,
|
| 81 |
+
"free_disk_MiB": 14412
|
| 82 |
+
}
|
| 83 |
+
},
|
| 84 |
+
"empty_columns": {
|
| 85 |
+
"issued": "null",
|
| 86 |
+
"subject": "null",
|
| 87 |
+
"procedure": "null",
|
| 88 |
+
"judges": "null",
|
| 89 |
+
"inhoudsindicatie": "null",
|
| 90 |
+
"parties": "empty string"
|
| 91 |
+
},
|
| 92 |
+
"excluded": {
|
| 93 |
+
"62014CJ0562": "health (pass 19 hand read, named-minor rule B hit): death of a child after a therapeutic treatment in the facts",
|
| 94 |
+
"62015CJ0133": "care (pass 19 hand read, minors tier 1): primary day-to-day care of specific minor children in the facts; excluded on doubt",
|
| 95 |
+
"62015CJ0499": "family: parental responsibility / child abduction / Brussels II",
|
| 96 |
+
"62015CJ0503": "family: main proceedings concern divorce / parental responsibility / maintenance (facts screen)",
|
| 97 |
+
"62015CJ0541": "custody/adoption (pass 19 hand read, family-terms hit): adoption of the applicant as a minor after the parents' divorce; excluded on doubt",
|
| 98 |
+
"62015CJ0652": "custody/child (pass 19 hand read, minors tier 1 / named-minor hit): residence of a specific child under 16, parental custody in the facts; excluded on doubt",
|
| 99 |
+
"62016CJ0013": "injury (pass 19 hand read, minors tier 2): accident caused by a person who was a minor at the time; parental authority; excluded on doubt",
|
| 100 |
+
"62016CJ0193": "abuse (pass 19 hand read, minors tier 1 / named-minor rule B hit): child sexual abuse offences in the facts; victims were minors at the time",
|
| 101 |
+
"62016CJ0283": "family: maintenance / matrimonial / child adoption",
|
| 102 |
+
"62016CJ0578": "health (pass 19 hand read, minors tier 1 / named-minor hit): a named infant with a parent's psychiatric illness and hospital facts",
|
| 103 |
+
"62016CJ0638": "care/risk (pass 19 hand read, minors tier 2): three young minor children in the applicants' family seeking protection; excluded on doubt",
|
| 104 |
+
"62017CJ0111": "family: parental responsibility / child abduction / Brussels II"
|
| 105 |
+
},
|
| 106 |
+
"screens": [
|
| 107 |
+
"minors_text_screen",
|
| 108 |
+
"youth_text_screen",
|
| 109 |
+
"named_minor_screen",
|
| 110 |
+
"sexual_exploitation_screen",
|
| 111 |
+
"sealed_screen",
|
| 112 |
+
"confidential",
|
| 113 |
+
"family",
|
| 114 |
+
"pii_counts"
|
| 115 |
+
],
|
| 116 |
+
"run": "collect_cellar_cj19.py RAW 199 (carry.json = 16 pass 18 rows; SPARQL LIMIT 199+600; N_FETCH=199; MEM_STOP_KB=2306867); normalize_cellar_cj19.py RAW OUT under the normalise-only gate"
|
| 117 |
+
}
|
packs/eu_cj_19/manifests/MANIFEST.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EU-CJ pack 19 manifest (counts only)
|
| 2 |
+
- requests: 1 SPARQL selection (LIMIT 799; query sha256 8f450416258832201dd2697d839445014f4ea47d288e1d27fa649ebf9eef0a9d) + 199 Cellar xhtml documents = 200 requests (the cap was about 200 pulls); failures 0; 429/5xx 0; raw bytes 16,326,498 (199 files); no PDFs
|
| 3 |
+
- pull window: 2026-10-29 21:22 PT - 21:29 PT, one session
|
| 4 |
+
- fetch gate: start at MemAvailable >= 2.6 GiB, stop below 2.2 GiB (2,306,867 kB; checked before every request); load < 8, also checked before every request; free disk >= 12,800 MiB. MemAvailable at start: 5,906,212 kB; free disk 14,449 MiB; load 0.35
|
| 5 |
+
- no other fetch job was running (checked before the start)
|
| 6 |
+
- build gate: normalise-only step (no fetching) at MemAvailable >= 5.0 GiB to start and stop under 4.5 GiB; because the verifier might be running, the build started only at MemAvailable >= 5.5 GiB (5,767,168 kB). The first check read 5,714,112 kB, so the start waited about 2 minutes. MemAvailable at start: 5,777,012 kB (lowest during the build 5,643,684 kB); free disk 14,412 MiB (>= 12,800); load 0.32. One clean build from the raw files after the hand reads, with no rows filtered from a built shard
|
| 7 |
+
- built against live tip a3692604 (a36926048f8c0dbee565550dd61324f34dff0ea2; 242 files, data cases-00000 .. cases-00017), re-read read-only before the build; the actual parent is recorded by the commit. Before the fetch the tip was b2e1e9f1; between the two, eu_fix_minors_2 went live (the only data change is cases-00004, now oid bc875bb3…). cases-00018 is not in the live tip
|
| 8 |
+
- exclusion list: scrapers/excluded_celex.json, 3327 distinct CELEX = the 3128 of pass 18 + the 199 CELEX fetched in pass 18. The 21 minors-fix CELEX, 62021CJ0621, 62023CJ0460 and 62016CJ0367 are listed as their own keys and were already in the 3128. Only fetched CELEX are listed, not merely selected ones. It holds:
|
| 9 |
+
- the live tip's CELEX in cases-00000 .. cases-00017 (cases-00017 = pass 18 fetched, less its exclusions);
|
| 10 |
+
- CELEX in the data of staged EU packs;
|
| 11 |
+
- the pass 3-15 lists (passes 13-15: fetched only);
|
| 12 |
+
- the pass 16, 17 and 18 fetched CELEX;
|
| 13 |
+
- rulings.
|
| 14 |
+
- selection: first the 16 CELEX selected but not fetched by pass 18 (carried over with their pass 18 query rows; 62014CJ0599, 62016CJ0416, 62016CJ0357, 62016CJ0340, 62016CJ0287, 62016CJ0206, 62016CJ0093, 62016CJ0143, 62015CJ0566, 62015CJ0213, 62016CJ0433, 62016CJ0368, 62016CJ0354, 62016CJ0193, 62016CJ0151, 62016CJ0133; dated 2017-07-26 .. 2017-07-13). Then English xhtml CJ judgments dated 2016-01-01 .. 2017-07-13, newest first (by date, then CELEX descending). LIMIT is applied before the exclusion filter; the first 199 remaining were kept (2017-07-13 .. 2017-01-26)
|
| 15 |
+
- selected 215 (16 carried + 199 from the query); fetched 199; selected but not fetched 16 (past cap, for pass 20: 62015CJ0247, 62014CJ0421, 62013CJ0644, 62013CJ0642, 62013CJ0638, 62013CJ0637, 62013CJ0636, 62013CJ0626, 62013CJ0625, 62013CJ0619, 62013CJ0618, 62013CJ0614, 62013CJ0613, 62013CJ0611, 62013CJ0609, 62013CJ0604); fetched and excluded 12; fetched but beyond the 200-row cap 0; rows 187
|
| 16 |
+
- excluded 62014CJ0562: health (pass 19 hand read, named-minor rule B hit): death of a child after a therapeutic treatment in the facts
|
| 17 |
+
- excluded 62015CJ0133: care (pass 19 hand read, minors tier 1): primary day-to-day care of specific minor children in the facts; excluded on doubt
|
| 18 |
+
- excluded 62015CJ0499: family: parental responsibility / child abduction / Brussels II
|
| 19 |
+
- excluded 62015CJ0503: family: main proceedings concern divorce / parental responsibility / maintenance (facts screen)
|
| 20 |
+
- excluded 62015CJ0541: custody/adoption (pass 19 hand read, family-terms hit): adoption of the applicant as a minor after the parents' divorce; excluded on doubt
|
| 21 |
+
- excluded 62015CJ0652: custody/child (pass 19 hand read, minors tier 1 / named-minor hit): residence of a specific child under 16, parental custody in the facts; excluded on doubt
|
| 22 |
+
- excluded 62016CJ0013: injury (pass 19 hand read, minors tier 2): accident caused by a person who was a minor at the time; parental authority; excluded on doubt
|
| 23 |
+
- excluded 62016CJ0193: abuse (pass 19 hand read, minors tier 1 / named-minor rule B hit): child sexual abuse offences in the facts; victims were minors at the time
|
| 24 |
+
- excluded 62016CJ0283: family: maintenance / matrimonial / child adoption
|
| 25 |
+
- excluded 62016CJ0578: health (pass 19 hand read, minors tier 1 / named-minor hit): a named infant with a parent's psychiatric illness and hospital facts
|
| 26 |
+
- excluded 62016CJ0638: care/risk (pass 19 hand read, minors tier 2): three young minor children in the applicants' family seeking protection; excluded on doubt
|
| 27 |
+
- excluded 62017CJ0111: family: parental responsibility / child abduction / Brussels II
|
| 28 |
+
- hand read (names masked, including accented capitals; masked windows never begin or end mid-word; ids and one-word verdicts only). Every hit of the minors, youth and named-minor screens, and every broad family-term mention, was read:
|
| 29 |
+
- minors_text_screen v2 tier 1 (11 hits, all read): 4 already excluded by the family screens (62017CJ0111, 62015CJ0503, 62015CJ0499, 62016CJ0283); excluded by hand read 62016CJ0193 (abuse), 62015CJ0133 (care), 62015CJ0652 (custody), 62016CJ0578 (health); kept: 62015CJ0699 keep: AT exemption for children's education quoted from the directive; no specific child; 62015CJ0162 keep: five years old" refers to the age of confidential information; no child; 62015CJ0573 keep: AT rate on children's car seats and disability aids (goods); no specific child
|
| 30 |
+
- minors_text_screen v2 tier 2 (4 hits, all read): excluded 62016CJ0013 (injury, a minor at the time) and 62016CJ0638 (care/risk, young children in the facts); kept 62016CJ0449 (benefit rule for households with minor children; no child facts) and 62015CJ0544 (quoted provision on minors' travel documents; adult applicant)
|
| 31 |
+
- youth_text_screen v1: 0 hits
|
| 32 |
+
- named_minor_screen v2 (8 hits, all read): 1 already excluded by the family screen (62015CJ0503); excluded 62016CJ0193, 62015CJ0133, 62015CJ0652, 62016CJ0578 (above) and 62014CJ0562 (health: death of a child after treatment in the facts); false positives, kept: 62015CJ0651 (false positive: Italian "figli" in company names; no child); 62015CJ0573 (false positive (rule B): children's car seats and disability aids (goods); no specific child)
|
| 33 |
+
- facts-at-the-time rule: 62015CJ0541 excluded on doubt (adoption of the applicant as a minor after the parents' divorce, from the family-term review). No kept decision concerns a person who was a minor at the time with health, abuse, care, injury, foster, custody or marriage facts
|
| 34 |
+
- sexual-exploitation screen v1: 0 flags
|
| 35 |
+
- title screen: 3 exclusions; facts family screen: 1 exclusion (above). Broader family-term review of kept rows, read by hand with names masked; 6 rows with passing mentions, kept: 62015CJ0549, 62016CJ0124, 62015CJ0493, 62015CJ0528, 62015CJ0484, 62015CJ0392 ('chain of custody' in certification; 'custody' = detention; 'maintenance obligations' in insolvency, Regulation scope or notarial-competence provisions)
|
| 36 |
+
- youth screen on the title: 0 exclusions
|
| 37 |
+
- confidential/public-version screen: 0 hits; blanks below the threshold: 0 decisions. Court-applied [confidential] blanks: 0
|
| 38 |
+
- sealing/publication-ban screen (sealed_screen.py): 1 logged hit, kept: 62015CJ0162 (a competition appeal about publishing a non-confidential version of a decision; not a sealing or publication ban)
|
| 39 |
+
- redactions: national_id 0, iban 0, card 0, webmail 0 (the national-ID rule needs >= 4 digits)
|
| 40 |
+
- decision dates: 2017-01-26 .. 2017-07-26
|
| 41 |
+
- decision months: {'2017-01': 3, '2017-02': 17, '2017-03': 44, '2017-04': 23, '2017-05': 31, '2017-06': 40, '2017-07': 29}
|
| 42 |
+
- columns: 25 string columns, with the same names and order as cases-00017. Partially or fully empty columns, per column (checked on the written parquet):
|
| 43 |
+
- issued: null in 187 of 187 rows (not in the source metadata used)
|
| 44 |
+
- subject: null in 187 of 187 rows (not extracted)
|
| 45 |
+
- procedure: null in 187 of 187 rows (not extracted)
|
| 46 |
+
- judges: null in 187 of 187 rows (not extracted)
|
| 47 |
+
- inhoudsindicatie: null in 187 of 187 rows (Dutch-court summary column; no equivalent here)
|
| 48 |
+
- parties: empty string in 187 of 187 rows (not extracted; parties_note says so; also empty in every row of the earlier EU packs)
|
| 49 |
+
- all other 19 columns: no null and no empty value in any row
|
| 50 |
+
- text completeness vs raw xhtml body (non-whitespace characters), min/median/max: [1.0, 1.0, 1.0]
|
| 51 |
+
- parser_version: eu-cj-1.0
|
| 52 |
+
- parquet sha256: 20c3555076e9095db44d7e77bed7a52b5002b0d0084f82d8fc2348993bd809e3
|
| 53 |
+
## Checks
|
| 54 |
+
- screen tests: minors_text_screen v2 (9 tier-1, 3 tier-2, 8 negative) and youth_text_screen v1 (10 positive, 9 negative) synthetic sentences pass; the copies are identical to the shared modules
|
| 55 |
+
- shape 187 x 25, all string columns, column names and order identical to cases-00017
|
| 56 |
+
- screen re-runs over all 187 kept rows: minors v2 hits 5, exactly the 5 read and kept above; youth v1 hits 0; named-minor v2 flags 2, exactly the 2 false positives above; sexual-exploitation 0; title/facts family 0; confidential 0
|
| 57 |
+
- overlap of the kept CELEX with the exclusion list (which covers all 18 live data files and the other staged EU packs, including the fix packs): 0; duplicate case_id or CELEX: 0
|
| 58 |
+
- 199 fetched = 187 rows + 12 excluded + 0 beyond cap; 215 selected = 199 fetched + 16 not fetched; 200 requests = 1 query + 199 documents
|
| 59 |
+
- null and empty counts as stated above, checked on the written parquet
|
| 60 |
+
- no absolute local paths in any pack file; no __pycache__
|
packs/eu_cj_19/scrapers/cellar_selection_pack19.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
packs/eu_cj_19/scrapers/collect_cellar_cj19.py
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Select up to N English Court of Justice judgments (CELEX 6YYYYCJNNNN, xhtml manifestation) newest first via the Cellar SPARQL
|
| 3 |
+
endpoint (one request), then fetch each xhtml document from https://publications.europa.eu/resource/cellar/<manifestation>/DOC_1
|
| 4 |
+
(https forced; the CELEX content-negotiation redirect points to a broken plain-http URL). >=1 s pacing, one connection,
|
| 5 |
+
exponential backoff on 429/503/network errors (stop after 3 in a row), resumable, stops if MemAvailable < MEM_STOP_KB.
|
| 6 |
+
Pack 19 (eu_cj_19): first the 16 CELEX selected but not fetched by pass 18 (carry.json, with their pass 18 query rows), then judgments dated 2016-01-01..2017-07-13,
|
| 7 |
+
newest first (pass 18 fetched back to 2017-07-13; already-fetched CELEX dropped by the exclusion list), query LIMIT N+SPARQL_EXTRA; any CELEX in excluded_celex.json (live tip b2e1e9f1 data files
|
| 8 |
+
00000-00017 including rows removed by fix packs, pass 3-18 fetched lists, earlier rulings, the fix packs' removed CELEX)
|
| 9 |
+
is dropped after the query; the first N kept. Stop threshold from env MEM_STOP_KB.
|
| 10 |
+
Usage: collect_cellar_cj19.py RAWDIR N"""
|
| 11 |
+
import sys, os, json, time, hashlib, signal, datetime, urllib.request, urllib.parse, urllib.error, csv, io
|
| 12 |
+
UA="world-law-caselaw-research/0.1 (endomorphosis/ipfs_eu_caselaw; polite 1 req/s)"; PACE=1.0
|
| 13 |
+
SPARQL="https://publications.europa.eu/webapi/rdf/sparql"
|
| 14 |
+
QUERY='''PREFIX cdm: <http://publications.europa.eu/ontology/cdm#>
|
| 15 |
+
SELECT ?c ?d (SAMPLE(?ecli0) AS ?ecli) (SAMPLE(?title0) AS ?title) (MIN(STR(?m)) AS ?man) WHERE {
|
| 16 |
+
?w cdm:resource_legal_id_celex ?c . FILTER(REGEX(STR(?c),"^6[0-9]{4}CJ[0-9]{4}$"))
|
| 17 |
+
?w cdm:work_date_document ?d . OPTIONAL { ?w cdm:case-law_ecli ?ecli0 }
|
| 18 |
+
?e cdm:expression_belongs_to_work ?w ; cdm:expression_uses_language <http://publications.europa.eu/resource/authority/language/ENG> .
|
| 19 |
+
OPTIONAL { ?e cdm:expression_title ?title0 }
|
| 20 |
+
?m cdm:manifestation_manifests_expression ?e ; cdm:manifestation_type ?t . FILTER(STR(?t)="xhtml")
|
| 21 |
+
FILTER(STR(?d) >= "2016-01-01" && STR(?d) <= "2017-07-13")
|
| 22 |
+
} GROUP BY ?c ?d ORDER BY DESC(?d) DESC(?c) LIMIT %d'''
|
| 23 |
+
last=[0.0]
|
| 24 |
+
def mem(): return int([l for l in open('/proc/meminfo') if l.startswith('MemAvailable')][0].split()[1])
|
| 25 |
+
def get(url, log, headers=None):
|
| 26 |
+
fails=0
|
| 27 |
+
while True:
|
| 28 |
+
if mem()<int(os.environ.get("MEM_STOP_KB",2621440)): log({"stop":"MemAvailable<MEM_STOP_KB","mem_kB":mem()}); print("MEMSTOP"); sys.exit(3)
|
| 29 |
+
if os.getloadavg()[0]>=8: log({"stop":"load>=8"}); print("LOADSTOP"); sys.exit(3)
|
| 30 |
+
w=PACE-(time.time()-last[0]); w>0 and time.sleep(w)
|
| 31 |
+
def _to(*a): raise TimeoutError("hard 180s deadline")
|
| 32 |
+
signal.signal(signal.SIGALRM,_to); signal.alarm(180)
|
| 33 |
+
try:
|
| 34 |
+
with urllib.request.urlopen(urllib.request.Request(url,headers={"User-Agent":UA,**(headers or {})}),timeout=120) as r:
|
| 35 |
+
st,b=r.status,r.read(); signal.alarm(0); last[0]=time.time(); return st,b
|
| 36 |
+
except urllib.error.HTTPError as e:
|
| 37 |
+
signal.alarm(0); last[0]=time.time()
|
| 38 |
+
if e.code in (429,500,502,503,504):
|
| 39 |
+
fails+=1
|
| 40 |
+
if fails>=3: log({"stop":"repeated %d"%e.code,"url":url}); return e.code,b""
|
| 41 |
+
time.sleep(2**fails*10); continue
|
| 42 |
+
return e.code,b""
|
| 43 |
+
except (urllib.error.URLError, TimeoutError, OSError) as e:
|
| 44 |
+
signal.alarm(0); last[0]=time.time(); fails+=1
|
| 45 |
+
if fails>=3: log({"stop":"network","err":str(e),"url":url}); print("NETSTOP"); sys.exit(5)
|
| 46 |
+
time.sleep(2**fails*10)
|
| 47 |
+
def main(raw,n):
|
| 48 |
+
n=int(n); os.makedirs(raw,exist_ok=True); lg=open(os.path.join(raw,"requests.jsonl"),"a")
|
| 49 |
+
log=lambda d:(lg.write(json.dumps(d)+"\n"),lg.flush()); selp=os.path.join(raw,"selection.json")
|
| 50 |
+
if not os.path.exists(selp):
|
| 51 |
+
q=QUERY%(n+int(os.environ.get("SPARQL_EXTRA",600))); url=SPARQL+"?"+urllib.parse.urlencode({"query":q,"format":"text/csv"})
|
| 52 |
+
st,b=get(url,log); assert st==200, st
|
| 53 |
+
_x=json.load(open(os.path.join(os.path.dirname(os.path.abspath(__file__)),"excluded_celex.json"))); live=set().union(*[set(v) for v in _x.values()])
|
| 54 |
+
carry=json.load(open(os.path.join(raw,"carry.json"))); cc={x["c"] for x in carry}
|
| 55 |
+
rows=carry+[x for x in csv.DictReader(io.StringIO(b.decode())) if x["c"] not in live and x["c"] not in cc][:n]
|
| 56 |
+
json.dump({"query":q,"query_sha256":hashlib.sha256(q.encode()).hexdigest(),"selected_at":datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"),"rows":rows},open(selp,"w"),indent=1)
|
| 57 |
+
sel=json.load(open(selp))["rows"][:int(os.environ.get("N_FETCH",200))] # carried-over CELEX first (already present, not refetched), then the query rows
|
| 58 |
+
for r in sel:
|
| 59 |
+
fn=os.path.join(raw,r["c"]+".xhtml")
|
| 60 |
+
if os.path.exists(fn): continue
|
| 61 |
+
url=r["man"].replace("http://","https://",1)+"/DOC_1"; t=datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
| 62 |
+
st,b=get(url,log)
|
| 63 |
+
if st==200 and b: open(fn,"wb").write(b); log({"celex":r["c"],"url":url,"status":st,"fetched_at":t,"sha256":hashlib.sha256(b).hexdigest(),"bytes":len(b)})
|
| 64 |
+
else: log({"celex":r["c"],"url":url,"status":st,"fetched_at":t,"error":"non-200"})
|
| 65 |
+
print("DONE")
|
| 66 |
+
if __name__=="__main__": main(*sys.argv[1:3])
|
packs/eu_cj_19/scrapers/excluded_celex.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
packs/eu_cj_19/scrapers/minors_text_screen.VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
v2
|
packs/eu_cj_19/scrapers/minors_text_screen.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Minors text screen (shared, v2; v2 adds the child + health/abuse/care/injury context rule to tier 1). English, full text + title. Reconstructs a broad minors regex (minor child, minors, unaccompanied
|
| 2 |
+
minor, foster, child ages 'aged N', juvenile) and splits hits into two tiers for hand review. Counts only; never returns text.
|
| 3 |
+
Tier 1 (child-specific; read by hand): a child age (aged N / N-year-old / N years old / age of N, with N <= 17); foster care /
|
| 4 |
+
foster parent(s) / foster family / fostered child (the verb 'to foster cooperation' is not a hit); 'unaccompanied minor(s)' next to a specific person ('the/an/as an unaccompanied minor',
|
| 5 |
+
'arrived as'); 'the/her/his/their (two|three|...)? minor child(ren)/minors'; 'placed in (a) care (facility|home|institution)'; child
|
| 6 |
+
plus abuse terms (abuse, rape, sexual, assault, maltreat, neglect) within the same sentence.
|
| 7 |
+
v2 tier-1 rule 'child health/care context': a child word (child, children, son, daughter, minor, boy, girl, baby, infant, newborn)
|
| 8 |
+
within about 200 characters (either order) of heart, surgery/operation, disability/disabled, illness/ill, congenital, diagnosis,
|
| 9 |
+
hospital, abuse, violence, injury/injured, care order, custody, medical treatment, consent to treatment.
|
| 10 |
+
Tier 2 (generic; incidental unless context says otherwise): 'minor child(ren)', 'minors', 'a minor', 'unaccompanied minors' in general,
|
| 11 |
+
'juvenile' in a human sense (animal/plant/ecological contexts excluded, as in youth_text_screen v1).
|
| 12 |
+
Excluded from both: 'minor' meaning small/unimportant ('minor importance', 'minor offence', 'minor amendment', ...), adult ages (N >= 18).
|
| 13 |
+
API: screen(text, title='') -> {'flag','tier','tier1','tier2','terms','version'}"""
|
| 14 |
+
import re
|
| 15 |
+
VERSION='v2'
|
| 16 |
+
NUMW=r'(?:one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen)'
|
| 17 |
+
WORDN={w:i+1 for i,w in enumerate('one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen'.split())}
|
| 18 |
+
AGE=re.compile(r'(?i)\b(?:aged|age of|ages of)\s+(\d{1,2}|'+NUMW+r')\b(?!\s*(?:%|per|months? of contributions|years? of (?:service|insurance|contributions)))|\b(\d{1,2}|'+NUMW+r')[- ]years?[- ]old\b')
|
| 19 |
+
T1=[('foster',re.compile(r'(?i)\bfoster\s+(?:care|parents?|famil(?:y|ies)|homes?|mothers?|fathers?|child(?:ren)?|placements?|carers?)\b|\bfoster(?:ed|ing)\s+(?:child(?:ren)?|of (?:the|a|his|her|their) child)')),
|
| 20 |
+
('unaccompanied minor (specific)',re.compile(r'(?i)\b(?:as an?|the|an|arrived as an?|was an?)\s+unaccompanied minor\b')),
|
| 21 |
+
('specific minor children',re.compile(r'(?i)\b(?:her|his|their|the)\s+(?:'+NUMW+r'\s+)?(?:minor child(?:ren)?|minors|minor (?:son|daughter)s?)\b')),
|
| 22 |
+
('placed in care',re.compile(r'(?i)\bplaced in (?:a |an )?(?:care|foster|children.s home|residential)\b')),
|
| 23 |
+
('child abuse',re.compile(r'(?i)\b(?:child(?:ren)?|minors?|daughters?|sons?|girl|boy)\b[^.]{0,120}\b(?:abus\w*|rap(?:e|ed|ing)|sexual\w*|assault\w*|maltreat\w*|neglect\w*)\b|\b(?:abus\w*|rap(?:e|ed|ing)|sexual\w*|maltreat\w*)\b[^.]{0,120}\b(?:child(?:ren)?|minors?|daughters?|girl|boy)\b'))]
|
| 24 |
+
CHW=r'\b(?:child(?:ren)?|sons?|daughters?|minors?|boys?|girls?|bab(?:y|ies)|infants?|newborns?)\b'
|
| 25 |
+
HLW=r'\b(?:heart|surg\w*|operations? on|disab\w*|illness\w*|ill|congenital|diagnos\w*|hospital\w*|abus\w*|violen\w*|injur\w*|care orders?|custody|medical treatment|consent to (?:the )?(?:treatment|surgery|operation))\b'
|
| 26 |
+
T1.append(('child health/care context',re.compile(r'(?is)'+CHW+r'.{0,200}?'+HLW+r'|'+HLW+r'.{0,200}?'+CHW)))
|
| 27 |
+
NOTMINOR=r'(?!\s+(?:importance|offen[cs]es?|amendments?|changes?|modifications?|role|part|significance|extent|adjustments?|errors?|infringements?|irregularit\w+|deviations?|breach\w*|matters?|works?|repairs?|injur\w+|shareholders?|interests?|planning|variations?|degree|cases?))'
|
| 28 |
+
T2=[('minor child',re.compile(r'(?i)\bminor child(?:ren)?\b')),('minors',re.compile(r'(?i)\bminors\b')),
|
| 29 |
+
('a minor',re.compile(r'(?i)\b(?:a|the)\s+minor\b'+NOTMINOR)),('unaccompanied minors',re.compile(r'(?i)\bunaccompanied minors?\b'))]
|
| 30 |
+
JUV=re.compile(r'(?i)\bjuveniles?\b')
|
| 31 |
+
BIO=re.compile(r"(?i)(?:pearl|mussels?|fish\w*|birds?|animals?|species|specimens?|salmon|eels?|trout|lobsters?|crabs?|shellfish|molluscs?|plants?|trees?|seedlings?|stage|forms?|stock|calves|cattle|bovine|pigs?|piglets?|poultry|chicks?|larvae|hake|cod|tuna|turtles?|seals?|whales?|wolves|wolf|organisms?|marine)\b")
|
| 32 |
+
CTX=re.compile(r"(?i)\b(?:species|habitats?|river|restocking|population|spawning|breeding|fisher(?:y|ies)|aquaculture|mussels?|fish)\b")
|
| 33 |
+
def _bio(t,m):
|
| 34 |
+
after=' '.join(re.sub(r'[\[\]()]',' ',t[m.end():m.end()+60]).split()[:3]); before=t[max(0,m.start()-25):m.start()].split()[-1:]
|
| 35 |
+
if BIO.search(after) or (before and BIO.fullmatch(before[0].strip('.,;:()[]'))): return True
|
| 36 |
+
return bool(CTX.search(re.split(r'[.;!?]\s',t[max(0,m.start()-150):m.start()])[-1]))
|
| 37 |
+
def screen(text,title=''):
|
| 38 |
+
s=(title or '')+'\n'+(text or ''); terms={}; t1=t2=0
|
| 39 |
+
for m in AGE.finditer(s):
|
| 40 |
+
n=m.group(1) or m.group(2); n=int(n) if n.isdigit() else WORDN[n.lower()]
|
| 41 |
+
if n<=17: terms['child age']=terms.get('child age',0)+1; t1+=1
|
| 42 |
+
for k,rx in T1:
|
| 43 |
+
n=len(rx.findall(s))
|
| 44 |
+
if n: terms[k]=n; t1+=n
|
| 45 |
+
for k,rx in T2:
|
| 46 |
+
n=len(rx.findall(s))
|
| 47 |
+
if n: terms[k]=n; t2+=n
|
| 48 |
+
j=sum(1 for m in JUV.finditer(s) if not _bio(s,m))
|
| 49 |
+
if j: terms['juvenile']=j; t2+=j
|
| 50 |
+
return {'flag':bool(t1 or t2),'tier':1 if t1 else (2 if t2 else 0),'tier1':t1,'tier2':t2,'terms':terms,'version':VERSION}
|
packs/eu_cj_19/scrapers/minors_text_screen_README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# minors_text_screen (v1)
|
| 2 |
+
Broad English full-text minors screen (minor child, minors, unaccompanied minor, foster, child ages 'aged N' with N <= 17, juvenile in a human sense), split into tier 1 (child-specific context: child ages, foster care, a specific unaccompanied minor, 'her/his/their minor children', placed in care, child plus abuse terms) and tier 2 (generic mentions). Used to select decisions for a hand read; any exclusion is a hand ruling. Counts only. Tests: `python3 test_minors_text_screen.py`.
|
| 3 |
+
|
| 4 |
+
## Lesson (fix_minors v3, 2026-10-29)
|
| 5 |
+
When a decision concerns a person who was a minor at the time of the facts, apply the minor rule to the facts as they were then, not to the person's current age. A child who was a minor when the health, abuse, care or injury facts arose stays a specific child for this rule, even if the judgment calls them an adult now (this is how 62019CJ0402 was wrongly kept in v2). This is a reading rule only; the regex is unchanged, so VERSION stays v2.
|
packs/eu_cj_19/scrapers/named_minor_screen.py
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Named-minor screen (shared, v2).
|
| 2 |
+
v2 adds rule B: a child referred to by GIVEN NAME ONLY near health/diagnosis/disability/abuse terms (EN/FR/PT), ~300 chars.
|
| 3 |
+
v1 rule A (full given name + surname) is unchanged. Flags a decision when a minor is named with a full given name + surname (not initials).
|
| 4 |
+
Heuristic: find a minor term (EN/NL/DE/FR/PT/IT); look in a window of WIN characters AFTER it (and a short window before it
|
| 5 |
+
for appositions like 'X Y, a minor') for a capitalised Given Surname pair. Both words must be >=2 letters, start with an
|
| 6 |
+
upper-case letter followed by lower case, and neither may be on the false-positive stop list (institutions, legal words,
|
| 7 |
+
places, months, 'Court of Justice', 'Child Benefit', ...). Only short sha256 hashes of the matched pair are returned;
|
| 8 |
+
names are never stored or printed. Exclude on doubt: flag=True on any hit.
|
| 9 |
+
API: screen(text) -> {'flag': bool, 'hits': int, 'hashes': [10-hex, ...], 'terms': {term: n}}"""
|
| 10 |
+
import re, hashlib
|
| 11 |
+
WIN=60; PRE=40
|
| 12 |
+
MINOR=re.compile(r"(?i)\b(?:minor child(?:ren)?|minor|minors|child(?:ren)?|infant|juvenile|daughters?|sons?|stepdaughter|stepson|grand(?:daughter|son)|"
|
| 13 |
+
r"minderjarigen?|kind(?:eren)?|dochter|zoon|minderjährige[rn]?|Kind(?:er)?|Tochter|Sohn|mineure?s?|enfants?|fille|fils|"
|
| 14 |
+
r"menor(?:es)?|crianças?|adolescentes?|filh[oa]s?|minore|minori|minorenne|figli[oa]?|bambin[oai])\b")
|
| 15 |
+
CAP=r"[A-ZÀ-ÖØ-Þ][a-zà-öø-ÿß'’\-]+"
|
| 16 |
+
PAIR=re.compile(rf"\b({CAP})\s+((?:(?:van|de|der|den|da|do|dos|von|di|del|le|la)\s+)?{CAP})\b")
|
| 17 |
+
STOP=set("""court courts justice tribunal tribunale tribunal cour gericht hof gerechtshof rechtbank raad state states member republic kingdom federal
|
| 18 |
+
union european commission council parliament government minister ministry ministre ministerio department office agency authority board
|
| 19 |
+
benefit benefits tax child children family social security act acts article articles regulation directive code law loi gesetz wet lei legge
|
| 20 |
+
canada king queen crown attorney general his her their the this that these those a an and or of in on for to with by from at as which who
|
| 21 |
+
mr mrs ms dr madam sir judge judges advocate registrar president chamber section division appeal appeals supreme high district provincial
|
| 22 |
+
january february march april may june july august september october november december monday tuesday wednesday thursday friday saturday sunday
|
| 23 |
+
services service aid society protection centre center home school hospital university college association foundation fund bank company
|
| 24 |
+
limited inc ltd corporation group national international public private case cases decision judgment order reasons paragraph schedule
|
| 25 |
+
amsterdam rotterdam brussels luxembourg paris berlin ottawa toronto montreal brasil brazil switzerland netherlands germany france italy spain
|
| 26 |
+
portugal belgium austria poland ireland greece sweden denmark finland hungary romania bulgaria croatia slovenia slovakia czech estonia latvia
|
| 27 |
+
lithuania cyprus malta canadian european dutch german french italian brazilian swiss english by-law protocol convention charter treaty
|
| 28 |
+
staatssecretaris bundesrepublik deutschland république république française república federativa estado juiz relator ministro
|
| 29 |
+
the new great saint st sainte santa são sao fort port mount lake river north south east west upper lower grand duchy united nations fundamental rights human freedoms principality""".split())
|
| 30 |
+
FP_PHRASES=re.compile(r"(?i)Court of Justice|Child Benefit|Child Tax|Children.s Aid|Child and Family|Youth (?:Court|Justice)|Juvenile Court|Kinderbijslag|Kindergeld|Kinderrechter|Juiz(?:ado)? da Infância|Tribunal (?:de|pour) (?:la jeunesse|enfants)|Estatuto da Criança|Sons? of [A-Z]|& Sons?\b|and Sons?\b")
|
| 31 |
+
def _h(s): return hashlib.sha256(s.lower().encode()).hexdigest()[:10]
|
| 32 |
+
def _ok(a,b):
|
| 33 |
+
return a.lower() not in STOP and b.split()[-1].lower() not in STOP and len(a)>=2 and len(b)>=2
|
| 34 |
+
def _screen_v1(text):
|
| 35 |
+
text=text or ''; clean=FP_PHRASES.sub(lambda m:' '*len(m.group(0)),text)
|
| 36 |
+
hashes=[]; terms={}
|
| 37 |
+
for m in MINOR.finditer(clean):
|
| 38 |
+
t=m.group(0);
|
| 39 |
+
w=clean[m.end():m.end()+WIN]
|
| 40 |
+
# stop the window at a sentence end
|
| 41 |
+
w=re.split(r'(?<=[a-z])\.\s',w)[0]
|
| 42 |
+
p=clean[max(0,m.start()-PRE):m.start()]
|
| 43 |
+
found=[x for x in PAIR.finditer(w) if _ok(x.group(1),x.group(2))]
|
| 44 |
+
pre=[x for x in PAIR.finditer(p) if _ok(x.group(1),x.group(2)) and re.match(r"\s*,?\s*(?:(?:a|the|his|her|their|un|une|een|ein|eine|o|a|um|uma|il|la)\s+)?$",p[x.end():].replace(t,''))]
|
| 45 |
+
for x in found+pre:
|
| 46 |
+
hh=_h(x.group(0))
|
| 47 |
+
if hh not in hashes: hashes.append(hh); terms[t.lower()]=terms.get(t.lower(),0)+1
|
| 48 |
+
return {'flag':bool(hashes),'hits':len(hashes),'hashes':hashes,'terms':terms}
|
| 49 |
+
|
| 50 |
+
VERSION='v2'
|
| 51 |
+
WIN2=300
|
| 52 |
+
CHILD2=re.compile(r"(?i)\b(?:child(?:ren)?|minor|infant|juvenile|toddler|baby|son|daughter|boy|girl|stepson|stepdaughter|"
|
| 53 |
+
r"enfant|mineure?|fils|fille|garçon|bébé|criança|menor|menino|menina|filh[oa]|adolescente|bebê|"
|
| 54 |
+
r"(?:aged?|âgée?|idade de|de)\s+(?:\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen)(?:[\s-]+(?:years?|ans|anos)(?:[\s-]+old)?)?|"
|
| 55 |
+
r"\d{1,2}[\s-]+(?:years?[\s-]+old|year-old|ans|anos(?:\s+de\s+idade)?))\b")
|
| 56 |
+
HEALTH=re.compile(r"(?i)\b(?:diagnos(?:is|es|ed|tic|tique|e|é|ée)|diagnóstico|autism\w*|autisme|autismo|autistic|ADHD|TDAH|disabilit(?:y|ies)|disabled|handicap\w*|deficiência|deficiente|"
|
| 57 |
+
r"cancer|cancro|câncer|leuk\w*|medication|médicament\w*|medicação|medicamento\w*|hospital\w*|hôpita\w*|hospitalis\w*|therap\w*|thérap\w*|terapia|"
|
| 58 |
+
r"special needs|besoins particuliers|necessidades especiais|abus(?:e|ed|ive|if|ifs)?|abuso\w*|maltraitance\w*|maus-tratos|neglect\w*|négligence|negligência|"
|
| 59 |
+
r"assault\w*|agression\w*|agressão|trauma\w*|traumatis\w*|psychiatr\w*|psiquiátric\w*|syndrome|síndrome|epilep\w*|illness|maladie|doença)\b")
|
| 60 |
+
NAME1=re.compile(rf"\b({CAP})\b")
|
| 61 |
+
NAME1_CAPS=re.compile(r"\b([A-ZÀ-ÖØ-Þ]{3,})\b")
|
| 62 |
+
STOP2=STOP|set("""i he she it we they you his her him its our my mother father parent parents appellant respondent applicant plaintiff defendant
|
| 63 |
+
minister doctor dr nurse however also although after before during when while where since because but if then there here in on at
|
| 64 |
+
the une un le la les des du il elle ils son sa ses mère père enfant o a os as um uma ele ela seu sua mãe pai criança ao no na
|
| 65 |
+
adhd tdah cancer hospital autism child minor son daughter boy girl crown tcc fca scc fc ca qc bc on ab art arts para paras page pp""".split())
|
| 66 |
+
def _given_ok(w):
|
| 67 |
+
return len(w)>=3 and w.lower() not in STOP2 and not HEALTH.fullmatch(w) and not CHILD2.fullmatch(w)
|
| 68 |
+
def _rule_b(clean):
|
| 69 |
+
hashes=[]; terms={}
|
| 70 |
+
for m in CHILD2.finditer(clean):
|
| 71 |
+
a=max(0,m.start()-WIN2); b=m.end()+WIN2
|
| 72 |
+
ctx=clean[a:b]
|
| 73 |
+
hm=HEALTH.findall(ctx)
|
| 74 |
+
if not hm: continue
|
| 75 |
+
names=set()
|
| 76 |
+
for rx in (NAME1,NAME1_CAPS):
|
| 77 |
+
for x in rx.finditer(ctx):
|
| 78 |
+
w=x.group(1)
|
| 79 |
+
# skip sentence-initial capitalised words (preceded by '. ' or line start) for NAME1 only
|
| 80 |
+
pre=ctx[max(0,x.start()-2):x.start()]
|
| 81 |
+
# sentence-initial capitalised word: count only if it never appears in lower case in the whole text (proper-noun test)
|
| 82 |
+
if rx is NAME1 and (x.start()==0 or re.search(r'[.!?:;\n]\s?$',pre)) and re.search(r'\b'+re.escape(w.lower())+r'\b',clean): continue
|
| 83 |
+
if _given_ok(w): names.add(w.lower())
|
| 84 |
+
if names:
|
| 85 |
+
for n in sorted(names):
|
| 86 |
+
hh=_h('b:'+n)
|
| 87 |
+
if hh not in hashes: hashes.append(hh)
|
| 88 |
+
t=m.group(0).lower(); terms['b:'+t]=terms.get('b:'+t,0)+1
|
| 89 |
+
for h in hm: terms['h:'+h.lower()]=terms.get('h:'+h.lower(),0)+1
|
| 90 |
+
return hashes,terms
|
| 91 |
+
def screen(text):
|
| 92 |
+
r=_screen_v1(text)
|
| 93 |
+
text=text or ''; clean=FP_PHRASES.sub(lambda m:' '*len(m.group(0)),text)
|
| 94 |
+
hb,tb=_rule_b(clean)
|
| 95 |
+
hashes=list(r['hashes'])+[h for h in hb if h not in r['hashes']]
|
| 96 |
+
terms=dict(r['terms']); terms.update(tb)
|
| 97 |
+
return {'flag':bool(hashes),'hits':len(hashes),'hashes':hashes,'terms':terms,'rule_a':r['hits'],'rule_b':len(hb),'version':VERSION}
|
packs/eu_cj_19/scrapers/normalize_cellar_cj19.py
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Normalize Cellar English CJ judgment xhtml -> cases parquet (world caselaw schema, same columns as the NL packs).
|
| 3 |
+
Usage: normalize_cellar_cj19.py RAWDIR OUT_PARQUET
|
| 4 |
+
Extraction: the xhtml body is walked once; every table row (<tr>) becomes one line with its cell texts joined by a space (CJ judgments
|
| 5 |
+
put paragraph numbers and paragraph text in adjacent cells), and every <p>/<h1-6>/<li> outside a table becomes one line. Nested
|
| 6 |
+
blocks are not emitted twice; whitespace is normalised. Footnotes and the signature block are kept as they appear in the source."""
|
| 7 |
+
import sys, os, re, json, glob, hashlib, warnings
|
| 8 |
+
import pyarrow as pa, pyarrow.parquet as pq
|
| 9 |
+
sys.path.insert(0,os.path.dirname(os.path.abspath(__file__)))
|
| 10 |
+
from sealed_screen import hits as sealed_hits
|
| 11 |
+
from bs4 import BeautifulSoup, XMLParsedAsHTMLWarning
|
| 12 |
+
warnings.filterwarnings("ignore", category=XMLParsedAsHTMLWarning)
|
| 13 |
+
PARSER_VERSION="eu-cj-1.0"
|
| 14 |
+
LICENSE="EU reuse (2011/833/EU; CURIA statement)"
|
| 15 |
+
LICENSE_TEXT=('CURIA: "The texts available on this site may be reproduced provided the source is acknowledged as well as the fact that they are not '
|
| 16 |
+
'authentic and are free of charge." Decision 2011/833/EU Art. 6(1): "Documents shall be made available for reuse without application unless '
|
| 17 |
+
'otherwise specified and without restrictions or, where appropriate, an open licence or disclaimer setting out conditions explaining the rights of reusers."')
|
| 18 |
+
BLOCK={'p','h1','h2','h3','h4','h5','h6','li'}
|
| 19 |
+
def norm(s): return ' '.join(s.split())
|
| 20 |
+
def body_text(body):
|
| 21 |
+
out=[]
|
| 22 |
+
def walk(e):
|
| 23 |
+
for c in e.children:
|
| 24 |
+
n=getattr(c,'name',None)
|
| 25 |
+
if n is None:
|
| 26 |
+
s=norm(str(c)) if c.parent is body else ''
|
| 27 |
+
if s: out.append(s)
|
| 28 |
+
continue
|
| 29 |
+
if n in ('script','style'): continue
|
| 30 |
+
if n=='tr':
|
| 31 |
+
s=' '.join(norm(td.get_text(' ')) for td in c.find_all(['td','th'],recursive=False))
|
| 32 |
+
s=norm(s)
|
| 33 |
+
if s: out.append(s)
|
| 34 |
+
elif n in BLOCK and not c.find(['table']+list(BLOCK)):
|
| 35 |
+
s=norm(c.get_text(' '))
|
| 36 |
+
if s: out.append(s)
|
| 37 |
+
else: walk(c)
|
| 38 |
+
walk(body); return '\n'.join(out)
|
| 39 |
+
IBAN=re.compile(r'\b[A-Z]{2}\d{2}(?:\s?[A-Z0-9]{4}){3,7}(?:\s?[A-Z0-9]{1,3})?\b')
|
| 40 |
+
CARD=re.compile(r'\b(?:\d{4}[ -]?){3}\d{1,7}\b')
|
| 41 |
+
MAIL=re.compile(r'\b[\w.+-]+@(gmail|hotmail|outlook|live|yahoo|icloud|gmx|web|aol|msn|orange|free|libero|wp|seznam)\.[a-z.]{2,6}\b',re.I)
|
| 42 |
+
NATID=re.compile(r'(?i)\b(national (?:identification|identity|insurance) number|personal identification number|social security number|tax identification number)\b[\s:.-]*(?:no\.?\s*)?([A-Z0-9][A-Z0-9 ./-]{5,18}[A-Z0-9])')
|
| 43 |
+
def luhn(d):
|
| 44 |
+
d=[int(c) for c in d][::-1]; s=0
|
| 45 |
+
for i,x in enumerate(d):
|
| 46 |
+
if i%2: x*=2; x-=9 if x>9 else 0
|
| 47 |
+
s+=x
|
| 48 |
+
return s%10==0
|
| 49 |
+
def redact(t,c):
|
| 50 |
+
def nid(m): # pack 3: needs >=4 digits (the pack-2 rule hit 'of 40 other persons')
|
| 51 |
+
if sum(ch.isdigit() for ch in m.group(2))>=4: c['national_id']+=1; return m.group(0).replace(m.group(2),'[ID REDACTED]')
|
| 52 |
+
return m.group(0)
|
| 53 |
+
t=NATID.sub(nid,t)
|
| 54 |
+
def iban(m):
|
| 55 |
+
if sum(ch.isdigit() for ch in m.group(0))>=10: c['iban']+=1; return '[IBAN REDACTED]'
|
| 56 |
+
return m.group(0)
|
| 57 |
+
t=IBAN.sub(iban,t)
|
| 58 |
+
def card(m):
|
| 59 |
+
d=re.sub(r'\D','',m.group(0))
|
| 60 |
+
if 13<=len(d)<=19 and luhn(d) and not d.startswith(('19','20')): c['card']+=1; return '[CARD REDACTED]'
|
| 61 |
+
return m.group(0)
|
| 62 |
+
t=CARD.sub(card,t); t,n=MAIL.subn('[EMAIL REDACTED]',t); c['webmail']+=n
|
| 63 |
+
return t
|
| 64 |
+
# family / youth exclusions (subject matter read from the official title/keywords, plus the NL-style youth text screens)
|
| 65 |
+
RULES=[
|
| 66 |
+
('family: parental responsibility / child abduction / Brussels II', re.compile(r'(?i)parental responsibility|child abduction|wrongful removal|Regulation \(EC\) No 2201/2003|Regulation \(EU\) 2019/1111|rights of custody|rights of access')),
|
| 67 |
+
('family: maintenance / matrimonial / child adoption', re.compile(r'(?i)divorce proceedings? (?:between|of) (?:the )?spouses|legal separation|maintenance obligations|Regulation \(EC\) No 4/2009|adoption of (?:a|the) child|adoptive parent|matrimonial property')),
|
| 68 |
+
('youth: child suspects (Directive 2016/800) / juvenile justice', re.compile(r'(?i)Directive \(EU\) 2016/800|children who are suspects|juvenile (?:offender|justice|court|suspect)|young offender')),
|
| 69 |
+
]
|
| 70 |
+
# v2 (pass 8 fix): facts screen -- the sentence stating what the main proceedings concern ("The request has been made in proceedings
|
| 71 |
+
# between X and Y concerning ...") is checked for family-law subject matter; a passing mention elsewhere (child benefit, tax, residence) is not.
|
| 72 |
+
FAM_TERMS=r'dissolution of (?:the|their|his|her) marriage|divorce|legal separation|parental responsibility|custody|child abduction|wrongful (?:removal|retention)|maintenance (?:obligations?|for (?:the|a|their) child)|adoption of (?:a|the|their) child|matrimonial'
|
| 73 |
+
FACTS=re.compile(r'(?is)(?:request (?:for a preliminary ruling )?has been made|reference has been made) in (?:the context of )?proceedings between .{0,300}?(?:concerning|relating to|regarding) ([^.]{0,300})')
|
| 74 |
+
FAM=re.compile(r'(?i)'+FAM_TERMS)
|
| 75 |
+
BROAD=re.compile(r'(?i)'+FAM_TERMS+r'|maintenance creditors?|adoptive parents?')
|
| 76 |
+
def facts_family(text):
|
| 77 |
+
m=FACTS.search(text or '')
|
| 78 |
+
return m.group(0)[:300] if m and FAM.search(m.group(1)) else None
|
| 79 |
+
YOUTH_TEXT=re.compile(r'(?i)strafrecht voor jeugdigen|jeugddetentie|jeugdzaak')
|
| 80 |
+
SECRET_HDR=re.compile(r'(?m)^\s*(?:TOP SECRET|SECRET)\s*$|^\s*(?:TOP SECRET|SECRET)\s*[-–:/]') # classification header line (upper case)
|
| 81 |
+
BLANK=re.compile(r'\[[\s….]*_[\s_….]*\]') # needs an underscore: ellipses in quotations ('[…]') are not blanks # '[ _ ... _ ]' style redaction blank
|
| 82 |
+
CONF=re.compile(r'(?i)\[\s*confidential\s*\]') # Court-applied blank (allowed below the threshold)
|
| 83 |
+
BLANK_MIN=5
|
| 84 |
+
def conf_screen(text):
|
| 85 |
+
if SECRET_HDR.search(text or ''): return "confidential/public version: 'TOP SECRET'/'SECRET' header"
|
| 86 |
+
n=len(BLANK.findall(text or ''))
|
| 87 |
+
if n>=BLANK_MIN: return f"confidential/public version: {n} '[ _ ... _ ]' redaction blanks (>= {BLANK_MIN})"
|
| 88 |
+
return None
|
| 89 |
+
MANUAL={ # CoS rulings from earlier passes (kept for safety) + hand-reviewed matters of this pass; excluded when in doubt
|
| 90 |
+
'62017CJ0661':'family/child (earlier ruling)','62017CJ0386':'family (earlier ruling)','62018CJ0361':'family (earlier ruling)',
|
| 91 |
+
'62018CJ0129':'family (earlier ruling)','62017CJ0635':'family (CoS ruling)','62017CJ0297':'named minors (CoS ruling)',
|
| 92 |
+
'62018CJ0551':'sexual offence against a minor (hand review of a named-minor rule B hit; offence underlying the arrest warrant)',
|
| 93 |
+
'62017CJ0662':'family/child (hand review, excluded on doubt): asylum application involving an infant, with a health/vulnerability context (named-minor rule B hit)',
|
| 94 |
+
'62016CJ0652':'named minor (hand review, excluded on doubt): a son named in full as a party (named-minor rule A hit)',
|
| 95 |
+
'62017CJ0230':'named minor (hand review of a named-minor rule A hit): a son born in 2004 named in full as a party',
|
| 96 |
+
'62016CJ0274':'named minors (hand review of a named-minor rule A hit): minor children named in full as parties',
|
| 97 |
+
'62016CJ0367':'youth: juvenile-justice European arrest warrant case (CoS ruling; also caught by youth_text_screen v1)',
|
| 98 |
+
'62021CJ0621':'minor at the time (CoS ruling; removed by eu_fix_minors_2)','62023CJ0460':'CoS ruling (earlier)',
|
| 99 |
+
'62016CJ0193':'abuse (pass 19 hand read, minors tier 1 / named-minor rule B hit): child sexual abuse offences in the facts; victims were minors at the time',
|
| 100 |
+
'62015CJ0133':'care (pass 19 hand read, minors tier 1): primary day-to-day care of specific minor children in the facts; excluded on doubt',
|
| 101 |
+
'62015CJ0652':'custody/child (pass 19 hand read, minors tier 1 / named-minor hit): residence of a specific child under 16, parental custody in the facts; excluded on doubt',
|
| 102 |
+
'62016CJ0578':'health (pass 19 hand read, minors tier 1 / named-minor hit): a named infant with a parent\'s psychiatric illness and hospital facts',
|
| 103 |
+
'62014CJ0562':'health (pass 19 hand read, named-minor rule B hit): death of a child after a therapeutic treatment in the facts',
|
| 104 |
+
'62016CJ0013':'injury (pass 19 hand read, minors tier 2): accident caused by a person who was a minor at the time; parental authority; excluded on doubt',
|
| 105 |
+
'62016CJ0638':'care/risk (pass 19 hand read, minors tier 2): three young minor children in the applicants\' family seeking protection; excluded on doubt',
|
| 106 |
+
'62015CJ0541':'custody/adoption (pass 19 hand read, family-terms hit): adoption of the applicant as a minor after the parents\' divorce; excluded on doubt',
|
| 107 |
+
'62016CJ0082':'family/child (hand review of a named-minor rule B hit, excluded on doubt): residence of parents of minor children, with parental authority, contact suspension and an assault conviction',
|
| 108 |
+
}
|
| 109 |
+
from named_minor_screen import screen as named_minor # shared_screens/named_minor_screen v2 (copy; rules A and B)
|
| 110 |
+
from sexual_exploitation_screen import screen as sexex # shared_screens/sexual_exploitation_screen v1 (copy)
|
| 111 |
+
from minors_text_screen import screen as minors_text # shared_screens/minors_text_screen v2 (copy; tier 1 excluded unless hand-read and kept; tier 2 logged)
|
| 112 |
+
from youth_text_screen import screen as youth_text # shared_screens/youth_text_screen v1 (copy; English full-text youth / juvenile-justice screen)
|
| 113 |
+
YOUTH_OVERRIDE={ # pass 19 hand reads # hand-reviewed public decisions that trip the youth text screen, kept as logged overrides: celex -> verdict
|
| 114 |
+
}
|
| 115 |
+
NM_KEEP={ # pass 19 hand reads # named-minor (A/B) hits read by hand in this pass (names masked) and judged false positives: celex -> verdict
|
| 116 |
+
'62015CJ0651':'false positive: Italian "figli" in company names; no child',
|
| 117 |
+
'62015CJ0573':'false positive (rule B): children\'s car seats and disability aids (goods); no specific child',
|
| 118 |
+
}
|
| 119 |
+
MINORS_KEEP={ # pass 19 hand reads # minors_text_screen v2 tier-1 hits read by hand in this pass (names masked) and judged incidental: celex -> verdict
|
| 120 |
+
'62015CJ0699':'kept: VAT exemption for children\'s education quoted from the directive; no specific child',
|
| 121 |
+
'62015CJ0162':'kept: "five years old" refers to the age of confidential information; no child',
|
| 122 |
+
'62015CJ0573':'kept: VAT rate on children\'s car seats and disability aids (goods); no specific child',
|
| 123 |
+
}
|
| 124 |
+
def screen(title,text):
|
| 125 |
+
_c=conf_screen(text)
|
| 126 |
+
if _c: return _c
|
| 127 |
+
for name,rx in RULES:
|
| 128 |
+
if rx.search(title or ''): return name
|
| 129 |
+
if YOUTH_TEXT.search(text or ''): return 'youth: NL youth-criminal markers in text'
|
| 130 |
+
if facts_family(text): return 'family: main proceedings concern divorce / parental responsibility / maintenance (facts screen)'
|
| 131 |
+
return None
|
| 132 |
+
def main(raw,out):
|
| 133 |
+
sel=json.load(open(os.path.join(raw,'selection.json'))); qsha=sel['query_sha256']
|
| 134 |
+
reqs={}
|
| 135 |
+
for l in open(os.path.join(raw,'requests.jsonl')):
|
| 136 |
+
r=json.loads(l)
|
| 137 |
+
if 'celex' in r and r.get('status')==200: reqs[r['celex']]=r
|
| 138 |
+
here=os.path.dirname(os.path.abspath(__file__)); h=lambda f:hashlib.sha256(open(f,'rb').read()).hexdigest()
|
| 139 |
+
csha=h(os.path.join(here,'collect_cellar_cj19.py')); nsha=h(os.path.abspath(__file__))
|
| 140 |
+
FAMREV=[]; MKEEP=[]; MT2=[]; YOV=[]; NMB=[]; SEAL=[]; CONFB={}; BLKB={}; rows=[]; c={'national_id':0,'iban':0,'card':0,'webmail':0}; skipped=[]; ratios=[]
|
| 141 |
+
for r in sel['rows']:
|
| 142 |
+
fn=os.path.join(raw,r['c']+'.xhtml')
|
| 143 |
+
if not os.path.exists(fn): skipped.append({'celex':r['c'],'reason':'selected but not fetched (query buffer)'}); continue
|
| 144 |
+
if len(rows)>=200: skipped.append({'celex':r['c'],'reason':'fetched, beyond 200-row cap (not included)'}); continue
|
| 145 |
+
b=open(fn,'rb').read(); soup=BeautifulSoup(b,'lxml'); body=soup.body or soup
|
| 146 |
+
title=norm(r.get('title','').replace('#',' | '))
|
| 147 |
+
raw_txt=body_text(body); full=len(''.join(body.get_text('').split()))
|
| 148 |
+
why=screen(title,raw_txt)
|
| 149 |
+
if not why and r['c'] in MANUAL: why=MANUAL[r['c']]
|
| 150 |
+
if not why:
|
| 151 |
+
_y=youth_text(raw_txt,title)
|
| 152 |
+
if _y['flag'] and r['c'] in YOUTH_OVERRIDE: YOV.append({'celex':r['c'],'hits':_y['hits'],'terms':_y['terms'],'verdict':YOUTH_OVERRIDE[r['c']]})
|
| 153 |
+
elif _y['flag']: why=f"youth: juvenile-justice markers in the full text (youth_text_screen v1): {_y['hits']} hit(s)"
|
| 154 |
+
if not why:
|
| 155 |
+
_m=minors_text(raw_txt,title)
|
| 156 |
+
if _m['tier']==1 and r['c'] in MINORS_KEEP: MKEEP.append({'celex':r['c'],'terms':_m['terms'],'verdict':MINORS_KEEP[r['c']]})
|
| 157 |
+
elif _m['tier']==1: why=f"minors: tier-1 child-specific context (minors_text_screen v2), excluded on doubt: {sorted(_m['terms'])}"
|
| 158 |
+
elif _m['tier']==2: MT2.append(r['c'])
|
| 159 |
+
if not why:
|
| 160 |
+
_se=sexex(raw_txt,title)
|
| 161 |
+
if _se['flag']: why=f"sexual-exploitation doubt (sexual_exploitation_screen v1): {_se['count']} mentions, initials-only party"
|
| 162 |
+
if not why:
|
| 163 |
+
_nm=named_minor(raw_txt)
|
| 164 |
+
if _nm['flag'] and r['c'] in NM_KEEP: NMB.append({'celex':r['c'],'rule_a':_nm['rule_a'],'rule_b':_nm['rule_b'],'verdict':NM_KEEP[r['c']]})
|
| 165 |
+
elif _nm.get('rule_a'): why=f"named minors (named_minor_screen v2 rule A): {_nm['hits']} hit(s)"
|
| 166 |
+
elif _nm['flag']: why="named minor doubt (named_minor_screen v2 rule B, excluded on doubt)"
|
| 167 |
+
if why: skipped.append({'celex':r['c'],'reason':why}); continue
|
| 168 |
+
bh=BROAD.findall(raw_txt)
|
| 169 |
+
if bh: FAMREV.append({'celex':r['c'],'hits':len(bh),'terms':sorted({x.lower() for x in bh}),'verdict':'kept: passing mention, main proceedings not family-law'})
|
| 170 |
+
sh=sealed_hits(raw_txt,title)
|
| 171 |
+
if sh: SEAL.append({'celex':r['c'],'patterns':[x[0] for x in sh],'context':[x[1][:240] for x in sh]})
|
| 172 |
+
_n=len(CONF.findall(raw_txt)); _b=len(BLANK.findall(raw_txt))
|
| 173 |
+
if _n: CONFB[r['c']]=_n
|
| 174 |
+
if _b: BLKB[r['c']]=_b
|
| 175 |
+
ratios.append(len(''.join(raw_txt.split()))/full if full else 0)
|
| 176 |
+
txt=redact(raw_txt,c); q=reqs.get(r['c'],{})
|
| 177 |
+
rows.append({'case_id':r['ecli'] or r['c'],'ecli':r['ecli'] or None,'jurisdiction':'EU','court':'Court of Justice of the European Union (Court of Justice)',
|
| 178 |
+
'court_id':'eu-cjeu','document_type':'judgment','decision_date':r['d'],'issued':None,
|
| 179 |
+
'docket_numbers':json.dumps({'celex':r['c'],'case':re.findall(r'Case[s]? (C[‑-]\d+/\d+(?: [A-Z]+)?)',title)},ensure_ascii=False),
|
| 180 |
+
'title':title,'subject':None,'procedure':None,'language':'en','parties':'','parties_note':'not extracted; names as published by the Court (its anonymisation kept as-is)',
|
| 181 |
+
'judges':None,'inhoudsindicatie':None,'text':txt,
|
| 182 |
+
'source_url':f"https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:{r['c']}",'api_url':q.get('url'),'source_retrieved_at':q.get('fetched_at'),
|
| 183 |
+
'source_sha256':hashlib.sha256(b).hexdigest(),
|
| 184 |
+
'provenance':json.dumps({'endpoint':'https://publications.europa.eu/resource/cellar/','sparql_endpoint':'https://publications.europa.eu/webapi/rdf/sparql','sparql_query_sha256':qsha,'fetched_at':q.get('fetched_at'),'collector_sha256':csha,'normalizer_sha256':nsha,'parser_version':PARSER_VERSION,'curia_url':f"https://curia.europa.eu/juris/liste.jsf?language=en&td=ALL&num={(re.findall(r'C[‑-]\d+/\d+',title) or [''])[0].replace('‑','-')}"}),
|
| 185 |
+
'license':LICENSE,'license_text':LICENSE_TEXT})
|
| 186 |
+
schema=pa.schema([(k,pa.string()) for k in rows[0].keys()])
|
| 187 |
+
t=pa.Table.from_pylist(rows,schema=schema)
|
| 188 |
+
nulls=[f.name for f in t.schema if pa.types.is_null(f.type)]; assert not nulls, nulls
|
| 189 |
+
pq.write_table(t,out,compression='zstd')
|
| 190 |
+
import statistics
|
| 191 |
+
st={'minors_tier1_kept_after_read':MKEEP,'minors_tier2_not_read':MT2,'family_facts_review':FAMREV,'youth_text_overrides':YOV,'named_minor_kept_after_review':NMB,'sealed_screen_hits':SEAL,'rows':len(rows),'redactions':c,'skipped':skipped,'court_confidential_blanks':CONFB,'blank_runs_below_threshold':BLKB,'text_ratio_min_med_max':[min(ratios),statistics.median(ratios),max(ratios)]}
|
| 192 |
+
json.dump(st,open(out+'.stats.json','w'),indent=1,ensure_ascii=False); print(len(rows),c,len(skipped),st['text_ratio_min_med_max'])
|
| 193 |
+
if __name__=='__main__': main(*sys.argv[1:3])
|
packs/eu_cj_19/scrapers/requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pyarrow==25.0.1
|
| 2 |
+
beautifulsoup4==4.15.0
|
| 3 |
+
lxml==6.1.3
|
packs/eu_cj_19/scrapers/sealed_screen.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Whole-text formal confidentiality/sealing/publication-ban screen (ca-fed-1.0 add-on).
|
| 2 |
+
Matches only formal patterns, not topic words, so cited cases and passing mentions don't trigger it."""
|
| 3 |
+
import re
|
| 4 |
+
PATTERNS=[
|
| 5 |
+
('confidentiality order', re.compile(r'(?i)\bconfidentiality order\b|\border\b[^.]{0,60}\b(?:treated as|be kept|remain|designated)\s+confidential\b')),
|
| 6 |
+
('sealing order / sealed', re.compile(r'(?i)\bsealing order\b|\b(?:shall|will|to|be|been|is|are|was|were|remain|remains|kept|placed)\s+(?:be\s+)?(?:kept\s+|placed\s+)?(?:under\s+)?seal(?:ed)?\b(?!\s+(?:of|by)\b)|\bsealed (?:record|file|portion|documents?|exhibits?|envelope|version|court file|affidavit)s?\b')),
|
| 7 |
+
('public version', re.compile(r'(?i)\bpublic version\b|\bconfidential (?:reasons|judgment|version)\b')),
|
| 8 |
+
('publication ban s.486.4/486.5', re.compile(r'(?i)(?:publication ban|order|prohibit\w*)[^.]{0,80}\b486\.[45]\b|\b486\.[45]\b[^.]{0,80}(?:publication ban|order)')),
|
| 9 |
+
]
|
| 10 |
+
DOE=re.compile(r'\b(?:John|Jane) Doe\b')
|
| 11 |
+
def hits(text,title=''):
|
| 12 |
+
"""text = full decision text; title = style of cause. 'John/Jane Doe' is matched on the style of cause only
|
| 13 |
+
(anonymised party), since the name also appears in citations."""
|
| 14 |
+
out=[]
|
| 15 |
+
if DOE.search(title): out.append(('anonymised party (John/Jane Doe)',title))
|
| 16 |
+
for name,rx in PATTERNS:
|
| 17 |
+
m=rx.search(text)
|
| 18 |
+
if m: out.append((name,text[max(0,m.start()-80):m.end()+80].replace('\n',' ')))
|
| 19 |
+
return out
|
packs/eu_cj_19/scrapers/sexual_exploitation_screen.py
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Shared sexual-exploitation doubt screen, v1.
|
| 2 |
+
|
| 3 |
+
Rule: exclude on doubt when the parties are initials-only AND the text has 10+ mentions
|
| 4 |
+
of sexual-exploitation / trafficking / sexual-assault terms (English and French).
|
| 5 |
+
Returns counts only; no names, titles or text are stored or returned.
|
| 6 |
+
|
| 7 |
+
screen(text, title=None) -> {"flag": bool, "count": int, "terms": {term_label: count}, "initials_only": bool}
|
| 8 |
+
"""
|
| 9 |
+
import re
|
| 10 |
+
|
| 11 |
+
VERSION = "v1"
|
| 12 |
+
MIN_MENTIONS = 10
|
| 13 |
+
|
| 14 |
+
TERMS = [
|
| 15 |
+
("sexual exploitation", r"sexual(?:ly)?\s+exploit\w*"),
|
| 16 |
+
("human trafficking", r"human\s+trafficking"),
|
| 17 |
+
("trafficking in persons", r"trafficking\s+in\s+(?:persons|humans|human\s+beings)"),
|
| 18 |
+
("trafficking (s. 279.01-279.04)", r"\b279\.0[1-4]\b"),
|
| 19 |
+
("sexual assault", r"sexual(?:ly)?\s+assault\w*"),
|
| 20 |
+
("sexual interference", r"sexual\s+interference"),
|
| 21 |
+
("sexual touching", r"sexual\s+touching|invitation\s+to\s+sexual\s+touching"),
|
| 22 |
+
("rape", r"\brap(?:e|ed|es|ing|ist)\b"),
|
| 23 |
+
("procuring", r"\bprocur(?:ing|ement)\b(?=[^.]{0,80}(?:sexual|prostitut))"),
|
| 24 |
+
("child pornography", r"child\s+pornograph\w*|pornographie\s+juvénile"),
|
| 25 |
+
("exploitation sexuelle", r"exploitation\s+sexuelle"),
|
| 26 |
+
("traite de personnes", r"traite\s+(?:de|des)\s+personnes"),
|
| 27 |
+
("agression sexuelle", r"agressions?\s+sexuelles?"),
|
| 28 |
+
("contacts sexuels", r"contacts?\s+sexuels?"),
|
| 29 |
+
("viol", r"\bviol(?:s|ée?s?)?\b(?!\w)"),
|
| 30 |
+
("proxénétisme", r"proxénét\w*"),
|
| 31 |
+
]
|
| 32 |
+
_RX = [(lab, re.compile(p, re.I)) for lab, p in TERMS]
|
| 33 |
+
|
| 34 |
+
# Tokens in a style of cause that are not a party name
|
| 35 |
+
_CROWN = re.compile(r"(?i)^(?:R\.?|His Majesty the King|Her Majesty the Queen|The King|The Queen|Sa Majesté le Roi|Sa Majesté la Reine|"
|
| 36 |
+
r"Attorney General(?: of [A-Z][\w .'-]+)?|Procureur général(?: du [A-Z][\w .'-]+)?|Canada(?: \(.*\))?|Minister of .*|Ministre .*)$")
|
| 37 |
+
_INIT = re.compile(r"^(?:[A-Z]\.){1,4}$|^(?:[A-Z]\.\s?){1,4}$") # T.J.F. / J. / T. J. F.
|
| 38 |
+
_SPLIT = re.compile(r"\s+(?:v\.|c\.|vs\.?)\s+")
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def _side_is_initials(side):
|
| 42 |
+
side = re.sub(r"\(.*?\)", " ", side)
|
| 43 |
+
parts = [p.strip(" ,;") for p in re.split(r",|\band\b|\bet\b", side)]
|
| 44 |
+
parts = [p for p in parts if p]
|
| 45 |
+
if not parts:
|
| 46 |
+
return False
|
| 47 |
+
for p in parts:
|
| 48 |
+
if _CROWN.match(p):
|
| 49 |
+
return False
|
| 50 |
+
compact = re.sub(r"\s+", "", p)
|
| 51 |
+
if not _INIT.match(compact):
|
| 52 |
+
return False
|
| 53 |
+
return True
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def initials_only(title):
|
| 57 |
+
"""True when at least one party side of the style of cause consists only of initials
|
| 58 |
+
(e.g. 'R. v. T.J.F.', 'A.B. v. Canada'). Crown, Attorney General, Canada and Minister parties never count as initials."""
|
| 59 |
+
if not title:
|
| 60 |
+
return False
|
| 61 |
+
t = title.split(" - ")[0].strip()
|
| 62 |
+
sides = _SPLIT.split(t)
|
| 63 |
+
if len(sides) < 2:
|
| 64 |
+
return _side_is_initials(t)
|
| 65 |
+
return any(_side_is_initials(s) for s in sides)
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
def screen(text, title=None):
|
| 69 |
+
counts = {}
|
| 70 |
+
for lab, rx in _RX:
|
| 71 |
+
n = len(rx.findall(text or ""))
|
| 72 |
+
if n:
|
| 73 |
+
counts[lab] = n
|
| 74 |
+
total = sum(counts.values())
|
| 75 |
+
io = initials_only(title)
|
| 76 |
+
return {"flag": bool(io and total >= MIN_MENTIONS), "count": total, "terms": counts, "initials_only": io}
|
packs/eu_cj_19/scrapers/test_minors_text_screen.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from minors_text_screen import screen
|
| 2 |
+
T1=["The two children, aged 8 and 13, were placed in a care facility.","She was threatened, a 10-year-old girl.",
|
| 3 |
+
"The children live in foster care with the appellant.","He arrived in Belgium as an unaccompanied minor.",
|
| 4 |
+
"She lives with her three minor children.","The father was accused of sexual abuse of his daughter.",
|
| 5 |
+
"Her son was born with a congenital heart defect and needed surgery.","The boy was taken to hospital after the injury.",
|
| 6 |
+
"A care order was made in respect of the girl."]
|
| 7 |
+
T2=["Article 2 covers minor children of the sponsor.","Member States shall protect unaccompanied minors.","Measures concerning minors in general."]
|
| 8 |
+
NEG=["This is a matter of minor importance.","A minor amendment to the regulation.","The applicant, aged 45, was dismissed.",
|
| 9 |
+
"Workers aged 60 or over.","Catches of juvenile fish.","The value added tax was refunded.",
|
| 10 |
+
"The Directive seeks to foster cooperation between Member States.",
|
| 11 |
+
"The worker suffered an injury at the plant and was taken to hospital."]
|
| 12 |
+
def test_all():
|
| 13 |
+
for t in T1: assert screen(t)['tier']==1, t
|
| 14 |
+
for t in T2: assert screen(t)['tier']==2, t
|
| 15 |
+
for t in NEG: assert not screen(t)['flag'], t
|
| 16 |
+
if __name__=='__main__': test_all(); print('OK',len(T1),'tier1',len(T2),'tier2',len(NEG),'negative')
|
packs/eu_cj_19/scrapers/test_youth_text_screen.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from youth_text_screen import screen
|
| 2 |
+
POS=["The request concerns Directive (EU) 2016/800 on procedural safeguards.",
|
| 3 |
+
"He was tried before the juvenile court at the age of 16.",
|
| 4 |
+
"The age of criminal responsibility in that Member State is 14.",
|
| 5 |
+
"The young offenders institution held the requested person.",
|
| 6 |
+
"A European arrest warrant was issued against a juvenile for theft.",
|
| 7 |
+
"The juveniles were placed in detention.",
|
| 8 |
+
"Proceedings under the juvenile justice system.",
|
| 9 |
+
"Youth detention was ordered.",
|
| 10 |
+
"The police arrested a juvenile.",
|
| 11 |
+
"He was sentenced to imprisonment or youth custody."]
|
| 12 |
+
NEG=["The project harmed juvenile pearl mussels in the river.",
|
| 13 |
+
"Catches of juvenile fish below the minimum size.",
|
| 14 |
+
"Juveniles of the species were found in the habitat.",
|
| 15 |
+
"The child benefit was refused to the applicant.",
|
| 16 |
+
"Habitat for juvenile salmon and trout.",
|
| 17 |
+
"Plain judgment on value added tax.",
|
| 18 |
+
"Sedimentation inhibits the successful restocking of the river by juveniles.",
|
| 19 |
+
"Gravels can starve juvenile [freshwater pearl mussels] of oxygen.",
|
| 20 |
+
"Technical measures for the protection of juveniles of marine organisms."]
|
| 21 |
+
def test_pos():
|
| 22 |
+
for t in POS: assert screen(t)['flag'], t
|
| 23 |
+
def test_neg():
|
| 24 |
+
for t in NEG: assert not screen(t)['flag'], t
|
| 25 |
+
if __name__=='__main__': test_pos(); test_neg(); print('OK', len(POS),'positive', len(NEG),'negative')
|
packs/eu_cj_19/scrapers/youth_text_screen.VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
v1
|
packs/eu_cj_19/scrapers/youth_text_screen.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Youth / juvenile-justice text screen (shared, v1). English, full text (title + body).
|
| 2 |
+
Flags a decision (exclude on doubt) on any hit of:
|
| 3 |
+
- Directive (EU) 2016/800 (procedural safeguards for children who are suspects or accused persons) or that phrase itself;
|
| 4 |
+
- 'juvenile(s)' in a human / criminal-justice sense: juvenile offender/court/justice/detention/delinquency/criminal/prison/suspect/
|
| 5 |
+
accused/defendant/proceedings/law, or 'juvenile(s)' anywhere EXCEPT when it describes animals or plants (precise context rule:
|
| 6 |
+
the next 1-3 words (brackets ignored) or the preceding word name an animal/plant/biological stage, e.g. 'juvenile pearl mussels',
|
| 7 |
+
'juvenile [freshwater pearl mussels]', 'juveniles of the species', or the same sentence, within 150 characters before, has an
|
| 8 |
+
ecological context word (species, habitat, river, restocking, population, spawning, breeding, fishery, aquaculture, mussel, fish));
|
| 9 |
+
- 'age of criminal responsibility', 'criminal responsibility of minors', 'young offender(s)', 'youth court/justice/detention/custody'.
|
| 10 |
+
API: screen(text, title='') -> {'flag': bool, 'hits': int, 'terms': {term: n}, 'version': 'v1'}. Returns counts only, never text."""
|
| 11 |
+
import re
|
| 12 |
+
VERSION='v1'
|
| 13 |
+
STRONG=re.compile(r"(?i)Directive \(EU\) 2016/800|Directive 2016/800|children who are suspects or accused persons|"
|
| 14 |
+
r"age of criminal (?:responsibility|liability)|criminal (?:responsibility|liability) of (?:minors|children|juveniles)|"
|
| 15 |
+
r"young offenders?|youth (?:court|justice|detention|custody|offenders?)|"
|
| 16 |
+
r"juvenile (?:offend\w*|court\w*|justice|detention|delinquen\w*|crim\w*|prison\w*|suspects?|accused|defendants?|proceedings|law|judge|institution\w*)")
|
| 17 |
+
JUV=re.compile(r"(?i)\bjuveniles?\b")
|
| 18 |
+
BIO=re.compile(r"(?i)(?:pearl|mussels?|fish\w*|birds?|animals?|species|specimens?|salmon|eels?|trout|lobsters?|crabs?|shellfish|molluscs?|"
|
| 19 |
+
r"plants?|trees?|seedlings?|stage|forms?|stock|calves|cattle|bovine|pigs?|piglets?|poultry|chicks?|larvae|hake|cod|tuna|turtles?|seals?|whales?|wolves|wolf|organisms?|marine)\b")
|
| 20 |
+
CTX=re.compile(r"(?i)\b(?:species|habitats?|river|restocking|population|spawning|breeding|fisher(?:y|ies)|aquaculture|mussels?|fish)\b")
|
| 21 |
+
def _bio(text,m):
|
| 22 |
+
after=' '.join(re.sub(r'[\[\]()]',' ',text[m.end():m.end()+60]).split()[:3]); before=text[max(0,m.start()-25):m.start()].split()[-1:]
|
| 23 |
+
if BIO.search(after) or (before and BIO.fullmatch(before[0].strip('.,;:()[]'))): return True
|
| 24 |
+
# same sentence, up to 150 characters before: an ecological context word (e.g. 'restocking of the river by juveniles')
|
| 25 |
+
sent=re.split(r'[.;!?]\s',text[max(0,m.start()-150):m.start()])[-1]
|
| 26 |
+
return bool(CTX.search(sent))
|
| 27 |
+
def screen(text,title=''):
|
| 28 |
+
s=(title or '')+'\n'+(text or ''); terms={}
|
| 29 |
+
spans=[]
|
| 30 |
+
for m in STRONG.finditer(s):
|
| 31 |
+
k=m.group(0).lower(); terms[k]=terms.get(k,0)+1; spans.append((m.start(),m.end()))
|
| 32 |
+
for m in JUV.finditer(s):
|
| 33 |
+
if any(a<=m.start()<b for a,b in spans) or _bio(s,m): continue
|
| 34 |
+
terms['juvenile (other)']=terms.get('juvenile (other)',0)+1
|
| 35 |
+
n=sum(terms.values()); return {'flag':n>0,'hits':n,'terms':terms,'version':VERSION}
|