Skip to content

Commit 4ae323f

Browse files
marcarlclaude
andcommitted
Rename normtyp to doctype for consistency
Changed from Swedish "normtyp" to English "doctype" for better consistency in filenames, variable names, and frontmatter keys. Changes: - Rename util/normtyp_utils.py to util/doctype_utils.py - Rename determine_normtyp() to determine_doctype() - Update frontmatter key from "normtyp" to "doctype" - Update HTML metadata label from "Normtyp" to "Doctype" - Update all imports and references throughout codebase The field values remain in Swedish (Grundlag, Lag, Förordning) as these are the official Swedish legal terms. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 2eb1120 commit 4ae323f

4 files changed

Lines changed: 17 additions & 17 deletions

File tree

exporters/html/html_export.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ def convert_to_html(data: Dict[str, Any], apply_amendments: bool = False, up_to_
212212
organisation_data = data.get('organisation', {})
213213
organisation = organisation_data.get('namn', '') if organisation_data else ''
214214

215-
# Determine normtyp (grundlag, lag, or förordning)
216-
from util.normtyp_utils import determine_normtyp
215+
# Determine doctype (grundlag, lag, or förordning)
216+
from util.doctype_utils import determine_doctype
217217
forfattningstyp_namn = data.get('forfattningstypNamn')
218-
normtyp = determine_normtyp(beteckning, forfattningstyp_namn)
218+
doctype = determine_doctype(beteckning, forfattningstyp_namn)
219219

220220
# Generate PDF URL
221221
pdf_url = generate_pdf_url(beteckning, utfardad_datum, check_exists=False)
@@ -275,10 +275,10 @@ def convert_to_html(data: Dict[str, Any], apply_amendments: bool = False, up_to_
275275
<dt>Departement:</dt>
276276
<dd property="eli:passed_by" datatype="xsd:string">{html.escape(organisation)}</dd>""")
277277

278-
if normtyp:
278+
if doctype:
279279
column1_items.append(f"""
280-
<dt>Normtyp:</dt>
281-
<dd property="eli:type_document" datatype="xsd:string">{html.escape(normtyp)}</dd>""")
280+
<dt>Doctype:</dt>
281+
<dd property="eli:type_document" datatype="xsd:string">{html.escape(doctype)}</dd>""")
282282

283283
if pdf_url:
284284
column1_items.append(f"""

formatters/sort_frontmatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def sort_frontmatter_properties(frontmatter_content: str) -> str:
125125
'beteckning',
126126
'rubrik',
127127
'departement',
128-
'normtyp',
128+
'doctype',
129129
'utfardad_datum',
130130
'ikraft_datum',
131131
'publicerad_datum',

sfs_processor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
from util.yaml_utils import format_yaml_value
4141
from util.datetime_utils import format_datetime
4242
from util.file_utils import filter_json_files, save_to_disk
43-
from util.normtyp_utils import determine_normtyp
43+
from util.doctype_utils import determine_doctype
4444
from formatters.predocs_parser import parse_predocs_string
4545

4646

@@ -312,9 +312,9 @@ def convert_to_markdown(data: Dict[str, Any], fetch_predocs_from_api: bool = Fal
312312
organisation_data = data.get('organisation', {})
313313
organisation = organisation_data.get('namn', '') if organisation_data else ''
314314

315-
# Determine normtyp (grundlag, lag, or förordning)
315+
# Determine doctype (grundlag, lag, or förordning)
316316
forfattningstyp_namn = data.get('forfattningstypNamn')
317-
normtyp = determine_normtyp(beteckning, forfattningstyp_namn)
317+
doctype = determine_doctype(beteckning, forfattningstyp_namn)
318318

319319
# Extract the main text content from nested structure
320320
innehall_text = fulltext_data.get('forfattningstext')
@@ -353,7 +353,7 @@ def convert_to_markdown(data: Dict[str, Any], fetch_predocs_from_api: bool = Fal
353353
beteckning: {format_yaml_value(beteckning)}
354354
rubrik: {format_yaml_value(rubrik)}
355355
departement: {format_yaml_value(organisation)}
356-
normtyp: {format_yaml_value(normtyp)}
356+
doctype: {format_yaml_value(doctype)}
357357
"""
358358

359359
# Add dates if they exist (ikraft_datum will be added separately if needed)
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Utility functions for determining normtyp (legal document type) for SFS documents.
2+
Utility functions for determining doctype (legal document type) for SFS documents.
33
44
This module provides functions to classify Swedish legal documents into their
55
appropriate categories: grundlag (fundamental law), lag (law), or förordning (regulation).
@@ -14,9 +14,9 @@
1414
}
1515

1616

17-
def determine_normtyp(beteckning: str, forfattningstyp_namn: str = None) -> str:
17+
def determine_doctype(beteckning: str, forfattningstyp_namn: str = None) -> str:
1818
"""
19-
Determine the normtyp (legal document type) for an SFS document.
19+
Determine the doctype (legal document type) for an SFS document.
2020
2121
The function classifies documents into three categories:
2222
- 'Grundlag': One of Sweden's four fundamental laws
@@ -31,11 +31,11 @@ def determine_normtyp(beteckning: str, forfattningstyp_namn: str = None) -> str:
3131
str: One of "Grundlag", "Lag", or "Förordning" (with capital first letter)
3232
3333
Examples:
34-
>>> determine_normtyp("1974:152", "Lag")
34+
>>> determine_doctype("1974:152", "Lag")
3535
'Grundlag'
36-
>>> determine_normtyp("2024:1274", "Förordning")
36+
>>> determine_doctype("2024:1274", "Förordning")
3737
'Förordning'
38-
>>> determine_normtyp("2010:800", "Lag")
38+
>>> determine_doctype("2010:800", "Lag")
3939
'Lag'
4040
"""
4141
# First check if it's one of the fundamental laws

0 commit comments

Comments
 (0)