Quality check needed
I investigated legal_clean.db. Short version: it is a real SQLite database with a law-oriented schema, but it is not currently a clean or trustworthy “global laws” database.
What It Is
- SQLite 3 database, about
795 MB. PRAGMA integrity_checkreturnsok, so the file itself is structurally readable.- Main populated tables:
jurisdictions:237legal_codes:480legal_sections:101,367legal_sources:3
- Empty tables:
criminal_lawscivil_lawsregulatory_lawslegal_proceduressource_updates
Big Findings
- The schema looks intended for global legal data: jurisdictions, legal codes, sections, legal sources, FTS search tables, and specialized criminal/civil/regulatory tables.
- The actual data is badly inconsistent:
legal_sectionshas101,367rows.- Only
427of those rows join to an existinglegal_codes.id. 100,940legal_sectionsrows are orphaned foreign-key references.PRAGMA foreign_key_checkreports100,940violations, all inlegal_sections.
- Most orphaned content appears to be U.S. Code material:
99,922orphaned rows usecode_id = 1.99,921of those point athttps://uscode.house.gov/....
- The
legal_sourcescatalogue is not global:- Only 3 source records exist: United States, Canada, Germany.
- Meanwhile
legal_sections.source_urlcontains many more source URLs, so source metadata was not normalized intolegal_sources.
Global Coverage Quality
jurisdictionscontains broad-looking coverage:192countries,41states,2provinces, plus international/historical rows.- But jurisdiction normalization is weak:
187of192country jurisdiction codes are not ISO-style codes; they are names likeafghanistan,bosniaandherzegovina,costarica.- State rows have blank
parent_code. - There are duplicates/inconsistencies like
us-californiaandus-ca.
- Many linked “global” law records are one huge scraped document per country/state, not structured statute sections.
- Some records are clearly scrape artifacts. Example: the linked French Penal Code row contains only:
Just a moment... Enable JavaScript and cookies to continue. - I also found rows matching
Access Denied,Page not found, and JavaScript/cookie challenge patterns.
Verdict
This database looks like a partially populated legal corpus, not a clean global laws database. It contains a lot of legal-looking text, especially U.S. Code material, and some country/state criminal or statutory text. But the current database is not reliable for legal retrieval because the main section table is mostly orphaned, the source catalogue is nearly empty, the jurisdiction model is inconsistent, and some content is scraper noise rather than law text.
A sensible next step is to quarantine the orphaned legal_sections, rebuild the code_id mappings from source_url and section metadata, normalize jurisdictions against ISO/country/state identifiers, remove scrape-error rows, then rebuild the FTS tables and rerun PRAGMA foreign_key_check until it returns clean.