Skip to content

Conversation

@hf-kklein
Copy link
Contributor

fixes #173

@hf-kklein hf-kklein marked this pull request as ready for review October 1, 2025 13:04
@hf-kklein hf-kklein changed the title feat: add JSON column to Anwendungsfall table w/ Kommunikationsrichtungen feat: add JSON column w/ Kommunikationsrichtungen to Anwendungsfall table Oct 1, 2025
@hf-kklein hf-kklein requested a review from OLILHR October 1, 2025 15:46
@hf-kklein hf-kklein changed the title feat: add JSON column w/ Kommunikationsrichtungen to Anwendungsfall table feat: add JSON column w/ Kommunikationsrichtungen to Anwendungsfall table (fix cyclic import problem with Kommunikationseinrichtung model) Oct 1, 2025
Copy link
Contributor

@hf-krechan hf-krechan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets test it 👍

@hf-krechan hf-krechan requested a review from Copilot October 15, 2025 08:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a JSON column to store parsed communication directions in the Anwendungsfall table to fix a cyclic import issue with the Kommunikationsrichtung model. The main change separates the Kommunikationsrichtung model into its own module and adds structured storage of communication directions alongside the existing string-based column.

  • Extracts Kommunikationsrichtung model to separate module to resolve circular import
  • Adds JSON column to SQL Anwendungsfall model for structured communication directions storage
  • Updates imports across test files and utilities to use the new module location

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/fundamend/models/kommunikationsrichtung.py New module containing extracted Kommunikationsrichtung model
src/fundamend/models/anwendungshandbuch.py Removes Kommunikationsrichtung definition and adds computed property
src/fundamend/sqlmodels/anwendungshandbuch.py Adds JSON column for kommunikationsrichtungen with serialization logic
src/fundamend/utils.py Updates import to use new Kommunikationsrichtung module
unittests/test_utils.py Updates imports to use separated modules
unittests/test_sqlmodels_anwendungshandbuch.py Adds test validation for JSON column serialization/deserialization

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@property
def kommunikationsrichtungen(self) -> list[Kommunikationsrichtung] | None:
"""
the parsed 'kommunikation_von' attribute or None if it's unparsable (l)or outdated
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra '(l)' character in the docstring.

Suggested change
the parsed 'kommunikation_von' attribute or None if it's unparsable (l)or outdated
the parsed 'kommunikation_von' attribute or None if it's unparsable or outdated

Copilot uses AI. Check for mistakes.
pruefidentifikator: str = Field(index=True) #: e.g. '25001'
beschreibung: str = Field(index=True) #: e.g. 'Berechnungsformel'
kommunikation_von: str #: e.g. 'NB an MSB / LF'
kommunikationsrichtungen: list[dict[str, str]] | None = Field(default=None, sa_column=Column(JSON))
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The type annotation list[dict[str, str]] is too generic. Consider using a more specific type like list[dict[Literal['sender', 'empfaenger'], str]] to better document the expected structure.

Copilot uses AI. Check for mistakes.
@hf-kklein hf-kklein enabled auto-merge (squash) October 15, 2025 08:14
@hf-kklein hf-kklein merged commit e0af1af into main Oct 15, 2025
21 checks passed
@hf-kklein hf-kklein deleted the use-parsed-kv branch October 15, 2025 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split Sender and Receiver in sqlite database

4 participants