fix: apply_templates_023.py — placeholders als JSONB + version/status Felder
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 34s
CI / test-python-backend-compliance (push) Successful in 30s
CI / test-python-document-crawler (push) Successful in 21s
CI / test-python-dsms-gateway (push) Successful in 16s
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 34s
CI / test-python-backend-compliance (push) Successful in 30s
CI / test-python-document-crawler (push) Successful in 21s
CI / test-python-dsms-gateway (push) Successful in 16s
- json.dumps() für jsonb-Spalte statt Python-Liste - CAST(:placeholders AS jsonb) in SQL - version='1.0' + status='active' hinzugefügt Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,9 @@ Usage:
|
||||
docker exec bp-compliance-backend python3 /tmp/apply_templates_023.py
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import uuid
|
||||
|
||||
@@ -640,8 +642,7 @@ def main() -> None:
|
||||
print(f'[SKIP] Bereits vorhanden: {t["title"]}')
|
||||
continue
|
||||
|
||||
# Extract placeholders from content
|
||||
import re
|
||||
# Extract placeholders from content (jsonb column → pass as JSON string)
|
||||
placeholders = sorted(set(re.findall(r'\{\{[A-Z_]+\}\}', t['content'])))
|
||||
|
||||
new_id = str(uuid.uuid4())
|
||||
@@ -651,12 +652,12 @@ def main() -> None:
|
||||
(id, title, document_type, language, jurisdiction,
|
||||
content, description, license_id, license_name,
|
||||
source_name, is_complete_document, attribution_required,
|
||||
placeholders, created_at, updated_at)
|
||||
placeholders, version, status, created_at, updated_at)
|
||||
VALUES
|
||||
(:id, :title, :document_type, :language, :jurisdiction,
|
||||
:content, :description, :license_id, :license_name,
|
||||
:source_name, :is_complete_document, :attribution_required,
|
||||
:placeholders, NOW(), NOW())
|
||||
CAST(:placeholders AS jsonb), :version, :status, NOW(), NOW())
|
||||
'''),
|
||||
{
|
||||
'id': new_id,
|
||||
@@ -671,7 +672,9 @@ def main() -> None:
|
||||
'source_name': t['source_name'],
|
||||
'is_complete_document': t['is_complete_document'],
|
||||
'attribution_required': t['attribution_required'],
|
||||
'placeholders': placeholders,
|
||||
'placeholders': json.dumps(placeholders),
|
||||
'version': '1.0',
|
||||
'status': 'active',
|
||||
}
|
||||
)
|
||||
print(f'[OK] {t["title"]} ({t["document_type"]}/{t["language"]}) — {len(placeholders)} Platzhalter')
|
||||
|
||||
Reference in New Issue
Block a user