Files
Brancheneinstufung2/company-explorer/backend/scripts/debug_check_matrix_texts.py
Floke 2684f6edb0 feat(marketing-matrix): Optimiere Intro-Texte für bessere Relevanz [2ff88f42]
Überarbeite den Prompt für die Generierung von Intro-Texten in der Marketing Matrix.
Das Intro beginnt nun direkt mit der branchenspezifischen Produktkategorie und dem zentralen Nutzen,
anstatt die Herausforderung zu wiederholen. Dies verbessert die Prägnanz und Relevanz der E-Mails.
2026-02-23 13:55:32 +00:00

65 lines
2.1 KiB
Python

import sys
import os
import argparse
# Adjust the path to include the 'company-explorer' directory
# This allows the script to find the 'backend' module
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')))
from backend.database import SessionLocal, Industry, Persona, MarketingMatrix
def check_texts_for_industry(industry_name: str):
"""
Fetches and prints the marketing matrix texts for all personas
within a specific industry.
"""
db = SessionLocal()
try:
industry = db.query(Industry).filter(Industry.name == industry_name).first()
if not industry:
print(f"Error: Industry '{industry_name}' not found.")
# Suggest similar names
all_industries = db.query(Industry.name).all()
print("\nAvailable Industries:")
for (name,) in all_industries:
print(f"- {name}")
return
entries = (
db.query(MarketingMatrix)
.join(Persona)
.filter(MarketingMatrix.industry_id == industry.id)
.order_by(Persona.id)
.all()
)
if not entries:
print(f"No marketing texts found for industry: {industry_name}")
return
print(f"--- NEW TEXTS FOR {industry_name} ---")
for entry in entries:
print(f"\nPERSONA: {entry.persona.name}")
print(f"Subject: {entry.subject}")
print(f"Intro: {entry.intro.replace(chr(10), ' ')}") # Replace newlines for cleaner one-line output
except Exception as e:
print(f"An error occurred: {e}")
finally:
db.close()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Debug and check marketing matrix texts for a given industry.")
parser.add_argument(
"industry",
type=str,
nargs='?',
default="Healthcare - Hospital",
help="The name of the industry to check (e.g., 'Healthcare - Hospital'). Defaults to 'Healthcare - Hospital'."
)
args = parser.parse_args()
check_texts_for_industry(args.industry)