endomorphosis commited on
Commit
63fc3cf
·
verified ·
1 Parent(s): bb8d92b

Track missing legal source for Pub. L. No. 116-136

Browse files
source_recovery/20260418_000440_pub-l-no-116-136/patches/recovery-pub-l-no-116-136-www-congress-gov.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "agent_id": "legal_source_recovery",
3
+ "applied": false,
4
+ "created_at": "2026-04-18T00:04:40.246332",
5
+ "description": "Scraper scaffold for recovered source host www.congress.gov",
6
+ "diff_content": "diff --git a/ipfs_datasets_py/processors/legal_scrapers/federal_scrapers/us_code_scraper.py b/ipfs_datasets_py/processors/legal_scrapers/federal_scrapers/us_code_scraper.py\n--- a/ipfs_datasets_py/processors/legal_scrapers/federal_scrapers/us_code_scraper.py\n+++ b/ipfs_datasets_py/processors/legal_scrapers/federal_scrapers/us_code_scraper.py\n@@\n+from typing import Any\n+\n+def _extract_recovered_www_congress_gov_text(document: Any) -> str:\n+ \"\"\"Extract text from a recovered legal source candidate.\n+\n+ Generated by the Bluebook self-healing recovery workflow after a\n+ Hugging Face corpus miss. Keep this host-specific and promote it into\n+ the surrounding scraper once validated against related corpus pages.\n+ \"\"\"\n+ metadata = dict(getattr(document, \"metadata\", {}) or {})\n+ text = str(getattr(document, \"text\", \"\") or \"\").strip()\n+ if text:\n+ return text\n+ html = str(getattr(document, \"html\", \"\") or metadata.get(\"html\", \"\") or \"\")\n+ if not html.strip():\n+ return \"\"\n+ try:\n+ from bs4 import BeautifulSoup\n+ except Exception:\n+ return html\n+ soup = BeautifulSoup(html, \"html.parser\")\n+ for selector in (\"main\", \"article\", \"#content\", \".content\", \".main-content\", \".document\", \".statute\", \".law\", \"pre\"):\n+ node = soup.select_one(selector)\n+ if node:\n+ extracted = node.get_text(\"\\n\", strip=True)\n+ if extracted:\n+ return extracted\n+ return soup.get_text(\"\\n\", strip=True)\n+\n+# Recovery notes for the scraper maintainer:\n+# citation: Pub. L. No. 116-136\n+# host: www.congress.gov\n+# candidate_url: https://www.congress.gov/public-law/116th-congress/136\n+# preferred_fetch_path: UnifiedWebArchivingAPI.fetch(url, domain=\"legal\")\n+# fallback_fetch_path: UnifiedWebScraper.scrape_sync(url)\n+# blocked_fetch_fallback: CommonCrawlSearchEngine.search_domain(host, query=search_query)\n+# hf_common_crawl_fallback: Common Crawl integration falls back to Hugging Face indexes when local CC assets are unavailable.\n",
7
+ "ipfs_cid": null,
8
+ "metadata": {
9
+ "candidate_url": "https://www.congress.gov/public-law/116th-congress/136",
10
+ "citation_text": "Pub. L. No. 116-136",
11
+ "extraction_recipe_path": "/home/barberb/.ipfs_datasets/uscode/source_recovery/20260418_000440_pub-l-no-116-136/patches/recovery-pub-l-no-116-136-www-congress-gov_extraction_recipe.json",
12
+ "host": "www.congress.gov",
13
+ "normalized_citation": "Pub. L. No. 116-136"
14
+ },
15
+ "parent_patches": [],
16
+ "patch_id": "recovery-pub-l-no-116-136-www-congress-gov",
17
+ "target_files": [
18
+ "ipfs_datasets_py/processors/legal_scrapers/federal_scrapers/us_code_scraper.py"
19
+ ],
20
+ "task_id": "citation-recovery:pub-l-no-116-136",
21
+ "validated": false,
22
+ "worktree_path": null
23
+ }
source_recovery/20260418_000440_pub-l-no-116-136/patches/recovery-pub-l-no-116-136-www-congress-gov.patch ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ diff --git a/ipfs_datasets_py/processors/legal_scrapers/federal_scrapers/us_code_scraper.py b/ipfs_datasets_py/processors/legal_scrapers/federal_scrapers/us_code_scraper.py
2
+ --- a/ipfs_datasets_py/processors/legal_scrapers/federal_scrapers/us_code_scraper.py
3
+ +++ b/ipfs_datasets_py/processors/legal_scrapers/federal_scrapers/us_code_scraper.py
4
+ @@
5
+ +from typing import Any
6
+ +
7
+ +def _extract_recovered_www_congress_gov_text(document: Any) -> str:
8
+ + """Extract text from a recovered legal source candidate.
9
+ +
10
+ + Generated by the Bluebook self-healing recovery workflow after a
11
+ + Hugging Face corpus miss. Keep this host-specific and promote it into
12
+ + the surrounding scraper once validated against related corpus pages.
13
+ + """
14
+ + metadata = dict(getattr(document, "metadata", {}) or {})
15
+ + text = str(getattr(document, "text", "") or "").strip()
16
+ + if text:
17
+ + return text
18
+ + html = str(getattr(document, "html", "") or metadata.get("html", "") or "")
19
+ + if not html.strip():
20
+ + return ""
21
+ + try:
22
+ + from bs4 import BeautifulSoup
23
+ + except Exception:
24
+ + return html
25
+ + soup = BeautifulSoup(html, "html.parser")
26
+ + for selector in ("main", "article", "#content", ".content", ".main-content", ".document", ".statute", ".law", "pre"):
27
+ + node = soup.select_one(selector)
28
+ + if node:
29
+ + extracted = node.get_text("\n", strip=True)
30
+ + if extracted:
31
+ + return extracted
32
+ + return soup.get_text("\n", strip=True)
33
+ +
34
+ +# Recovery notes for the scraper maintainer:
35
+ +# citation: Pub. L. No. 116-136
36
+ +# host: www.congress.gov
37
+ +# candidate_url: https://www.congress.gov/public-law/116th-congress/136
38
+ +# preferred_fetch_path: UnifiedWebArchivingAPI.fetch(url, domain="legal")
39
+ +# fallback_fetch_path: UnifiedWebScraper.scrape_sync(url)
40
+ +# blocked_fetch_fallback: CommonCrawlSearchEngine.search_domain(host, query=search_query)
41
+ +# hf_common_crawl_fallback: Common Crawl integration falls back to Hugging Face indexes when local CC assets are unavailable.
source_recovery/20260418_000440_pub-l-no-116-136/patches/recovery-pub-l-no-116-136-www-congress-gov_extraction_recipe.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "candidate_files": [],
3
+ "citation_text": "Pub. L. No. 116-136",
4
+ "common_crawl_fallback": "Use CommonCrawlSearchEngine.search_domain(host, query=search_query) when direct fetch is blocked by Cloudflare or similar anti-bot pages.",
5
+ "host": "www.congress.gov",
6
+ "normalized_citation": "Pub. L. No. 116-136",
7
+ "patch_intent": "Add host-specific extraction/fetch support for a legal source recovered after a Hugging Face lookup miss.",
8
+ "source_url": "https://www.congress.gov/public-law/116th-congress/136",
9
+ "target_file": "ipfs_datasets_py/processors/legal_scrapers/federal_scrapers/us_code_scraper.py"
10
+ }
source_recovery/20260418_000440_pub-l-no-116-136/recovery_manifest.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "archived_sources": [],
3
+ "candidate_files": [],
4
+ "candidates": [
5
+ {
6
+ "score": 16,
7
+ "source": "citation_url_hint",
8
+ "source_type": "current",
9
+ "title": "Public Law 116-136",
10
+ "url": "https://www.congress.gov/public-law/116th-congress/136"
11
+ }
12
+ ],
13
+ "citation_text": "Pub. L. No. 116-136",
14
+ "corpus_key": "us_code",
15
+ "generated_at": "2026-04-18T00:04:40.244757",
16
+ "hf_dataset_id": "justicedao/ipfs_uscode",
17
+ "normalized_citation": "Pub. L. No. 116-136",
18
+ "scraper_patch": {
19
+ "extraction_recipe_path": "/home/barberb/.ipfs_datasets/uscode/source_recovery/20260418_000440_pub-l-no-116-136/patches/recovery-pub-l-no-116-136-www-congress-gov_extraction_recipe.json",
20
+ "host": "www.congress.gov",
21
+ "patch_path": "/home/barberb/.ipfs_datasets/uscode/source_recovery/20260418_000440_pub-l-no-116-136/patches/recovery-pub-l-no-116-136-www-congress-gov.patch",
22
+ "rationale": "Host-specific recovery scaffold generated from discovered candidate file.",
23
+ "target_file": "ipfs_datasets_py/processors/legal_scrapers/federal_scrapers/us_code_scraper.py"
24
+ },
25
+ "search_backend_status": {
26
+ "archive_search_available": false,
27
+ "archive_search_error": "archive_search_skipped",
28
+ "brave_api_key_env": "",
29
+ "brave_configured": false,
30
+ "common_crawl_available": false,
31
+ "common_crawl_domain_count": 0,
32
+ "common_crawl_domains": [],
33
+ "common_crawl_error": "common_crawl_disabled",
34
+ "common_crawl_result_count": 0,
35
+ "common_crawl_used": false,
36
+ "datasets_available": true,
37
+ "duckduckgo_configured": true,
38
+ "engines_attempted": [],
39
+ "live_search_available": false,
40
+ "live_search_error": "live_search_skipped",
41
+ "live_search_skipped": true,
42
+ "multi_engine_error": "multi_engine_skipped",
43
+ "multi_engine_used": false
44
+ },
45
+ "search_query": "Pub. L. No. 116-136 site:uscode.house.gov OR site:govinfo.gov OR site:law.cornell.edu",
46
+ "state_code": null
47
+ }