Track missing legal source for Pub. L. No. 115-232
Browse filesFiles changed (4)
- source_recovery/20260418_024619_pub-l-no-115-232/patches/recovery-pub-l-no-115-232-www-congress-gov.jsonAdded+23
- source_recovery/20260418_024619_pub-l-no-115-232/patches/recovery-pub-l-no-115-232-www-congress-gov.patchAdded+41
- source_recovery/20260418_024619_pub-l-no-115-232/patches/recovery-pub-l-no-115-232-www-congress-gov_extraction_recipe.jsonAdded+10
- source_recovery/20260418_024619_pub-l-no-115-232/recovery_manifest.jsonAdded+47
1234567891011121314151617181920212223{ "agent_id": "legal_source_recovery", "applied": false, "created_at": "2026-04-18T02:46:19.532746", "description": "Scraper scaffold for recovered source host www.congress.gov", "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. 115-232\n+# host: www.congress.gov\n+# candidate_url: https://www.congress.gov/public-law/115th-congress/232\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", "ipfs_cid": null, "metadata": { "candidate_url": "https://www.congress.gov/public-law/115th-congress/232", "citation_text": "Pub. L. No. 115-232", "extraction_recipe_path": "/home/barberb/.ipfs_datasets/uscode/source_recovery/20260418_024619_pub-l-no-115-232/patches/recovery-pub-l-no-115-232-www-congress-gov_extraction_recipe.json", "host": "www.congress.gov", "normalized_citation": "Pub. L. No. 115-232" }, "parent_patches": [], "patch_id": "recovery-pub-l-no-115-232-www-congress-gov", "target_files": [ "ipfs_datasets_py/processors/legal_scrapers/federal_scrapers/us_code_scraper.py" ], "task_id": "citation-recovery:pub-l-no-115-232", "validated": false, "worktree_path": null}1234567891011121314151617181920212223242526272829303132333435363738394041diff --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--- 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@@+from typing import Any++def _extract_recovered_www_congress_gov_text(document: Any) -> str:+ """Extract text from a recovered legal source candidate.++ Generated by the Bluebook self-healing recovery workflow after a+ Hugging Face corpus miss. Keep this host-specific and promote it into+ the surrounding scraper once validated against related corpus pages.+ """+ metadata = dict(getattr(document, "metadata", {}) or {})+ text = str(getattr(document, "text", "") or "").strip()+ if text:+ return text+ html = str(getattr(document, "html", "") or metadata.get("html", "") or "")+ if not html.strip():+ return ""+ try:+ from bs4 import BeautifulSoup+ except Exception:+ return html+ soup = BeautifulSoup(html, "html.parser")+ for selector in ("main", "article", "#content", ".content", ".main-content", ".document", ".statute", ".law", "pre"):+ node = soup.select_one(selector)+ if node:+ extracted = node.get_text("\n", strip=True)+ if extracted:+ return extracted+ return soup.get_text("\n", strip=True)++# Recovery notes for the scraper maintainer:+# citation: Pub. L. No. 115-232+# host: www.congress.gov+# candidate_url: https://www.congress.gov/public-law/115th-congress/232+# preferred_fetch_path: UnifiedWebArchivingAPI.fetch(url, domain="legal")+# fallback_fetch_path: UnifiedWebScraper.scrape_sync(url)+# blocked_fetch_fallback: CommonCrawlSearchEngine.search_domain(host, query=search_query)+# hf_common_crawl_fallback: Common Crawl integration falls back to Hugging Face indexes when local CC assets are unavailable.12345678910{ "candidate_files": [], "citation_text": "Pub. L. No. 115-232", "common_crawl_fallback": "Use CommonCrawlSearchEngine.search_domain(host, query=search_query) when direct fetch is blocked by Cloudflare or similar anti-bot pages.", "host": "www.congress.gov", "normalized_citation": "Pub. L. No. 115-232", "patch_intent": "Add host-specific extraction/fetch support for a legal source recovered after a Hugging Face lookup miss.", "source_url": "https://www.congress.gov/public-law/115th-congress/232", "target_file": "ipfs_datasets_py/processors/legal_scrapers/federal_scrapers/us_code_scraper.py"}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647{ "archived_sources": [], "candidate_files": [], "candidates": [ { "score": 16, "source": "citation_url_hint", "source_type": "current", "title": "Public Law 115-232", "url": "https://www.congress.gov/public-law/115th-congress/232" } ], "citation_text": "Pub. L. No. 115-232", "corpus_key": "us_code", "generated_at": "2026-04-18T02:46:19.531017", "hf_dataset_id": "justicedao/ipfs_uscode", "normalized_citation": "Pub. L. No. 115-232", "scraper_patch": { "extraction_recipe_path": "/home/barberb/.ipfs_datasets/uscode/source_recovery/20260418_024619_pub-l-no-115-232/patches/recovery-pub-l-no-115-232-www-congress-gov_extraction_recipe.json", "host": "www.congress.gov", "patch_path": "/home/barberb/.ipfs_datasets/uscode/source_recovery/20260418_024619_pub-l-no-115-232/patches/recovery-pub-l-no-115-232-www-congress-gov.patch", "rationale": "Host-specific recovery scaffold generated from discovered candidate file.", "target_file": "ipfs_datasets_py/processors/legal_scrapers/federal_scrapers/us_code_scraper.py" }, "search_backend_status": { "archive_search_available": false, "archive_search_error": "archive_search_skipped", "brave_api_key_env": "", "brave_configured": false, "common_crawl_available": false, "common_crawl_domain_count": 0, "common_crawl_domains": [], "common_crawl_error": "common_crawl_disabled", "common_crawl_result_count": 0, "common_crawl_used": false, "datasets_available": true, "duckduckgo_configured": true, "engines_attempted": [], "live_search_available": false, "live_search_error": "live_search_skipped", "live_search_skipped": true, "multi_engine_error": "multi_engine_skipped", "multi_engine_used": false }, "search_query": "Pub. L. No. 115-232 site:uscode.house.gov OR site:govinfo.gov OR site:law.cornell.edu", "state_code": null}source_recovery/20260418_024619_pub-l-no-115-232/patches/recovery-pub-l-no-115-232-www-congress-gov.jsonAdded+23
source_recovery/20260418_024619_pub-l-no-115-232/patches/recovery-pub-l-no-115-232-www-congress-gov.patchAdded+41
source_recovery/20260418_024619_pub-l-no-115-232/patches/recovery-pub-l-no-115-232-www-congress-gov_extraction_recipe.jsonAdded+10
source_recovery/20260418_024619_pub-l-no-115-232/recovery_manifest.jsonAdded+47