endomorphosis commited on
Commit
21de034
·
verified ·
1 Parent(s): c365403

Add files using upload-large-folder tool

Browse files
README.md CHANGED
@@ -56,7 +56,7 @@ configs:
56
 
57
  # Saudi Arabia legislation IR (CID-keyed sparse GraphRAG)
58
 
59
- Research retrieval release of `endomorphosis/ipfs_saudiarabia_laws` (revision `730f8be56013919824dc2c23c3c1d4928eefe54a`) packaged as
60
  `country-laws-ir-graphrag/v1` (layout family `skillcenter-huggingface-release/v3` / publicus-ir).
61
 
62
  **Not legal advice.** This is a research snapshot. The official gazette /
@@ -73,13 +73,13 @@ Target Hub id (packaging metadata only): `justicedao/ipfs_saudiarabia_laws_ir`.
73
  | Field | Value |
74
  | --- | --- |
75
  | Laws (corpus units) | 0 |
76
- | Articles (corpus units) | 2600 |
77
- | Canonical docs | 2600 |
78
- | BM25 terms | 485 |
79
- | BM25 postings | 5136 |
80
- | Graph nodes | 3296 |
81
- | Graph edges | 20941 |
82
- | Vectors | 2600 × 384-d `thenlper/gte-small` (embedded) |
83
 
84
  ## Canonical fields
85
 
 
56
 
57
  # Saudi Arabia legislation IR (CID-keyed sparse GraphRAG)
58
 
59
+ Research retrieval release of `endomorphosis/ipfs_saudiarabia_laws` (revision `47bbf142ade8`) packaged as
60
  `country-laws-ir-graphrag/v1` (layout family `skillcenter-huggingface-release/v3` / publicus-ir).
61
 
62
  **Not legal advice.** This is a research snapshot. The official gazette /
 
73
  | Field | Value |
74
  | --- | --- |
75
  | Laws (corpus units) | 0 |
76
+ | Articles (corpus units) | 4664 |
77
+ | Canonical docs | 4664 |
78
+ | BM25 terms | 1498 |
79
+ | BM25 postings | 10560 |
80
+ | Graph nodes | 5353 |
81
+ | Graph edges | 45185 |
82
+ | Vectors | 4664 × 384-d `thenlper/gte-small` (embedded) |
83
 
84
  ## Canonical fields
85
 
build.py CHANGED
@@ -48,11 +48,20 @@ def build_country(
48
  raise RuntimeError(f"{country['repo']} is excluded: {country.get('skip_reason')}")
49
  repo = country["repo"]
50
  out = Path(out) if out else RELEASES / f"ipfs_{country['slug']}_laws_ir"
51
- _log(f"build start {repo} -> {out} (upload={upload})")
 
 
 
 
 
 
 
 
 
52
  configure_hf()
53
  CACHE.mkdir(parents=True, exist_ok=True)
54
  REPORTS.mkdir(parents=True, exist_ok=True)
55
- laws, articles, source_meta = load_source(repo, CACHE)
56
  _log(
57
  f"source loaded laws={source_meta['n_laws_source']} "
58
  f"articles={source_meta['n_articles_source']} rev={source_meta['source_revision']}"
 
48
  raise RuntimeError(f"{country['repo']} is excluded: {country.get('skip_reason')}")
49
  repo = country["repo"]
50
  out = Path(out) if out else RELEASES / f"ipfs_{country['slug']}_laws_ir"
51
+ local_dir = country.get("local_source_dir") or (
52
+ str(Path(source).resolve())
53
+ if Path(source).is_dir()
54
+ and (
55
+ (Path(source) / "data" / "laws.parquet").is_file()
56
+ or (Path(source) / "laws.parquet").is_file()
57
+ )
58
+ else None
59
+ )
60
+ _log(f"build start {repo} -> {out} (upload={upload}) local={local_dir}")
61
  configure_hf()
62
  CACHE.mkdir(parents=True, exist_ok=True)
63
  REPORTS.mkdir(parents=True, exist_ok=True)
64
+ laws, articles, source_meta = load_source(local_dir or repo, CACHE)
65
  _log(
66
  f"source loaded laws={source_meta['n_laws_source']} "
67
  f"articles={source_meta['n_articles_source']} rev={source_meta['source_revision']}"
country_laws_ir/build.py CHANGED
@@ -48,11 +48,20 @@ def build_country(
48
  raise RuntimeError(f"{country['repo']} is excluded: {country.get('skip_reason')}")
49
  repo = country["repo"]
50
  out = Path(out) if out else RELEASES / f"ipfs_{country['slug']}_laws_ir"
51
- _log(f"build start {repo} -> {out} (upload={upload})")
 
 
 
 
 
 
 
 
 
52
  configure_hf()
53
  CACHE.mkdir(parents=True, exist_ok=True)
54
  REPORTS.mkdir(parents=True, exist_ok=True)
55
- laws, articles, source_meta = load_source(repo, CACHE)
56
  _log(
57
  f"source loaded laws={source_meta['n_laws_source']} "
58
  f"articles={source_meta['n_articles_source']} rev={source_meta['source_revision']}"
 
48
  raise RuntimeError(f"{country['repo']} is excluded: {country.get('skip_reason')}")
49
  repo = country["repo"]
50
  out = Path(out) if out else RELEASES / f"ipfs_{country['slug']}_laws_ir"
51
+ local_dir = country.get("local_source_dir") or (
52
+ str(Path(source).resolve())
53
+ if Path(source).is_dir()
54
+ and (
55
+ (Path(source) / "data" / "laws.parquet").is_file()
56
+ or (Path(source) / "laws.parquet").is_file()
57
+ )
58
+ else None
59
+ )
60
+ _log(f"build start {repo} -> {out} (upload={upload}) local={local_dir}")
61
  configure_hf()
62
  CACHE.mkdir(parents=True, exist_ok=True)
63
  REPORTS.mkdir(parents=True, exist_ok=True)
64
+ laws, articles, source_meta = load_source(local_dir or repo, CACHE)
65
  _log(
66
  f"source loaded laws={source_meta['n_laws_source']} "
67
  f"articles={source_meta['n_articles_source']} rev={source_meta['source_revision']}"
country_laws_ir/catalog.py CHANGED
@@ -32,9 +32,12 @@ COUNTRIES: list[dict[str, Any]] = [
32
  {"slug": "eu", "repo": "endomorphosis/ipfs_eu_laws", "name": "European Union", "indexable": True},
33
  {"slug": "finland", "repo": "endomorphosis/ipfs_finland_laws", "name": "Finland", "indexable": True},
34
  {"slug": "france", "repo": "endomorphosis/ipfs_france_laws", "name": "France", "indexable": True},
 
 
35
  {"slug": "germany", "repo": "endomorphosis/ipfs_germany_laws", "name": "Germany", "indexable": True},
36
  {"slug": "greece", "repo": "endomorphosis/ipfs_greece_laws", "name": "Greece", "indexable": True},
37
  {"slug": "hongkong", "repo": "endomorphosis/ipfs_hongkong_laws", "name": "Hong Kong", "indexable": True},
 
38
  {"slug": "hungary", "repo": "endomorphosis/ipfs_hungary_laws", "name": "Hungary", "indexable": True},
39
  {"slug": "india", "repo": "endomorphosis/ipfs_india_laws", "name": "India", "indexable": True},
40
  {"slug": "indonesia", "repo": "endomorphosis/ipfs_indonesia_laws", "name": "Indonesia", "indexable": True},
@@ -50,6 +53,7 @@ COUNTRIES: list[dict[str, Any]] = [
50
  {"slug": "luxembourg", "repo": "endomorphosis/ipfs_luxembourg_laws", "name": "Luxembourg", "indexable": True},
51
  {"slug": "malaysia", "repo": "endomorphosis/ipfs_malaysia_laws", "name": "Malaysia", "indexable": True},
52
  {"slug": "malta", "repo": "endomorphosis/ipfs_malta_laws", "name": "Malta", "indexable": True, "pilot": True},
 
53
  {"slug": "mexico", "repo": "endomorphosis/ipfs_mexico_laws", "name": "Mexico", "indexable": True},
54
  {"slug": "netherlands", "repo": "endomorphosis/ipfs_netherlands_laws", "name": "Netherlands", "indexable": True},
55
  {"slug": "newzealand", "repo": "endomorphosis/ipfs_newzealand_laws", "name": "New Zealand", "indexable": True},
@@ -76,11 +80,55 @@ COUNTRIES: list[dict[str, Any]] = [
76
  {"slug": "uk", "repo": "endomorphosis/ipfs_uk_laws", "name": "United Kingdom", "indexable": True},
77
  {"slug": "ukraine", "repo": "endomorphosis/ipfs_ukraine_laws", "name": "Ukraine", "indexable": True},
78
  {"slug": "vietnam", "repo": "endomorphosis/ipfs_vietnam_laws", "name": "Vietnam", "indexable": True},
 
 
 
 
 
79
  ]
80
 
81
 
82
  def get_country(source: str) -> dict[str, Any]:
83
  source = source.strip()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  slug = source
85
  if "/" in source:
86
  slug = source.rsplit("/", 1)[-1]
 
32
  {"slug": "eu", "repo": "endomorphosis/ipfs_eu_laws", "name": "European Union", "indexable": True},
33
  {"slug": "finland", "repo": "endomorphosis/ipfs_finland_laws", "name": "Finland", "indexable": True},
34
  {"slug": "france", "repo": "endomorphosis/ipfs_france_laws", "name": "France", "indexable": True},
35
+ {"slug": "ghana", "repo": "endomorphosis/ipfs_ghana_laws", "name": "Ghana", "indexable": False,
36
+ "skip_reason": "thin scrape; Act PDF path blocked by robots"},
37
  {"slug": "germany", "repo": "endomorphosis/ipfs_germany_laws", "name": "Germany", "indexable": True},
38
  {"slug": "greece", "repo": "endomorphosis/ipfs_greece_laws", "name": "Greece", "indexable": True},
39
  {"slug": "hongkong", "repo": "endomorphosis/ipfs_hongkong_laws", "name": "Hong Kong", "indexable": True},
40
+ {"slug": "iceland", "repo": "endomorphosis/ipfs_iceland_laws", "name": "Iceland", "indexable": True},
41
  {"slug": "hungary", "repo": "endomorphosis/ipfs_hungary_laws", "name": "Hungary", "indexable": True},
42
  {"slug": "india", "repo": "endomorphosis/ipfs_india_laws", "name": "India", "indexable": True},
43
  {"slug": "indonesia", "repo": "endomorphosis/ipfs_indonesia_laws", "name": "Indonesia", "indexable": True},
 
53
  {"slug": "luxembourg", "repo": "endomorphosis/ipfs_luxembourg_laws", "name": "Luxembourg", "indexable": True},
54
  {"slug": "malaysia", "repo": "endomorphosis/ipfs_malaysia_laws", "name": "Malaysia", "indexable": True},
55
  {"slug": "malta", "repo": "endomorphosis/ipfs_malta_laws", "name": "Malta", "indexable": True, "pilot": True},
56
+ {"slug": "morocco", "repo": "endomorphosis/ipfs_morocco_laws", "name": "Morocco", "indexable": True},
57
  {"slug": "mexico", "repo": "endomorphosis/ipfs_mexico_laws", "name": "Mexico", "indexable": True},
58
  {"slug": "netherlands", "repo": "endomorphosis/ipfs_netherlands_laws", "name": "Netherlands", "indexable": True},
59
  {"slug": "newzealand", "repo": "endomorphosis/ipfs_newzealand_laws", "name": "New Zealand", "indexable": True},
 
80
  {"slug": "uk", "repo": "endomorphosis/ipfs_uk_laws", "name": "United Kingdom", "indexable": True},
81
  {"slug": "ukraine", "repo": "endomorphosis/ipfs_ukraine_laws", "name": "Ukraine", "indexable": True},
82
  {"slug": "vietnam", "repo": "endomorphosis/ipfs_vietnam_laws", "name": "Vietnam", "indexable": True},
83
+ {"slug": "bulgaria", "repo": "endomorphosis/ipfs_bulgaria_laws", "name": "Bulgaria", "indexable": True},
84
+ {"slug": "cyprus", "repo": "endomorphosis/ipfs_cyprus_laws", "name": "Cyprus", "indexable": True},
85
+ {"slug": "italy", "repo": "endomorphosis/ipfs_italy_laws", "name": "Italy", "indexable": True},
86
+ {"slug": "romania", "repo": "endomorphosis/ipfs_romania_laws", "name": "Romania", "indexable": True},
87
+ {"slug": "slovenia", "repo": "endomorphosis/ipfs_slovenia_laws", "name": "Slovenia", "indexable": True},
88
  ]
89
 
90
 
91
  def get_country(source: str) -> dict[str, Any]:
92
  source = source.strip()
93
+ # Local filtered pack: directory with data/laws.parquet (+ optional pack_meta.json)
94
+ from pathlib import Path as _Path
95
+ import json as _json
96
+
97
+ local = _Path(source)
98
+ if local.is_dir() and (
99
+ (local / "data" / "laws.parquet").is_file() or (local / "laws.parquet").is_file()
100
+ ):
101
+ pack_meta: dict[str, Any] = {}
102
+ meta_path = local / "pack_meta.json"
103
+ if meta_path.is_file():
104
+ try:
105
+ pack_meta = _json.loads(meta_path.read_text(encoding="utf-8"))
106
+ except Exception:
107
+ pack_meta = {}
108
+ slug = str(pack_meta.get("slug") or local.name)
109
+ # strip common cache prefixes like oman_filtered_c72f142a
110
+ if slug.startswith("oman"):
111
+ slug = "oman"
112
+ for prefix in ("ipfs_",):
113
+ if slug.startswith(prefix):
114
+ slug = slug[len(prefix):]
115
+ for suffix in ("_laws", "_filtered", "-ir"):
116
+ if slug.endswith(suffix):
117
+ slug = slug[: -len(suffix)]
118
+ # e.g. oman_filtered_c72f142a -> oman
119
+ if "_filtered" in slug:
120
+ slug = slug.split("_filtered", 1)[0]
121
+ repo = str(pack_meta.get("repo") or pack_meta.get("source_dataset") or f"endomorphosis/ipfs_{slug}_laws")
122
+ return {
123
+ "slug": slug,
124
+ "repo": repo,
125
+ "name": str(pack_meta.get("name") or slug.replace("_", " ").title()),
126
+ "indexable": bool(pack_meta.get("indexable", slug not in EXCLUDED_SLUGS)),
127
+ "skip_reason": pack_meta.get("skip_reason"),
128
+ "local_source_dir": str(local.resolve()),
129
+ "source_revision": pack_meta.get("source_revision"),
130
+ }
131
+
132
  slug = source
133
  if "/" in source:
134
  slug = source.rsplit("/", 1)[-1]
country_laws_ir/normalize.py CHANGED
@@ -53,7 +53,67 @@ def _download(repo_id: str, filename: str, cache_dir: Path) -> Path:
53
  return Path(path)
54
 
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  def load_source(repo_id: str, cache_dir: Path) -> tuple[pd.DataFrame, pd.DataFrame, dict[str, Any]]:
 
 
 
 
 
 
 
57
  configure_hf()
58
  os.environ.setdefault("HF_HOME", str(cache_dir / "hf"))
59
  info = dataset_info(repo_id, token=public_token())
 
53
  return Path(path)
54
 
55
 
56
+ def _resolve_local_parquet(root: Path, name: str) -> Path:
57
+ """Accept either <root>/data/<name>.parquet or <root>/<name>.parquet."""
58
+ for cand in (root / "data" / f"{name}.parquet", root / f"{name}.parquet"):
59
+ if cand.is_file():
60
+ return cand
61
+ raise FileNotFoundError(f"missing {name}.parquet under {root} (tried data/ and root)")
62
+
63
+
64
+ def load_local_source(local_dir: Path) -> tuple[pd.DataFrame, pd.DataFrame, dict[str, Any]]:
65
+ """Load a local country-laws pack (filtered preprocess layout)."""
66
+ local_dir = Path(local_dir).resolve()
67
+ laws_path = _resolve_local_parquet(local_dir, "laws")
68
+ articles_path = _resolve_local_parquet(local_dir, "articles")
69
+ laws = pd.read_parquet(laws_path)
70
+ articles = pd.read_parquet(articles_path)
71
+ validate_laws(laws)
72
+ validate_articles(articles)
73
+ pack_meta: dict[str, Any] = {}
74
+ meta_path = local_dir / "pack_meta.json"
75
+ if meta_path.is_file():
76
+ try:
77
+ pack_meta = json.loads(meta_path.read_text(encoding="utf-8"))
78
+ except Exception:
79
+ pack_meta = {}
80
+ source_dataset = (
81
+ pack_meta.get("source_dataset")
82
+ or pack_meta.get("repo")
83
+ or f"local/{local_dir.name}"
84
+ )
85
+ source_revision = str(
86
+ pack_meta.get("source_revision")
87
+ or pack_meta.get("revision")
88
+ or f"local:{local_dir.name}"
89
+ )
90
+ meta = {
91
+ "source_dataset": source_dataset,
92
+ "source_revision": source_revision,
93
+ "laws_path": str(laws_path),
94
+ "articles_path": str(articles_path),
95
+ "laws_sha256": sha256_file(laws_path),
96
+ "articles_sha256": sha256_file(articles_path),
97
+ "n_laws_source": int(len(laws)),
98
+ "n_articles_source": int(len(articles)),
99
+ "laws_columns": list(map(str, laws.columns)),
100
+ "articles_columns": list(map(str, articles.columns)),
101
+ "article_count_dtype": str(laws["article_count"].dtype) if "article_count" in laws.columns else None,
102
+ "schema_surprises": _schema_surprises(laws, articles),
103
+ "local_source_dir": str(local_dir),
104
+ "pack_meta": pack_meta,
105
+ }
106
+ return laws, articles, meta
107
+
108
+
109
  def load_source(repo_id: str, cache_dir: Path) -> tuple[pd.DataFrame, pd.DataFrame, dict[str, Any]]:
110
+ """Load Hub dataset id OR a local directory with laws/articles parquet."""
111
+ local = Path(repo_id)
112
+ if local.is_dir() and (
113
+ (local / "data" / "laws.parquet").is_file() or (local / "laws.parquet").is_file()
114
+ ):
115
+ return load_local_source(local)
116
+
117
  configure_hf()
118
  os.environ.setdefault("HF_HOME", str(cache_dir / "hf"))
119
  info = dataset_info(repo_id, token=public_token())
data/bm25/documents/part-000000.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7a545abe32c049f73d65f82bb8ccba202301b72eab936a5f0aeedba55f8ef1b5
3
- size 157061
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b30e2aa8a3ab860508a02a9e26f23778712c21ae9d2de137ee2ce3db1d2f08eb
3
+ size 233099
data/bm25/postings/part-000000.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:8410c0343aeb67dd5a546aa1388fbc1de1cc7a633670aa54567a560f0402f432
3
- size 29648
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9e4eee65e33f3248b0a26291e28eedb3aaf5ed23aa5c9598ec9d0578f3576b5b
3
+ size 61192
data/corpus/part-000000.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b57c4de226805de850ef11948004154a02ea2ac6a0e527246f8a49657f3d1248
3
- size 779153
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d4a96bc69002b19160159aa1b197835fc369919ddea7c422ff86ec113d28fd0d
3
+ size 1072923
data/corpus/part-000001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:09a34796339315d95c330c936e740a966f2b142baa9c8ef7ca271f38d731d137
3
+ size 123868
data/graph/adjacency/incoming/part-000000.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5de8d56c8c0c7a6990b8c23bad7a49f26b5ee886c4e43910ed30de4484c2655f
3
- size 904575
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1470056f8510670ca0d7415acd2036f06b4822198bfb595226fda3899aa07028
3
+ size 1919573
data/graph/adjacency/outgoing/part-000000.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:369647eaf13303d5768f8d1538171e48ace169b22b5478ad40bb1511eef32134
3
- size 912421
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:170fd7e68c564206b2787385b5f04e19a0196b7095a5a675c748b7739513a346
3
+ size 1690859
data/graph/edges/part-000001.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:307b2839629b836a3813c1fbadaf8c82a08d57f24270f569e5e1feb2194af341
3
- size 275483
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4cd2b8af88680ad1a586445e7b2885a28c8be29dfec2c0ec0ff329b6b8f41744
3
+ size 271946
data/graph/edges/part-000007.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f042a4f3ed3a1899c392363f6aac204a514da5fb614fbe75b3a08da69ecbd168
3
+ size 295317
data/graph/edges/part-000009.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f71d7008f704d2ac3940cb652e9f9095a524a20c1103702b337934feae5fe5a9
3
+ size 304736
data/graph/edges/part-000011.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3a6eeabea29335583af5848c6d69769c91881da832c1fc131b83f92b84e3ac64
3
+ size 20795
data/vectors/part-000000.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f3e42b1599b7ae1c2aa811a76d984ba4275d3d5c064ae1bb141c55cbbd215a22
3
- size 4479305
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5b93717779deb98d5e0b2d18bd2072419f14e7b105f9c313cd2c68edbf197ad8
3
+ size 6977051
data/vectors/part-000001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bb9f0548e6d01f8e47b6d342fa378a30bd0a78a6dca85f60e6ce3e6dbe485e4a
3
+ size 1269117
indexes/bm25_document_chunks.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:fd21be3dc17a87cb02e36ef7d946b5c75775f17491d7ab8c6e2914262a5c2172
3
- size 8819
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4af93d863bff15f1b8b62c9261db1bf902eaff01e30e6bb520b9622c8b23ccd9
3
+ size 9036
indexes/bm25_keyword_shards.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:fe72e6c500e76cca3b550245330c54c84253bcd41d1883c0719804d7feaf99ff
3
- size 10136
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ff35314e5060f525cc12483d3e37453be62cc2fc915261291822a8affb411da
3
+ size 10128
indexes/corpus_chunks.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:fd86f289a4a56394d13fcf121c6dc79e75c2ba52e6169e4e33bb0b58e11961f8
3
- size 8740
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6fc266aac245555e23b41c531cd932b6456c07029ca632cbf06fa2eaba2f18eb
3
+ size 8952
indexes/graph_edge_chunks.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0b037ee06ac5605ee20552ecaaddb19ce67bf00f7f3c228cb5ac385b3223c770
3
- size 9626
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dfc60ea17fa6a7a170fea4a873bcfb811af48644997c13fc5c9525551c6546ff
3
+ size 10526
indexes/graph_incoming_adjacency.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:73648bb8556008d29ebea6c6571c160980d7154602239b94d5d2ec2339447124
3
- size 11961
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:83e21c0296e8e5f2909ee77fedbb9a3b9975d31a0018899f970446ac3950af39
3
+ size 11960
indexes/graph_node_chunks.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:97918c605418afbe11256449dd0fa65e3eab56fffe61739f69a3adc8291b93a9
3
- size 8789
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:01f85730078e34c7b3e59599803e47a0215bf658b27442050fe25ad3e2cd0cea
3
+ size 8987
indexes/graph_outgoing_adjacency.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b3b44d0e283982d202728c1f88391eea76bc0371c6d6b1b9799376fca61f5f34
3
- size 11961
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6ca782503ba7ff47dacef44cc95116d3c76beefe29576164d6a8f60df1d659a1
3
+ size 12177
indexes/vector_chunks.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d603cdb5f0c51b485505f18e7998579807e93059bde8d2e91711cc5969da4ae9
3
- size 18296
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:324977ab14fdf3e64e29386f8ce041fbfe55304f3419b40b5debf4641349240f
3
+ size 22921
manifest.json CHANGED
@@ -5,12 +5,15 @@
5
  "primary_key": "entry_cid",
6
  "dataset_id": "endomorphosis/ipfs_saudiarabia_laws",
7
  "dataset_repo_id": "justicedao/ipfs_saudiarabia_laws_ir",
8
- "dataset_revision": "730f8be56013919824dc2c23c3c1d4928eefe54a",
9
  "country": {
10
  "slug": "saudiarabia",
11
  "repo": "endomorphosis/ipfs_saudiarabia_laws",
12
  "name": "Saudi Arabia",
13
- "indexable": true
 
 
 
14
  },
15
  "disclaimer": "Research snapshot. Not legal advice. The official gazette / authentic source prevails.",
16
  "bm25": {
@@ -18,35 +21,35 @@
18
  "b": 0.75,
19
  "title_weight": 5.0,
20
  "body_weight": 1.0,
21
- "average_document_length": 2.8003846153846155,
22
  "tokenizer": "fts5-unicode61-remove-diacritics-2-python/v1",
23
  "max_query_terms": 64,
24
  "posting_rows_per_record": 4096,
25
  "terms_per_shard": 4096
26
  },
27
  "counts": {
28
- "bm25_document_chunks": 1,
29
- "bm25_documents": 2600,
30
  "bm25_keyword_shards": 1,
31
- "bm25_posting_rows": 485,
32
- "bm25_postings": 5136,
33
- "bm25_terms": 485,
34
- "corpus_chunks": 1,
35
- "corpus_rows": 2600,
36
- "graph_edge_chunks": 6,
37
- "graph_edges": 20941,
38
- "graph_incoming_adjacency_edges": 20941,
39
- "graph_incoming_adjacency_rows": 904,
40
  "graph_incoming_adjacency_shards": 1,
41
- "graph_node_chunks": 1,
42
- "graph_nodes": 3296,
43
- "graph_outgoing_adjacency_edges": 20941,
44
- "graph_outgoing_adjacency_rows": 2600,
45
- "graph_outgoing_adjacency_shards": 1,
46
- "vector_chunks": 1,
47
- "vector_rows": 2600,
48
  "n_laws": 0,
49
- "n_articles": 2600
50
  },
51
  "parquet": {
52
  "compression": "zstd",
@@ -84,10 +87,10 @@
84
  "max_rows_per_chunk": 4096,
85
  "max_rows_per_centroid": 8192,
86
  "max_shards_per_centroid": 2,
87
- "default_probe_centroids": 1,
88
- "centroid_count": 1,
89
- "shard_count": 1,
90
- "n_vectors": 2600,
91
  "status": "embedded"
92
  },
93
  "canonical_fields": [
@@ -111,8 +114,8 @@
111
  "source_revision"
112
  ],
113
  "input_sha256": {
114
- "laws.parquet": "c7f4058c29ad50d0189edf8f74af6045819129872d2ea7f5dbc1b1b2b5493d95",
115
- "articles.parquet": "a3f67c09ac628f93209f2306579e58747906ed209721f60e77dd53a58dd8247a"
116
  },
117
  "model_id": "thenlper/gte-small",
118
  "cid": {
@@ -123,13 +126,13 @@
123
  },
124
  "normalization": {
125
  "source_dataset": "endomorphosis/ipfs_saudiarabia_laws",
126
- "source_revision": "730f8be56013919824dc2c23c3c1d4928eefe54a",
127
- "laws_sha256": "c7f4058c29ad50d0189edf8f74af6045819129872d2ea7f5dbc1b1b2b5493d95",
128
- "articles_sha256": "a3f67c09ac628f93209f2306579e58747906ed209721f60e77dd53a58dd8247a",
129
- "n_laws_in": 380,
130
- "n_articles_in": 2600,
131
  "unit": "article",
132
- "article_law_coverage": 6.842105263157895,
133
  "sparse_article_fallback": false,
134
  "drops": {
135
  "empty_body": 0,
@@ -143,44 +146,42 @@
143
  "duplicate_cid": []
144
  },
145
  "language_breakdown": {
146
- "ar": 2364,
147
- "en": 236
148
  },
149
  "quality_flags": {
150
  "articles_table_empty": false,
151
  "sparse_article_fallback": false,
152
- "article_law_coverage": 6.842105263157895,
153
  "all_source_article_counts_zero": false,
154
  "article_extraction_status_counts": {
155
- "ok": 236,
156
- "missing": 144
157
  },
158
- "missing_date": true,
159
- "missing_date_issued": true,
160
  "eli_present": false,
161
  "never_invented_legal_text": true,
162
  "empty_bodies_dropped": 0,
163
  "duplicate_cids_dropped": 0
164
  },
165
  "schema_surprises": [
166
- "laws.article_count dtype=int32",
167
- "laws.date is entirely null",
168
- "laws.date_issued is entirely null",
169
- "laws.eli non-null=0/380",
170
  "laws.language values=['ar', 'en']"
171
  ],
172
- "n_out": 2600,
173
  "never_invented_legal_text": true,
174
- "n_before_dedupe": 2600,
175
  "n_dropped_total": 0,
176
  "record_type_breakdown": {
177
- "article": 2600
178
  },
179
  "jurisdiction_breakdown": {
180
- "SA": 2600
181
  },
182
  "snapshot_dates": [
183
- "2026-09-02"
184
  ]
185
  },
186
  "schema_mapping": {
@@ -188,7 +189,7 @@
188
  "id": "instrument_id",
189
  "title": "instrument_title",
190
  "text": "body",
191
- "article_count_dtype_source": "int32"
192
  },
193
  "articles": {
194
  "id": "source_id / article identity",
@@ -213,63 +214,63 @@
213
  },
214
  "indexes": {
215
  "bm25_document_chunks": {
216
- "cid": "bafkreih5eg7d3ql2q7fqfy3o67munnohk527c5er26vyy3rjcqtcuxbboi",
217
- "sha256": "fd21be3dc17a87cb02e36ef7d946b5c75775f17491d7ab8c6e2914262a5c2172",
218
- "size_bytes": 8819,
219
  "relative_path": "indexes/bm25_document_chunks.parquet"
220
  },
221
  "bm25_keyword_shards": {
222
- "cid": "bafkreih6oltmkahhntfdwviciuzqyvgiijj3zva5dcb4a4myatl75l4z74",
223
- "sha256": "fe72e6c500e76cca3b550245330c54c84253bcd41d1883c0719804d7feaf99ff",
224
- "size_bytes": 10136,
225
  "relative_path": "indexes/bm25_keyword_shards.parquet"
226
  },
227
  "corpus_chunks": {
228
- "cid": "bafkreih5q3zitjffmokncp6pciog3r46oxbluuxgc2pe4m53bnmocglb7a",
229
- "sha256": "fd86f289a4a56394d13fcf121c6dc79e75c2ba52e6169e4e33bb0b58e11961f8",
230
- "size_bytes": 8740,
231
  "relative_path": "indexes/corpus_chunks.parquet"
232
  },
233
  "graph_edge_chunks": {
234
- "cid": "bafkreialan7oa2wfmbpoebks5svn3mm44z57ad37hqriznnmhbntei6hoa",
235
- "sha256": "0b037ee06ac5605ee20552ecaaddb19ce67bf00f7f3c228cb5ac385b3223c770",
236
- "size_bytes": 9626,
237
  "relative_path": "indexes/graph_edge_chunks.parquet"
238
  },
239
  "graph_incoming_adjacency": {
240
- "cid": "bafkreidtmsf3qvlabdjj5pvgyzlryfqjqdlrkrqceonzjvos5qrtsrdreq",
241
- "sha256": "73648bb8556008d29ebea6c6571c160980d7154602239b94d5d2ec2339447124",
242
- "size_bytes": 11961,
243
  "relative_path": "indexes/graph_incoming_adjacency.parquet"
244
  },
245
  "graph_node_chunks": {
246
- "cid": "bafkreiexsgggavayv67bcjlejhoq7js6h2vvn776mfzz62ndvxecsg4tve",
247
- "sha256": "97918c605418afbe11256449dd0fa65e3eab56fffe61739f69a3adc8291b93a9",
248
- "size_bytes": 8789,
249
  "relative_path": "indexes/graph_node_chunks.parquet"
250
  },
251
  "graph_outgoing_adjacency": {
252
- "cid": "bafkreiftwrgq4kbzqljae4umd6edshxko26ag4og22y3s6mto36kmh27gq",
253
- "sha256": "b3b44d0e283982d202728c1f88391eea76bc0371c6d6b1b9799376fca61f5f34",
254
- "size_bytes": 11961,
255
  "relative_path": "indexes/graph_outgoing_adjacency.parquet"
256
  },
257
  "vector_chunks": {
258
- "cid": "bafkreigwapg3l4gfdnefkbprrz4zqv4ya7utawn55djosfyrzrmwtwsk5e",
259
- "sha256": "d603cdb5f0c51b485505f18e7998579807e93059bde8d2e91711cc5969da4ae9",
260
- "size_bytes": 18296,
261
  "relative_path": "indexes/vector_chunks.parquet"
262
  }
263
  },
264
  "source": {
265
  "source_dataset": "endomorphosis/ipfs_saudiarabia_laws",
266
- "source_revision": "730f8be56013919824dc2c23c3c1d4928eefe54a",
267
- "laws_path": "/workspace/country-laws-ir/cache/hf/datasets--endomorphosis--ipfs_saudiarabia_laws/snapshots/730f8be56013919824dc2c23c3c1d4928eefe54a/data/laws.parquet",
268
- "articles_path": "/workspace/country-laws-ir/cache/hf/datasets--endomorphosis--ipfs_saudiarabia_laws/snapshots/730f8be56013919824dc2c23c3c1d4928eefe54a/data/articles.parquet",
269
- "laws_sha256": "c7f4058c29ad50d0189edf8f74af6045819129872d2ea7f5dbc1b1b2b5493d95",
270
- "articles_sha256": "a3f67c09ac628f93209f2306579e58747906ed209721f60e77dd53a58dd8247a",
271
- "n_laws_source": 380,
272
- "n_articles_source": 2600,
273
  "laws_columns": [
274
  "id",
275
  "title",
@@ -302,13 +303,23 @@
302
  "record_type",
303
  "metadata_json"
304
  ],
305
- "article_count_dtype": "int32",
306
  "schema_surprises": [
307
- "laws.article_count dtype=int32",
308
- "laws.date is entirely null",
309
- "laws.date_issued is entirely null",
310
- "laws.eli non-null=0/380",
311
  "laws.language values=['ar', 'en']"
312
- ]
 
 
 
 
 
 
 
 
 
 
 
 
313
  }
314
  }
 
5
  "primary_key": "entry_cid",
6
  "dataset_id": "endomorphosis/ipfs_saudiarabia_laws",
7
  "dataset_repo_id": "justicedao/ipfs_saudiarabia_laws_ir",
8
+ "dataset_revision": "47bbf142ade8",
9
  "country": {
10
  "slug": "saudiarabia",
11
  "repo": "endomorphosis/ipfs_saudiarabia_laws",
12
  "name": "Saudi Arabia",
13
+ "indexable": true,
14
+ "skip_reason": null,
15
+ "local_source_dir": "/workspace/country-laws-ir/cache/saudi_filtered_47bbf142",
16
+ "source_revision": "47bbf142ade8"
17
  },
18
  "disclaimer": "Research snapshot. Not legal advice. The official gazette / authentic source prevails.",
19
  "bm25": {
 
21
  "b": 0.75,
22
  "title_weight": 5.0,
23
  "body_weight": 1.0,
24
+ "average_document_length": 5.600771869639794,
25
  "tokenizer": "fts5-unicode61-remove-diacritics-2-python/v1",
26
  "max_query_terms": 64,
27
  "posting_rows_per_record": 4096,
28
  "terms_per_shard": 4096
29
  },
30
  "counts": {
31
+ "bm25_document_chunks": 2,
32
+ "bm25_documents": 4664,
33
  "bm25_keyword_shards": 1,
34
+ "bm25_posting_rows": 1498,
35
+ "bm25_postings": 10560,
36
+ "bm25_terms": 1498,
37
+ "corpus_chunks": 2,
38
+ "corpus_rows": 4664,
39
+ "graph_edge_chunks": 12,
40
+ "graph_edges": 45185,
41
+ "graph_incoming_adjacency_edges": 45185,
42
+ "graph_incoming_adjacency_rows": 2445,
43
  "graph_incoming_adjacency_shards": 1,
44
+ "graph_node_chunks": 2,
45
+ "graph_nodes": 5353,
46
+ "graph_outgoing_adjacency_edges": 45185,
47
+ "graph_outgoing_adjacency_rows": 4664,
48
+ "graph_outgoing_adjacency_shards": 2,
49
+ "vector_chunks": 2,
50
+ "vector_rows": 4664,
51
  "n_laws": 0,
52
+ "n_articles": 4664
53
  },
54
  "parquet": {
55
  "compression": "zstd",
 
87
  "max_rows_per_chunk": 4096,
88
  "max_rows_per_centroid": 8192,
89
  "max_shards_per_centroid": 2,
90
+ "default_probe_centroids": 2,
91
+ "centroid_count": 2,
92
+ "shard_count": 2,
93
+ "n_vectors": 4664,
94
  "status": "embedded"
95
  },
96
  "canonical_fields": [
 
114
  "source_revision"
115
  ],
116
  "input_sha256": {
117
+ "laws.parquet": "71842e905fd18d1b13f19d5dc02288a5909765c377b06b86b145862702ade3f8",
118
+ "articles.parquet": "c57d41b22c1d0210dc7d25bd3e0da8f5c16a3f50c0935896ed512db3b979a0a2"
119
  },
120
  "model_id": "thenlper/gte-small",
121
  "cid": {
 
126
  },
127
  "normalization": {
128
  "source_dataset": "endomorphosis/ipfs_saudiarabia_laws",
129
+ "source_revision": "47bbf142ade8",
130
+ "laws_sha256": "71842e905fd18d1b13f19d5dc02288a5909765c377b06b86b145862702ade3f8",
131
+ "articles_sha256": "c57d41b22c1d0210dc7d25bd3e0da8f5c16a3f50c0935896ed512db3b979a0a2",
132
+ "n_laws_in": 623,
133
+ "n_articles_in": 4664,
134
  "unit": "article",
135
+ "article_law_coverage": 7.486356340288925,
136
  "sparse_article_fallback": false,
137
  "drops": {
138
  "empty_body": 0,
 
146
  "duplicate_cid": []
147
  },
148
  "language_breakdown": {
149
+ "ar": 4400,
150
+ "en": 264
151
  },
152
  "quality_flags": {
153
  "articles_table_empty": false,
154
  "sparse_article_fallback": false,
155
+ "article_law_coverage": 7.486356340288925,
156
  "all_source_article_counts_zero": false,
157
  "article_extraction_status_counts": {
158
+ "ok": 232,
159
+ "missing": 391
160
  },
161
+ "missing_date": false,
162
+ "missing_date_issued": false,
163
  "eli_present": false,
164
  "never_invented_legal_text": true,
165
  "empty_bodies_dropped": 0,
166
  "duplicate_cids_dropped": 0
167
  },
168
  "schema_surprises": [
169
+ "laws.article_count dtype=int64",
170
+ "laws.eli non-null=0/623",
 
 
171
  "laws.language values=['ar', 'en']"
172
  ],
173
+ "n_out": 4664,
174
  "never_invented_legal_text": true,
175
+ "n_before_dedupe": 4664,
176
  "n_dropped_total": 0,
177
  "record_type_breakdown": {
178
+ "article": 4664
179
  },
180
  "jurisdiction_breakdown": {
181
+ "SA": 4664
182
  },
183
  "snapshot_dates": [
184
+ "2026-09-04"
185
  ]
186
  },
187
  "schema_mapping": {
 
189
  "id": "instrument_id",
190
  "title": "instrument_title",
191
  "text": "body",
192
+ "article_count_dtype_source": "int64"
193
  },
194
  "articles": {
195
  "id": "source_id / article identity",
 
214
  },
215
  "indexes": {
216
  "bm25_document_chunks": {
217
+ "cid": "bafkreick7e6ymo77cxy3rnrmsjq5wg7zalvp6apdbzv3kifzmiwiwi6m3e",
218
+ "sha256": "4af93d863bff15f1b8b62c9261db1bf902eaff01e30e6bb520b9622c8b23ccd9",
219
+ "size_bytes": 9036,
220
  "relative_path": "indexes/bm25_document_chunks.parquet"
221
  },
222
  "bm25_keyword_shards": {
223
+ "cid": "bafkreie76njrjzigb5jfzqjeqpj6g5ctxzrmyl6jcutbfemcfkfp7nar3i",
224
+ "sha256": "9ff35314e5060f525cc12483d3e37453be62cc2fc915261291822a8affb411da",
225
+ "size_bytes": 10128,
226
  "relative_path": "indexes/bm25_keyword_shards.parquet"
227
  },
228
  "corpus_chunks": {
229
+ "cid": "bafkreidpyjtkvqsfkvpchna4kmonsmvwivwaoau4uyzmx4dpulvlulyy5m",
230
+ "sha256": "6fc266aac245555e23b41c531cd932b6456c07029ca632cbf06fa2eaba2f18eb",
231
+ "size_bytes": 8952,
232
  "relative_path": "indexes/corpus_chunks.parquet"
233
  },
234
  "graph_edge_chunks": {
235
+ "cid": "bafkreig7yyhkc75gu6qxb7vevbz3z64bdl2imrezpqj7yxevevkryzkg74",
236
+ "sha256": "dfc60ea17fa6a7a170fea4a873bcfb811af48644997c13fc5c9525551c6546ff",
237
+ "size_bytes": 10526,
238
  "relative_path": "indexes/graph_edge_chunks.parquet"
239
  },
240
  "graph_incoming_adjacency": {
241
+ "cid": "bafkreied4ioaffxi4xzjbhxhp7w3xgr3tf25ggqadcez7fyei2wdsufphe",
242
+ "sha256": "83e21c0296e8e5f2909ee77fedbb9a3b9975d31a0018899f970446ac3950af39",
243
+ "size_bytes": 11960,
244
  "relative_path": "indexes/graph_incoming_adjacency.parquet"
245
  },
246
  "graph_node_chunks": {
247
+ "cid": "bafkreiab7bltab4ogtd3hzmvtgad4r5aefn7mwfsorbakd7cllj6ftim5i",
248
+ "sha256": "01f85730078e34c7b3e59599803e47a0215bf658b27442050fe25ad3e2cd0cea",
249
+ "size_bytes": 8987,
250
  "relative_path": "indexes/graph_node_chunks.parquet"
251
  },
252
  "graph_outgoing_adjacency": {
253
+ "cid": "bafkreidmu6bfao5h75d5vtxujtevcfwty5v657rjk5qwjvvi6yg7dvszue",
254
+ "sha256": "6ca782503ba7ff47dacef44cc95116d3c76beefe29576164d6a8f60df1d659a1",
255
+ "size_bytes": 12177,
256
  "relative_path": "indexes/graph_outgoing_adjacency.parquet"
257
  },
258
  "vector_chunks": {
259
+ "cid": "bafkreibsjf32wfh56pte4kjyn6goaqp37zktatzudg2awxpl6rsbgsjeb4",
260
+ "sha256": "324977ab14fdf3e64e29386f8ce041fbfe55304f3419b40b5debf4641349240f",
261
+ "size_bytes": 22921,
262
  "relative_path": "indexes/vector_chunks.parquet"
263
  }
264
  },
265
  "source": {
266
  "source_dataset": "endomorphosis/ipfs_saudiarabia_laws",
267
+ "source_revision": "47bbf142ade8",
268
+ "laws_path": "/workspace/country-laws-ir/cache/saudi_filtered_47bbf142/data/laws.parquet",
269
+ "articles_path": "/workspace/country-laws-ir/cache/saudi_filtered_47bbf142/data/articles.parquet",
270
+ "laws_sha256": "71842e905fd18d1b13f19d5dc02288a5909765c377b06b86b145862702ade3f8",
271
+ "articles_sha256": "c57d41b22c1d0210dc7d25bd3e0da8f5c16a3f50c0935896ed512db3b979a0a2",
272
+ "n_laws_source": 623,
273
+ "n_articles_source": 4664,
274
  "laws_columns": [
275
  "id",
276
  "title",
 
303
  "record_type",
304
  "metadata_json"
305
  ],
306
+ "article_count_dtype": "int64",
307
  "schema_surprises": [
308
+ "laws.article_count dtype=int64",
309
+ "laws.eli non-null=0/623",
 
 
310
  "laws.language values=['ar', 'en']"
311
+ ],
312
+ "local_source_dir": "/workspace/country-laws-ir/cache/saudi_filtered_47bbf142",
313
+ "pack_meta": {
314
+ "slug": "saudiarabia",
315
+ "name": "Saudi Arabia",
316
+ "repo": "endomorphosis/ipfs_saudiarabia_laws",
317
+ "source_dataset": "endomorphosis/ipfs_saudiarabia_laws",
318
+ "source_revision": "47bbf142ade8",
319
+ "publish_revision_note": "98e4e98014b9 (local PUBLISH_STATUS); Hub tip HEAD 47bbf142ade8",
320
+ "filtered": true,
321
+ "filter_reason": "soft article filter: drop form-UI (رمز التحقق / حقل المادة مطلوب) + empty title-only stubs (text len<30)",
322
+ "indexable": true
323
+ }
324
  }
325
  }
normalization_report.json CHANGED
@@ -1,12 +1,12 @@
1
  {
2
  "source_dataset": "endomorphosis/ipfs_saudiarabia_laws",
3
- "source_revision": "730f8be56013919824dc2c23c3c1d4928eefe54a",
4
- "laws_sha256": "c7f4058c29ad50d0189edf8f74af6045819129872d2ea7f5dbc1b1b2b5493d95",
5
- "articles_sha256": "a3f67c09ac628f93209f2306579e58747906ed209721f60e77dd53a58dd8247a",
6
- "n_laws_in": 380,
7
- "n_articles_in": 2600,
8
  "unit": "article",
9
- "article_law_coverage": 6.842105263157895,
10
  "sparse_article_fallback": false,
11
  "drops": {
12
  "empty_body": 0,
@@ -20,43 +20,41 @@
20
  "duplicate_cid": []
21
  },
22
  "language_breakdown": {
23
- "ar": 2364,
24
- "en": 236
25
  },
26
  "quality_flags": {
27
  "articles_table_empty": false,
28
  "sparse_article_fallback": false,
29
- "article_law_coverage": 6.842105263157895,
30
  "all_source_article_counts_zero": false,
31
  "article_extraction_status_counts": {
32
- "ok": 236,
33
- "missing": 144
34
  },
35
- "missing_date": true,
36
- "missing_date_issued": true,
37
  "eli_present": false,
38
  "never_invented_legal_text": true,
39
  "empty_bodies_dropped": 0,
40
  "duplicate_cids_dropped": 0
41
  },
42
  "schema_surprises": [
43
- "laws.article_count dtype=int32",
44
- "laws.date is entirely null",
45
- "laws.date_issued is entirely null",
46
- "laws.eli non-null=0/380",
47
  "laws.language values=['ar', 'en']"
48
  ],
49
- "n_out": 2600,
50
  "never_invented_legal_text": true,
51
- "n_before_dedupe": 2600,
52
  "n_dropped_total": 0,
53
  "record_type_breakdown": {
54
- "article": 2600
55
  },
56
  "jurisdiction_breakdown": {
57
- "SA": 2600
58
  },
59
  "snapshot_dates": [
60
- "2026-09-02"
61
  ]
62
  }
 
1
  {
2
  "source_dataset": "endomorphosis/ipfs_saudiarabia_laws",
3
+ "source_revision": "47bbf142ade8",
4
+ "laws_sha256": "71842e905fd18d1b13f19d5dc02288a5909765c377b06b86b145862702ade3f8",
5
+ "articles_sha256": "c57d41b22c1d0210dc7d25bd3e0da8f5c16a3f50c0935896ed512db3b979a0a2",
6
+ "n_laws_in": 623,
7
+ "n_articles_in": 4664,
8
  "unit": "article",
9
+ "article_law_coverage": 7.486356340288925,
10
  "sparse_article_fallback": false,
11
  "drops": {
12
  "empty_body": 0,
 
20
  "duplicate_cid": []
21
  },
22
  "language_breakdown": {
23
+ "ar": 4400,
24
+ "en": 264
25
  },
26
  "quality_flags": {
27
  "articles_table_empty": false,
28
  "sparse_article_fallback": false,
29
+ "article_law_coverage": 7.486356340288925,
30
  "all_source_article_counts_zero": false,
31
  "article_extraction_status_counts": {
32
+ "ok": 232,
33
+ "missing": 391
34
  },
35
+ "missing_date": false,
36
+ "missing_date_issued": false,
37
  "eli_present": false,
38
  "never_invented_legal_text": true,
39
  "empty_bodies_dropped": 0,
40
  "duplicate_cids_dropped": 0
41
  },
42
  "schema_surprises": [
43
+ "laws.article_count dtype=int64",
44
+ "laws.eli non-null=0/623",
 
 
45
  "laws.language values=['ar', 'en']"
46
  ],
47
+ "n_out": 4664,
48
  "never_invented_legal_text": true,
49
+ "n_before_dedupe": 4664,
50
  "n_dropped_total": 0,
51
  "record_type_breakdown": {
52
+ "article": 4664
53
  },
54
  "jurisdiction_breakdown": {
55
+ "SA": 4664
56
  },
57
  "snapshot_dates": [
58
+ "2026-09-04"
59
  ]
60
  }
normalize.py CHANGED
@@ -53,7 +53,67 @@ def _download(repo_id: str, filename: str, cache_dir: Path) -> Path:
53
  return Path(path)
54
 
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  def load_source(repo_id: str, cache_dir: Path) -> tuple[pd.DataFrame, pd.DataFrame, dict[str, Any]]:
 
 
 
 
 
 
 
57
  configure_hf()
58
  os.environ.setdefault("HF_HOME", str(cache_dir / "hf"))
59
  info = dataset_info(repo_id, token=public_token())
 
53
  return Path(path)
54
 
55
 
56
+ def _resolve_local_parquet(root: Path, name: str) -> Path:
57
+ """Accept either <root>/data/<name>.parquet or <root>/<name>.parquet."""
58
+ for cand in (root / "data" / f"{name}.parquet", root / f"{name}.parquet"):
59
+ if cand.is_file():
60
+ return cand
61
+ raise FileNotFoundError(f"missing {name}.parquet under {root} (tried data/ and root)")
62
+
63
+
64
+ def load_local_source(local_dir: Path) -> tuple[pd.DataFrame, pd.DataFrame, dict[str, Any]]:
65
+ """Load a local country-laws pack (filtered preprocess layout)."""
66
+ local_dir = Path(local_dir).resolve()
67
+ laws_path = _resolve_local_parquet(local_dir, "laws")
68
+ articles_path = _resolve_local_parquet(local_dir, "articles")
69
+ laws = pd.read_parquet(laws_path)
70
+ articles = pd.read_parquet(articles_path)
71
+ validate_laws(laws)
72
+ validate_articles(articles)
73
+ pack_meta: dict[str, Any] = {}
74
+ meta_path = local_dir / "pack_meta.json"
75
+ if meta_path.is_file():
76
+ try:
77
+ pack_meta = json.loads(meta_path.read_text(encoding="utf-8"))
78
+ except Exception:
79
+ pack_meta = {}
80
+ source_dataset = (
81
+ pack_meta.get("source_dataset")
82
+ or pack_meta.get("repo")
83
+ or f"local/{local_dir.name}"
84
+ )
85
+ source_revision = str(
86
+ pack_meta.get("source_revision")
87
+ or pack_meta.get("revision")
88
+ or f"local:{local_dir.name}"
89
+ )
90
+ meta = {
91
+ "source_dataset": source_dataset,
92
+ "source_revision": source_revision,
93
+ "laws_path": str(laws_path),
94
+ "articles_path": str(articles_path),
95
+ "laws_sha256": sha256_file(laws_path),
96
+ "articles_sha256": sha256_file(articles_path),
97
+ "n_laws_source": int(len(laws)),
98
+ "n_articles_source": int(len(articles)),
99
+ "laws_columns": list(map(str, laws.columns)),
100
+ "articles_columns": list(map(str, articles.columns)),
101
+ "article_count_dtype": str(laws["article_count"].dtype) if "article_count" in laws.columns else None,
102
+ "schema_surprises": _schema_surprises(laws, articles),
103
+ "local_source_dir": str(local_dir),
104
+ "pack_meta": pack_meta,
105
+ }
106
+ return laws, articles, meta
107
+
108
+
109
  def load_source(repo_id: str, cache_dir: Path) -> tuple[pd.DataFrame, pd.DataFrame, dict[str, Any]]:
110
+ """Load Hub dataset id OR a local directory with laws/articles parquet."""
111
+ local = Path(repo_id)
112
+ if local.is_dir() and (
113
+ (local / "data" / "laws.parquet").is_file() or (local / "laws.parquet").is_file()
114
+ ):
115
+ return load_local_source(local)
116
+
117
  configure_hf()
118
  os.environ.setdefault("HF_HOME", str(cache_dir / "hf"))
119
  info = dataset_info(repo_id, token=public_token())
reports/normalization.json CHANGED
@@ -1,12 +1,12 @@
1
  {
2
  "source_dataset": "endomorphosis/ipfs_saudiarabia_laws",
3
- "source_revision": "730f8be56013919824dc2c23c3c1d4928eefe54a",
4
- "laws_sha256": "c7f4058c29ad50d0189edf8f74af6045819129872d2ea7f5dbc1b1b2b5493d95",
5
- "articles_sha256": "a3f67c09ac628f93209f2306579e58747906ed209721f60e77dd53a58dd8247a",
6
- "n_laws_in": 380,
7
- "n_articles_in": 2600,
8
  "unit": "article",
9
- "article_law_coverage": 6.842105263157895,
10
  "sparse_article_fallback": false,
11
  "drops": {
12
  "empty_body": 0,
@@ -20,43 +20,41 @@
20
  "duplicate_cid": []
21
  },
22
  "language_breakdown": {
23
- "ar": 2364,
24
- "en": 236
25
  },
26
  "quality_flags": {
27
  "articles_table_empty": false,
28
  "sparse_article_fallback": false,
29
- "article_law_coverage": 6.842105263157895,
30
  "all_source_article_counts_zero": false,
31
  "article_extraction_status_counts": {
32
- "ok": 236,
33
- "missing": 144
34
  },
35
- "missing_date": true,
36
- "missing_date_issued": true,
37
  "eli_present": false,
38
  "never_invented_legal_text": true,
39
  "empty_bodies_dropped": 0,
40
  "duplicate_cids_dropped": 0
41
  },
42
  "schema_surprises": [
43
- "laws.article_count dtype=int32",
44
- "laws.date is entirely null",
45
- "laws.date_issued is entirely null",
46
- "laws.eli non-null=0/380",
47
  "laws.language values=['ar', 'en']"
48
  ],
49
- "n_out": 2600,
50
  "never_invented_legal_text": true,
51
- "n_before_dedupe": 2600,
52
  "n_dropped_total": 0,
53
  "record_type_breakdown": {
54
- "article": 2600
55
  },
56
  "jurisdiction_breakdown": {
57
- "SA": 2600
58
  },
59
  "snapshot_dates": [
60
- "2026-09-02"
61
  ]
62
  }
 
1
  {
2
  "source_dataset": "endomorphosis/ipfs_saudiarabia_laws",
3
+ "source_revision": "47bbf142ade8",
4
+ "laws_sha256": "71842e905fd18d1b13f19d5dc02288a5909765c377b06b86b145862702ade3f8",
5
+ "articles_sha256": "c57d41b22c1d0210dc7d25bd3e0da8f5c16a3f50c0935896ed512db3b979a0a2",
6
+ "n_laws_in": 623,
7
+ "n_articles_in": 4664,
8
  "unit": "article",
9
+ "article_law_coverage": 7.486356340288925,
10
  "sparse_article_fallback": false,
11
  "drops": {
12
  "empty_body": 0,
 
20
  "duplicate_cid": []
21
  },
22
  "language_breakdown": {
23
+ "ar": 4400,
24
+ "en": 264
25
  },
26
  "quality_flags": {
27
  "articles_table_empty": false,
28
  "sparse_article_fallback": false,
29
+ "article_law_coverage": 7.486356340288925,
30
  "all_source_article_counts_zero": false,
31
  "article_extraction_status_counts": {
32
+ "ok": 232,
33
+ "missing": 391
34
  },
35
+ "missing_date": false,
36
+ "missing_date_issued": false,
37
  "eli_present": false,
38
  "never_invented_legal_text": true,
39
  "empty_bodies_dropped": 0,
40
  "duplicate_cids_dropped": 0
41
  },
42
  "schema_surprises": [
43
+ "laws.article_count dtype=int64",
44
+ "laws.eli non-null=0/623",
 
 
45
  "laws.language values=['ar', 'en']"
46
  ],
47
+ "n_out": 4664,
48
  "never_invented_legal_text": true,
49
+ "n_before_dedupe": 4664,
50
  "n_dropped_total": 0,
51
  "record_type_breakdown": {
52
+ "article": 4664
53
  },
54
  "jurisdiction_breakdown": {
55
+ "SA": 4664
56
  },
57
  "snapshot_dates": [
58
+ "2026-09-04"
59
  ]
60
  }