refactor(csv-import): Enhance nutrition data processing and template rendering
Deploy Development / deploy (push) Successful in 48s
Build Test / pytest-backend (push) Successful in 3s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 16s

- Updated the nutrition import logic to utilize a new row processing specification, improving data aggregation and validation.
- Refactored the template rendering process in the workflow executor to use Jinja2's Environment with ChainableUndefined for better handling of missing attributes.
- Added backward-compatible shortcuts for accessing decision signals in node contexts, enhancing flexibility in template usage.
- Introduced import row processing options in CSV templates, allowing for more customizable data handling during imports.
This commit is contained in:
Lars committed 2026-04-10 11:56:43 +02:00
1 parent 8b67f7ab55
commit c0fcdea1fe
9 files changed
+357 -22

No files matched your search

+6 -2
View File
@@ -173,10 +173,11 @@ def copy_csv_mapping(
INSERT INTO csv_field_mappings (
profile_id, is_system, module, mapping_name, description,
column_signature, delimiter, encoding, has_header,
field_mappings, type_conversions, usage_count, success_rate
field_mappings, type_conversions, import_row_processing,
usage_count, success_rate
) VALUES (
%s::uuid, false, %s, %s, %s,
%s, %s, %s, %s, %s, %s, 0, 1.0
%s, %s, %s, %s, %s, %s, %s, 0, 1.0
) RETURNING id
""",
(
@@ -190,6 +191,9 @@ def copy_csv_mapping(
src["has_header"],
Json(src["field_mappings"]),
Json(src["type_conversions"]) if src.get("type_conversions") is not None else None,
Json(src["import_row_processing"])
if src.get("import_row_processing") is not None
else None,
),
)
new_id = cur.fetchone()["id"]