Förbättra registret med lagnamn - #59
Open
marcarl wants to merge 5 commits into
Open
Conversation
Lagar med välkända förkortningar (MBL, LOU, HSL, LSS m.fl.) saknade sina fullständiga svenska namn. Fyller i dessa för att göra posten komplett och sökbar på lagnamn, inte bara på förkortning. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Lagar som används frekvent i juridisk text saknade sina vedertagna förkortningar (AML, ATL, PatL, PreskL, RänteL m.fl.). Dessa används i lagkommentarer, rättsfall och doktrin och behövs för sökning. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Lagar utan kategori är svårare att filtrera och söka på. Kategoriserar
26 lagar inom arbetsrätt, skatterätt, processrätt, statsrätt m.fl.
Tar även bort dubblettposten för 2009:400 ("sekretesslagen") som är en
kopia av "offentlighets- och sekretesslagen" med samma id och förkortning.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
marcarl
force-pushed
the
enrich-law-names
branch
from
March 29, 2026 15:13
9a25601 to
2b1e7b6
Compare
Cross-referenced ferenda's accommodanda/sfs/data/namedlaws.json (BSD-licensed) against data/law-names.json and appended the laws missing from our register, keeping our existing schema (id/name/type/alternativeNames). Temporal from/until fields were intentionally left out — validity should be derived from each law's own upphavdDateTime/ikraftDateTime in the source data rather than hand-maintained expiry dates.
A named law can point to different SFS numbers over time (e.g. "patentlagen" = 1967:837 until 2025-01-01, then 2024:945). Replace the single "id" field with a chronologically sorted "ids" list and merge the 60 names that already had duplicate entries under one id each. Entries with no name (abbreviation-only) are left as single-id. Update apply_links.py and validate_law_names.py to read ids[-1] (the current/latest law) until proper date-aware resolution against each candidate's own upphavdDateTime/ikraftDateTime is built.
There was a problem hiding this comment.
Pull request overview
Den här PR:en uppdaterar lagnamnsregistret för att bättre stödja kategorisering/sökbarhet och hantera att samma lagnamn kan ha olika SFS-id över tid genom att gå från ett enskilt id till en lista ids (där senaste används).
Changes:
- Byter JSON-schema i
data/law-names.jsonfrånid→ids[]och uppdaterar uppslagningen till att välja senaste id:t. - Förbättrar dokumentation i
apply_links.pykring varföridsbehövs och hur uppslag görs. - Rensar/justerar poster i
law-names.json(inkl. borttagen dubblett för 2009:400 enligt PR-beskrivningen).
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/validate_law_names.py | Uppdaterar uppslag av lagnamn för att använda ids[-1] istället för id. |
| formatters/apply_links.py | Uppdaterar lagnamnslookup till ids[-1] och dokumenterar val av “senaste” id. |
| data/law-names.json | Migrerar datat till ids[] och uppdaterar/berikar poster (inkl. kategorier och dubblettrensning). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
21
to
25
| with open(json_file_path, 'r', encoding='utf-8') as f: | ||
| law_data = json.load(f) | ||
|
|
||
| # Create lookup dictionary: lagnamn -> SFS-ID | ||
| # Create lookup dictionary: lagnamn -> SFS-ID (senaste av eventuellt flera ids) | ||
| law_lookup = {} |
Comment on lines
+326
to
+330
| # Skapa lookup-dictionary: lagnamn -> SFS-ID (senaste av eventuellt flera) | ||
| law_lookup = {} | ||
| for entry in law_data: | ||
| if entry.get('name'): | ||
| law_lookup[entry['name'].lower()] = entry['id'] | ||
| if entry.get('name') and entry.get('ids'): | ||
| law_lookup[entry['name'].lower()] = entry['ids'][-1] |
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.
Lagar utan kategori är svårare att filtrera och söka på. Kategoriserar 26 lagar inom arbetsrätt, skatterätt, processrätt, statsrätt m.fl.
Tar även bort dubblettposten för 2009:400 ("sekretesslagen") som är en kopia av "offentlighets- och sekretesslagen" med samma id och förkortning.