Skip to content

fix: use "SG\d+" as Segment Group ID, not "\d+" alone #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/fundamend/reader/ahbreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def _to_segment_group(element: ET.Element) -> SegmentGroup:
else:
raise ValueError(f"unexpected element: {child.tag}")
return SegmentGroup(
id=lstrip("G_SG", element.tag),
id=lstrip("G_", element.tag),
name=element.attrib["Name"],
ahb_status=(
element.attrib["AHB_Status"].strip() or None
Expand Down
2 changes: 1 addition & 1 deletion src/fundamend/reader/migreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def _to_segment_group(element: ET.Element) -> SegmentGroup:
else:
raise ValueError(f"unexpected element: {child.tag}")
return SegmentGroup(
id=lstrip("G_SG", element.tag),
id=lstrip("G_", element.tag),
name=element.attrib["Name"],
status_std=MigStatus(element.attrib["Status_Std"]),
status_specification=MigStatus(element.attrib["Status_Specification"]),
Expand Down
6 changes: 3 additions & 3 deletions src/fundamend/sqlmodels/materialize_ahb_view.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ WITH RECURSIVE
ordered_roots AS (SELECT sg.primary_key,
sg.position,
'segment_group' AS type,
'SG' || sg.id AS root_id_text,
sg.id AS root_id_text,
sg.name,
sg.ahb_status,
sg.anwendungsfall_primary_key,
Expand Down Expand Up @@ -134,7 +134,7 @@ WITH RECURSIVE
'segment_group',
h.source_id,
h.sort_path || substr('00000' || child.position, -5) || '-',
h.id_path || 'SG' || child.id || '>',
h.id_path || child.id || '>',
h.pruefidentifikator,
h.format,
h.versionsnummer,
Expand All @@ -146,7 +146,7 @@ WITH RECURSIVE
h.anwendungshandbuch_primary_key,
h.is_on_uebertragungsdatei_level,

'SG' || child.id,
child.id,
child.name,
child.ahb_status,
child.position,
Expand Down
6 changes: 3 additions & 3 deletions unittests/__snapshots__/test_ahbreader.ambr

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions unittests/__snapshots__/test_migreader.ambr

Large diffs are not rendered by default.