-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Add materialized helper table in SQLite which unfolds the recursive Segment Group structure + Pydantic/SQLModel and can easily be queried #111
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 5 out of 8 changed files in this pull request and generated 1 comment.
Files not reviewed (3)
- domain-specific-terms.txt: Language not supported
- src/fundamend/sqlmodels/materialize_ahb_view.sql: Language not supported
- tox.ini: Language not supported
Comments suppressed due to low confidence (1)
unittests/test_sqlmodels_anwendungshandbuch.py:83
- [nitpick] The variable name 'ahb_is_not_suited_for_equality_comparison' is quite verbose; consider renaming it to something shorter and clearer, for example 'skip_equality_test'.
ahb_is_not_suited_for_equality_comparison = any(x for x in ahb.anwendungsfaelle if x.is_outdated)
Co-authored-by: Copilot <[email protected]>
@@ -507,3 +507,65 @@ def to_model(self) -> PydanticAnwendungshandbuch: | |||
pakete=tuple(x.to_model() for x in sorted(self.pakete, key=lambda y: y.position or 0)), | |||
anwendungsfaelle=tuple(x.to_model() for x in sorted(self.anwendungsfaelle, key=lambda y: y.position or 0)), | |||
) | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Diese Struktur lässt sich mit wenig Aufwand direkt auf ein flatahb ausm kohlrahbi Mappen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hier bietet es sich schon mal an diese Datei aufzuteilen in mehrere Modules.
|- sqlmodels
|- anwendungshandbuch
|- code.py
|- dataelement.py
Aber das ist hier out of scope :)
# Segment Group | ||
segmentgroup_id: Optional[str] = Field(default=None, index=True) | ||
segmentgroup_name: Optional[str] = Field(default=None, index=True) | ||
segmentgroup_ahb_status: Optional[str] = Field(default=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ich finde Status
beschreibt nicht so gut was dahinter steckt.
Sind hier die Muss [10]
bspw. drin oder? Bei AHB Tabellen nennen wir es Pflichtfeld-Kennzeichen
.
Auf Englisch vll sowas wie mandatory field indicator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ich würde hier auch die "out of scope"-karte ziehen. Der Spaltenname bildet nur das ab, was genau unter diesem Namen "AHB_Status" aus ursprünglichen einzelnen Tabelle und den XML-dateien kommt:
xml-fundamend-python/unittests/example_files/UTILTS_AHB_1.1d_Konsultationsfassung_2024_04_02.xml
Lines 197 to 204 in 862b448
<S_RFF Name="Referenz auf einen Rechenschritt" Number="00018" AHB_Status="Muss [5]"> | |
<C_C506 Name="Referenz"> | |
<D_1153 Name="Referenz, Qualifier"> | |
<Code Name="Rechenschritt" Description="" AHB_Status="X">Z23</Code> | |
</D_1153> | |
<D_1154 Name="Rechenschrittidentifikator" AHB_Status="X [913] [8] ∧ [9]"/> | |
</C_C506> | |
</S_RFF> |
dort heißt das Ding immer "AHB_Status" und damit man in der gejointen Tabelle sieht, von welcher ebene der jeweilige AHB_Status kam, kommt ein Präfix vorne dran. Mein vorschlag wäre: Wir bauen noch eine weitere Sicht auf die tabelle und ändern da das Naming. Kann ich auch in diesem PR machen, ich würde aber den namen in dieser Tabelle gleich lassen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay wenn sie das in den xml auch so nennen passt das für mich :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weitere sicht ist vertagt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=> #115
Renames the variable storing the path to the SQL command file to `sql_command_path` for improved clarity and readability. #111 (comment)
SELECT | ||
h.anwendungsfall_pk, | ||
child.primary_key, h.root_id, link.parent_id, h.depth + 1, child.position, | ||
h.path || ' > ' || child.name, h.path, h.root_order, 'segment_group', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hf-krechan statt oder zusätzlich zu den Namen der SG und Segmente könnt man auch ihre keys (SG4 statt Vorgang, DTM statt Datum) nehmen um den Path zu bauen. Dann kann man das "Klapp" Feature bauen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes please ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sieht z.b. so aus jetzt:
id_path': 'SG2>SG5>STS>C_C555>D_4405>Berechnungsformel besitzt keine Rechenoperation>',
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and format sql file... sorry for this
Tldr: query ahbs like you'd query PDFs but get tree structure Information for free.
this will be a mid-term replacement for Hochfrequenz/machine-readable_anwendungshandbuecher#336 because it saves us from scraping the .docx files, now that we pay for the XMLs.