[2ff88f42] Feat: Verticals-Update (Transkript 2) & Dev-Toolbox Establishment
- Aktualisierung der Pains/Gains für Energy, Retail und Tech in der lokalen DB. - Ergänzung von Secondary Products für Energy & Tech. - Aufbau eines permanenten Werkzeugkastens unter /app/devtools/ für DB- & Notion-Tasks. - Verifikation der manuellen Notion-Änderungen mittels neuer Maintenance-Skripte.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import os
|
||||
import requests
|
||||
import json
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
# Check for API Key
|
||||
NOTION_API_KEY = os.getenv("NOTION_API_KEY")
|
||||
if not NOTION_API_KEY:
|
||||
try:
|
||||
with open("/app/n8n_api_Token_git.txt", "r") as f:
|
||||
content = f.read()
|
||||
if "secret_" in content:
|
||||
NOTION_API_KEY = content.strip().split('\n')[0]
|
||||
except:
|
||||
pass
|
||||
|
||||
if not NOTION_API_KEY:
|
||||
print("Error: NOTION_API_KEY not found.")
|
||||
exit(1)
|
||||
|
||||
NOTION_DB_ID = "2ec88f4285448014ab38ea664b4c2b81"
|
||||
headers = {"Authorization": f"Bearer {NOTION_API_KEY}", "Notion-Version": "2022-06-28", "Content-Type": "application/json"}
|
||||
|
||||
def list_db_properties():
|
||||
url = f"https://api.notion.com/v1/databases/{NOTION_DB_ID}"
|
||||
resp = requests.get(url, headers=headers)
|
||||
if resp.status_code == 200:
|
||||
props = resp.json().get("properties", {})
|
||||
print("Database Properties:")
|
||||
for name, data in props.items():
|
||||
print(f"- {name} (Type: {data['type']})")
|
||||
else:
|
||||
print(f"Error getting DB: {resp.text}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
list_db_properties()
|
||||
@@ -0,0 +1,97 @@
|
||||
import os
|
||||
import requests
|
||||
import json
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
# Check for API Key
|
||||
NOTION_API_KEY = os.getenv("NOTION_API_KEY")
|
||||
if not NOTION_API_KEY:
|
||||
try:
|
||||
with open("/app/n8n_api_Token_git.txt", "r") as f:
|
||||
content = f.read()
|
||||
if "secret_" in content:
|
||||
NOTION_API_KEY = content.strip().split('\n')[0]
|
||||
except:
|
||||
pass
|
||||
|
||||
if not NOTION_API_KEY:
|
||||
print("Error: NOTION_API_KEY not found.")
|
||||
exit(1)
|
||||
|
||||
NOTION_DB_ID = "2ec88f4285448014ab38ea664b4c2b81"
|
||||
headers = {"Authorization": f"Bearer {NOTION_API_KEY}", "Notion-Version": "2022-06-28", "Content-Type": "application/json"}
|
||||
|
||||
# Updates Definition
|
||||
updates = {
|
||||
"Energy - Grid & Utilities": {
|
||||
"Pains": "[Primary Product: Security]\n- Sabotage & Diebstahl: Kupferdiebstahl in Umspannwerken verursacht Millionenschäden und Versorgungsausfälle.\n- Reaktionszeit: Entlegene Standorte sind für Interventionskräfte oft zu spät erreichbar.\n- Sicherheitsrisiko Mensch: Alleinarbeit bei Kontrollgängen in Hochspannungsbereichen ist gefährlich.\n\n[Secondary Product: Cleaning Indoor]\n- Verschmutzung in Umspannwerken: Staubablagerungen auf Böden und in technischen Bereichen können die Betriebssicherheit gefährden.\n- Manuelle Reinigung in Sicherheitsbereichen: Externes Reinigungspersonal benötigt aufwändige Sicherheitsunterweisungen und Begleitung.\n- Große Distanzen: Die Reinigung weitläufiger, oft unbemannter Anlagen ist logistisch aufwändig und wird häufig vernachlässigt.",
|
||||
"Gains": "[Primary Product: Security]\n- First Responder Maschine: Roboter ist bereits vor Ort, verifiziert Alarm und schreckt Täter ab.\n- KRITIS-Compliance: Lückenlose, manipulationssichere Dokumentation aller Vorfälle für Behörden.\n- Arbeitsschutz: Roboter übernimmt gefährliche Routinekontrollen (z.B. Thermografie an Trafos).\n\n[Secondary Product: Cleaning Indoor]\n- Permanente Sauberkeit: Autonome Reinigung gewährleistet staubfreie Böden und reduziert das Risiko von technischen Störungen.\n- Zugang ohne Sicherheitsrisiko: Der Roboter ist \"Teil der Anlage\" und benötigt keine externe Sicherheitsfreigabe oder Begleitung.\n- Ressourceneffizienz: Kosteneffiziente Reinigung großer Flächen ohne Anreisezeiten für Dienstleister.",
|
||||
"Secondary_Product_Name": "Cleaning Indoor (Wet Surface)"
|
||||
},
|
||||
"Retail - Non-Food": {
|
||||
"Pains": "[Primary Product: Cleaning Indoor]\n- Optischer Eindruck: Verschmutzte Böden, insbesondere im Premium-Segment (Möbel, Elektronik), mindern die Wertwahrnehmung der ausgestellten Produkte massiv.\n- Staubentwicklung auf großen Flächen: In Möbelhäusern und Baumärkten sammelt sich auf den riesigen Gangflächen schnell Staub, der das Einkaufserlebnis trübt.\n- Personalbindung: Verkaufsberater sollen Kunden betreuen und Umsatz generieren, statt wertvolle Zeit mit unproduktiven Kehr- oder Wischtätigkeiten zu verbringen.\n\n[Secondary Product: Service]\n- Unübersichtlichkeit: Kunden finden in großen Märkten oft nicht sofort das gesuchte Produkt und binden Personal für einfache Wegbeschreibungen.\n- Fehlende Interaktion: Passive Verkaufsflächen bieten wenig Anreiz für Kunden, sich länger aufzuhalten oder zu interagieren.",
|
||||
"Gains": "[Primary Product: Cleaning Indoor]\n- Perfektes Einkaufserlebnis: Stets makellos saubere Böden unterstreichen den Qualitätsanspruch des Sortiments und laden zum Verweilen ein.\n- Fokus auf Beratung: Mitarbeiter werden von routinemäßigen Reinigungsaufgaben befreit und können sich voll auf den Kunden und den Verkauf konzentrieren.\n- Kosteneffizienz auf der Fläche: Autonome Reinigung großer Quadratmeterzahlen ist deutlich günstiger als manuelle Arbeit, besonders außerhalb der Öffnungszeiten.\n\n[Secondary Product: Service]\n- Innovativer Kundenservice: Roboter führen Kunden autonom zum gesuchten Produktregal (\"Guide-Funktion\").\n- Wow-Effekt: Der Einsatz von Robotik modernisiert das Markenimage und zieht Aufmerksamkeit auf sich."
|
||||
},
|
||||
"Tech - Data Center": {
|
||||
"Pains": "[Primary Product: Security]\n- Sicherheitsrisiko Zutritt: Unbefugter Zutritt in Hochsicherheitsbereiche (Serverräume, Cages) muss lückenlos detektiert und dokumentiert werden, um Zertifizierungen (ISO 27001) nicht zu gefährden.\n- Fachkräftemangel Security: Qualifiziertes Wachpersonal mit Sicherheitsüberprüfung ist extrem schwer zu finden und teuer im 24/7-Schichtbetrieb.\n- Dokumentationslücken: Manuelle Patrouillen sind fehleranfällig und Protokolle können unvollständig sein, was bei Audits zu Problemen führt.\n\n[Secondary Product: Cleaning Indoor]\n- Gefahr durch Staubpartikel: Feinstaub in Serverräumen kann Kühlsysteme verstopfen und Kurzschlüsse verursachen, was die Hardware-Lebensdauer verkürzt.\n- Sicherheitsrisiko Reinigungspersonal: Externes Reinigungspersonal in Sicherheitsbereichen erfordert ständige Begleitung und Überwachung (Vier-Augen-Prinzip), was Personal bindet.",
|
||||
"Gains": "[Primary Product: Security]\n- Lückenloser Audit-Trail: Automatisierte, manipulationssichere Dokumentation aller Kontrollgänge und Ereignisse sichert Compliance-Anforderungen.\n- 24/7 Präsenz: Der Roboter ist immer im Dienst, wird nicht müde und garantiert eine konstante Überwachungsqualität ohne Schichtwechsel-Risiken.\n- Sofortige Alarmierung: Bei Anomalien (offene Rack-Tür, Wärmeentwicklung) erfolgt eine Echtzeit-Meldung an die Leitzentrale.\n\n[Secondary Product: Cleaning Indoor]\n- Maximale Hardware-Verfügbarkeit: Staubfreie Umgebung optimiert die Kühleffizienz und reduziert das Ausfallrisiko teurer Komponenten.\n- Autonome \"Trusted\" Cleaning: Der Roboter reinigt sensibelste Bereiche ohne das Risiko menschlichen Fehlverhaltens oder unbefugten Zugriffs.",
|
||||
"Secondary_Product_Name": "Cleaning Indoor (Wet Surface)"
|
||||
}
|
||||
}
|
||||
|
||||
def get_product_page_id(product_name):
|
||||
url = "https://api.notion.com/v1/search"
|
||||
payload = {"query": product_name, "filter": {"value": "page", "property": "object"}}
|
||||
resp = requests.post(url, headers=headers, json=payload)
|
||||
if resp.status_code == 200:
|
||||
results = resp.json().get("results", [])
|
||||
if results: return results[0]["id"]
|
||||
return None
|
||||
|
||||
def update_vertical(vertical_name, new_data):
|
||||
url = f"https://api.notion.com/v1/databases/{NOTION_DB_ID}/query"
|
||||
payload = {"filter": {"property": "Vertical", "title": {"contains": vertical_name}}}
|
||||
resp = requests.post(url, headers=headers, json=payload)
|
||||
|
||||
if resp.status_code != 200:
|
||||
print(f"Error searching for {vertical_name}: {resp.text}")
|
||||
return
|
||||
|
||||
results = resp.json().get("results", [])
|
||||
if not results:
|
||||
print(f"Skipping {vertical_name} (Not found)")
|
||||
return
|
||||
|
||||
page_id = results[0]["id"]
|
||||
print(f"Found {vertical_name} (ID: {page_id})")
|
||||
|
||||
props_update = {
|
||||
"Pains": {"rich_text": [{"text": {"content": new_data["Pains"]}}],},
|
||||
"Gains": {"rich_text": [{"text": {"content": new_data["Gains"]}}]}
|
||||
}
|
||||
|
||||
if "Secondary_Product_Name" in new_data:
|
||||
prod_name = new_data["Secondary_Product_Name"]
|
||||
prod_id = get_product_page_id(prod_name)
|
||||
if prod_id:
|
||||
print(f" Found Product ID for '{prod_name}': {prod_id}")
|
||||
props_update["Secondary Product Category"] = {"relation": [{"id": prod_id}]}
|
||||
props_update["Ops Focus Secondary"] = {"checkbox": True}
|
||||
else:
|
||||
print(f" WARNING: Product '{prod_name}' not found.")
|
||||
|
||||
update_url = f"https://api.notion.com/v1/pages/{page_id}"
|
||||
update_payload = {"properties": props_update}
|
||||
resp_patch = requests.patch(update_url, headers=headers, json=update_payload)
|
||||
|
||||
if resp_patch.status_code == 200:
|
||||
print(f"✅ Successfully updated {vertical_name}")
|
||||
else:
|
||||
print(f"❌ Failed to update {vertical_name}: {resp_patch.text}")
|
||||
|
||||
print("Starting Targeted Notion Update...")
|
||||
for v_name, data in updates.items():
|
||||
update_vertical(v_name, data)
|
||||
print("Done.")
|
||||
@@ -0,0 +1,88 @@
|
||||
|
||||
import os
|
||||
import requests
|
||||
import json
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
# Check for API Key
|
||||
NOTION_API_KEY = os.getenv("NOTION_API_KEY")
|
||||
if not NOTION_API_KEY:
|
||||
try:
|
||||
with open("/app/n8n_api_Token_git.txt", "r") as f:
|
||||
content = f.read()
|
||||
if "secret_" in content:
|
||||
NOTION_API_KEY = content.strip().split('\n')[0]
|
||||
except:
|
||||
pass
|
||||
|
||||
if not NOTION_API_KEY:
|
||||
print("Error: NOTION_API_KEY not found.")
|
||||
exit(1)
|
||||
|
||||
NOTION_DB_ID = "2ec88f4285448014ab38ea664b4c2b81"
|
||||
headers = {"Authorization": f"Bearer {NOTION_API_KEY}", "Notion-Version": "2022-06-28", "Content-Type": "application/json"}
|
||||
|
||||
targets = [
|
||||
"Energy - Grid & Utilities",
|
||||
"Tech - Data Center",
|
||||
"Retail - Non-Food"
|
||||
]
|
||||
|
||||
def check_vertical(vertical_name):
|
||||
print(f"\n--- Checking: {vertical_name} ---")
|
||||
url = f"https://api.notion.com/v1/databases/{NOTION_DB_ID}/query"
|
||||
payload = {"filter": {"property": "Vertical", "title": {"contains": vertical_name}}}
|
||||
resp = requests.post(url, headers=headers, json=payload)
|
||||
|
||||
if resp.status_code != 200:
|
||||
print(f"Error: {resp.text}")
|
||||
return
|
||||
|
||||
results = resp.json().get("results", [])
|
||||
if not results:
|
||||
print("Not found.")
|
||||
return
|
||||
|
||||
page = results[0]
|
||||
props = page["properties"]
|
||||
|
||||
# Check Pains (Start)
|
||||
pains = props.get("Pains", {}).get("rich_text", [])
|
||||
pains_text = "".join([t["text"]["content"] for t in pains])
|
||||
print(f"PAINS (First 100 chars): {pains_text[:100]}...")
|
||||
|
||||
# Check Gains (Start)
|
||||
gains = props.get("Gains", {}).get("rich_text", [])
|
||||
gains_text = "".join([t["text"]["content"] for t in gains])
|
||||
print(f"GAINS (First 100 chars): {gains_text[:100]}...")
|
||||
|
||||
# Check Ops Focus Secondary
|
||||
ops_focus = props.get("Ops Focus: Secondary", {}).get("checkbox", False)
|
||||
print(f"Ops Focus Secondary: {ops_focus}")
|
||||
|
||||
# Check Secondary Product
|
||||
sec_prod_rel = props.get("Secondary Product", {}).get("relation", [])
|
||||
if sec_prod_rel:
|
||||
prod_id = sec_prod_rel[0]["id"]
|
||||
# Fetch Product Name
|
||||
prod_url = f"https://api.notion.com/v1/pages/{prod_id}"
|
||||
prod_resp = requests.get(prod_url, headers=headers)
|
||||
if prod_resp.status_code == 200:
|
||||
prod_props = prod_resp.json()["properties"]
|
||||
# Try to find Name/Title
|
||||
# Usually "Name" or "Product Name"
|
||||
# Let's look for title type
|
||||
prod_name = "Unknown"
|
||||
for k, v in prod_props.items():
|
||||
if v["type"] == "title":
|
||||
prod_name = "".join([t["text"]["content"] for t in v["title"]])
|
||||
print(f"Secondary Product: {prod_name}")
|
||||
else:
|
||||
print(f"Secondary Product ID: {prod_id} (Could not fetch name)")
|
||||
else:
|
||||
print("Secondary Product: None")
|
||||
|
||||
for t in targets:
|
||||
check_vertical(t)
|
||||
Reference in New Issue
Block a user