[31188f42] einfügen

einfügen
This commit is contained in:
2026-02-24 06:47:35 +00:00
parent 391ed60a19
commit 0c2c17df1e
21 changed files with 1575 additions and 152 deletions

View File

@@ -4,7 +4,7 @@ import json
# Setup Environment to import backend modules
sys.path.append(os.path.join(os.path.dirname(__file__), "../../"))
from backend.database import SessionLocal, Persona, JobRoleMapping
from backend.database import SessionLocal, Persona, JobRolePattern
def seed_archetypes():
db = SessionLocal()
@@ -87,33 +87,41 @@ def seed_archetypes():
db.commit()
# --- 2. Update JobRoleMappings to map to Archetypes ---
# --- 2. Update JobRolePatterns to map to Archetypes ---
# We map the patterns to the new 4 Archetypes
mapping_updates = [
# Wirtschaftlicher Entscheider
{"role": "Wirtschaftlicher Entscheider", "patterns": ["%geschäftsführer%", "%ceo%", "%director%", "%einkauf%", "%procurement%", "%finance%", "%cfo%"]},
{"role": "Wirtschaftlicher Entscheider", "patterns": ["geschäftsführer", "ceo", "director", "einkauf", "procurement", "finance", "cfo"]},
# Operativer Entscheider
{"role": "Operativer Entscheider", "patterns": ["%housekeeping%", "%hausdame%", "%hauswirtschaft%", "%reinigung%", "%restaurant%", "%f&b%", "%werksleiter%", "%produktionsleiter%", "%lager%", "%logistik%", "%operations%", "%coo%"]},
{"role": "Operativer Entscheider", "patterns": ["housekeeping", "hausdame", "hauswirtschaft", "reinigung", "restaurant", "f&b", "werksleiter", "produktionsleiter", "lager", "logistik", "operations", "coo"]},
# Infrastruktur-Verantwortlicher
{"role": "Infrastruktur-Verantwortlicher", "patterns": ["%facility%", "%technik%", "%instandhaltung%", "%it-leiter%", "%cto%", "%admin%", "%building%"]},
{"role": "Infrastruktur-Verantwortlicher", "patterns": ["facility", "technik", "instandhaltung", "it-leiter", "cto", "admin", "building"]},
# Innovations-Treiber
{"role": "Innovations-Treiber", "patterns": ["%innovation%", "%digital%", "%transformation%", "%business dev%", "%marketing%"]}
{"role": "Innovations-Treiber", "patterns": ["innovation", "digital", "transformation", "business dev", "marketing"]}
]
# Clear old mappings to prevent confusion
db.query(JobRoleMapping).delete()
db.query(JobRolePattern).delete()
db.commit()
print("Cleared old JobRoleMappings.")
print("Cleared old JobRolePatterns.")
for group in mapping_updates:
role_name = group["role"]
for pattern in group["patterns"]:
print(f"Mapping '{pattern}' -> '{role_name}'")
db.add(JobRoleMapping(pattern=pattern, role=role_name))
for pattern_text in group["patterns"]:
print(f"Mapping '{pattern_text}' -> '{role_name}'")
# All seeded patterns are regex contains checks
new_pattern = JobRolePattern(
pattern_type='regex',
pattern_value=pattern_text, # Stored without wildcards
role=role_name,
priority=100, # Default priority for seeded patterns
created_by='system'
)
db.add(new_pattern)
db.commit()
print("Archetypes and Mappings Seeded Successfully.")