Open
Conversation
This commit adds 117 new law names to data/law-names.json by automatically matching missing law names from HTML generation warnings against the SFS document database. Changes: - Added 117 new law entries to data/law-names.json (236 → 353 entries) - Created scripts/find_missing_law_names.py to search for matching laws - Created scripts/add_law_names.py to filter and select best matches - Updated .gitignore to exclude generated log files Impact: - Reduced "Okänt lagnamn" warnings by 67% (4,013 → 1,304 warnings) - Improved automatic cross-referencing between laws in HTML output The matching algorithm: 1. Extracts law names from warning messages 2. Searches through 10,935 SFS JSON files for matches 3. Filters out introduction laws, announcements, and amendments 4. Scores matches based on exact name matching, law type, and recency 5. Selects the best match for each missing law name Examples of added laws: - brottsdatalagen (2018:1696) - djurskyddsförordningen (2019:66) - budgetlagen (2011:203) - patientsäkerhetslagen (2010:659) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds 117 new law names to
data/law-names.jsonby automatically matching missing law names from HTML generation warnings against the SFS document database.Changes
data/law-names.json(236 → 353 entries, +50%)scripts/find_missing_law_names.pyto search for matching lawsscripts/add_law_names.pyto filter and select best matches.gitignoreto exclude generated log filesImpact
How it works
The matching algorithm:
Examples of added laws
brottsdatalagen→ Lag (2018:1696) om Skatteverkets behandling av personuppgifter inom brottsdatadjurskyddsförordningen→ Djurskyddsförordning (2019:66)budgetlagen→ Budgetlag (2011:203)patientsäkerhetslagen→ Patientsäkerhetslag (2010:659)socialförsäkringsbalken→ Socialförsäkringsbalk (2010:110)Test plan
Files changed
data/law-names.json- Added 117 new law entriesscripts/find_missing_law_names.py- New script for finding matching lawsscripts/add_law_names.py- New script for filtering and selecting best matches.gitignore- Exclude generated log files🤖 Generated with Claude Code