feat: Structure documentation, archive legacy files and clean up docker-compose.yml [30388f42]

This commit is contained in:
2026-03-05 21:30:16 +00:00
parent 149d69c03d
commit bffd400878
52 changed files with 6 additions and 427 deletions

View File

@@ -1,178 +0,0 @@
# Migrations-Plan: Legacy GSheets -> Company Explorer (Robotics Edition v0.8.5)
**Kontext:** Neuanfang für die Branche **Robotik & Facility Management**.
**Ziel:** Ablösung von Google Sheets/CLI durch eine Web-App ("Company Explorer") mit SQLite-Backend.
## 1. Strategische Neuausrichtung
| Bereich | Alt (Legacy) | Neu (Robotics Edition) |
| :--- | :--- | :--- |
| **Daten-Basis** | Google Sheets | **SQLite** (Lokal, performant, filterbar). |
| **Ziel-Daten** | Allgemein / Kundenservice | **Quantifizierbares Potenzial** (z.B. 4500m² Fläche, 120 Betten). |
| **Branchen** | KI-Vorschlag (Freitext) | **Strict Mode:** Mapping auf definierte Notion-Liste (z.B. "Hotellerie", "Automotive"). |
| **Bewertung** | 0-100 Score (Vage) | **Data-Driven:** Rohwert (Scraper/Search) -> Standardisierung (Formel) -> Potenzial. |
| **Analytics** | Techniker-ML-Modell | **Deaktiviert**. Fokus auf harte Fakten. |
| **Operations** | D365 Sync (Broken) | **Excel-Import & Deduplizierung**. Fokus auf Matching externer Listen gegen Bestand. |
## 2. Architektur & Komponenten-Mapping
Das System wird in `company-explorer/` neu aufgebaut. Wir lösen Abhängigkeiten zur Root `helpers.py` auf.
### A. Core Backend (`backend/`)
| Komponente | Aufgabe & Neue Logik | Prio |
| :--- | :--- | :--- |
| **Database** | Ersetzt `GoogleSheetHandler`. Speichert Firmen & "Enrichment Blobs". | 1 |
| **Importer** | Ersetzt `SyncManager`. Importiert Excel-Dumps (CRM) und Event-Listen. | 1 |
| **Deduplicator** | Ersetzt `company_deduplicator.py`. **Kern-Feature:** Checkt Event-Listen gegen DB. Muss "intelligent" matchen (Name + Ort + Web). | 1 |
| **Scraper (Base)** | Extrahiert Text von Websites. Basis für alle Analysen. | 1 |
| **Classification Service** | **NEU (v0.7.0).** Zweistufige Logik: <br> 1. Strict Industry Classification. <br> 2. Metric Extraction Cascade (Web -> Wiki -> SerpAPI). | 1 |
| **Marketing Engine** | Ersetzt `generate_marketing_text.py`. Nutzt neue `marketing_wissen_robotics.yaml`. | 3 |
**Identifizierte Hauptdatei:** `company-explorer/backend/app.py`
### B. Frontend (`frontend/`) - React
* **View 1: Der "Explorer":** DataGrid aller Firmen. Filterbar nach "Roboter-Potential" und Status.
* **View 2: Der "Inspector":** Detailansicht einer Firma. Zeigt gefundene Signale ("Hat SPA Bereich"). Manuelle Korrektur-Möglichkeit.
* **Identifizierte Komponente:** `company-explorer/frontend/src/components/Inspector.tsx`
* **View 3: "List Matcher":** Upload einer Excel-Liste -> Anzeige von Duplikaten -> Button "Neue importieren".
* **View 4: "Settings":** Konfiguration von Branchen, Rollen und Robotik-Logik.
* **Frontend "Settings" Komponente:** `company-explorer/frontend/src/components/RoboticsSettings.tsx`
### C. Architekturmuster für die Client-Integration
Um externen Diensten (wie der `lead-engine`) eine einfache und robuste Anbindung an den `company-explorer` zu ermöglichen, wurde ein standardisiertes Client-Connector-Muster implementiert.
| Komponente | Aufgabe & Neue Logik |
| :--- | :--- |
| **`company_explorer_connector.py`** | **NEU:** Ein zentrales Python-Skript, das als "offizieller" Client-Wrapper für die API des Company Explorers dient. Es kapselt die Komplexität der asynchronen Enrichment-Prozesse. |
| **`handle_company_workflow()`** | Die Kernfunktion des Connectors. Sie implementiert den vollständigen "Find-or-Create-and-Enrich"-Workflow: <br> 1. **Prüfen:** Stellt fest, ob ein Unternehmen bereits existiert. <br> 2. **Erstellen:** Legt das Unternehmen an, falls es neu ist. <br> 3. **Anstoßen:** Startet den asynchronen `discover`-Prozess. <br> 4. **Warten (Polling):** Überwacht den Status des Unternehmens, bis eine Website gefunden wurde. <br> 5. **Analysieren:** Startet den asynchronen `analyze`-Prozess. <br> **Vorteil:** Bietet dem aufrufenden Dienst eine einfache, quasi-synchrone Schnittstelle und stellt sicher, dass die Prozessschritte in der korrekten Reihenfolge ausgeführt werden. |
### D. Provisioning API (Internal)
Für die nahtlose Integration mit dem SuperOffice Connector wurde ein dedizierter Endpunkt geschaffen:
| Endpunkt | Methode | Zweck |
| :--- | :--- | :--- |
| `/api/provision/superoffice-contact` | POST | Liefert "Enrichment-Pakete" (Texte, Status) für einen gegebenen CRM-Kontakt. Greift auf `MarketingMatrix` zu. |
## 3. Umgang mit Shared Code (`helpers.py` & Co.)
Wir kapseln das neue Projekt vollständig ab ("Fork & Clean").
* **Quelle:** `helpers.py` (Root)
* **Ziel:** `company-explorer/backend/lib/core_utils.py`
* **Aktion:** Wir kopieren nur relevante Teile und ergänzen sie (z.B. `safe_eval_math`, `run_serp_search`).
## 4. Datenstruktur (SQLite Schema)
### Tabelle `companies` (Stammdaten & Analyse)
* `id` (PK)
* `name` (String)
* `website` (String)
* `crm_id` (String, nullable - Link zum D365)
* `industry_crm` (String - Die "erlaubte" Branche aus Notion)
* `city` (String)
* `country` (String - Standard: "DE" oder aus Impressum)
* `status` (Enum: NEW, IMPORTED, ENRICHED, QUALIFIED)
* **NEU (v0.7.0):**
* `calculated_metric_name` (String - z.B. "Anzahl Betten")
* `calculated_metric_value` (Float - z.B. 180)
* `calculated_metric_unit` (String - z.B. "Betten")
* `standardized_metric_value` (Float - z.B. 4500)
* `standardized_metric_unit` (String - z.B. "m²")
* `metric_source` (String - "website", "wikipedia", "serpapi")
### Tabelle `signals` (Deprecated)
* *Veraltet ab v0.7.0. Wird durch quantitative Metriken in `companies` ersetzt.*
### Tabelle `contacts` (Ansprechpartner)
* `id` (PK)
* `account_id` (FK -> companies.id)
* `gender`, `title`, `first_name`, `last_name`, `email`
* `job_title` (Visitenkarte)
* `role` (Standardisierte Rolle: "Operativer Entscheider", etc.)
* `status` (Marketing Status)
### Tabelle `industries` (Branchen-Fokus - Synced from Notion)
* `id` (PK)
* `notion_id` (String, Unique)
* `name` (String - "Vertical" in Notion)
* `description` (Text - "Definition" in Notion)
* `metric_type` (String - "Metric Type")
* `min_requirement` (Float - "Min. Requirement")
* `whale_threshold` (Float - "Whale Threshold")
* `proxy_factor` (Float - "Proxy Factor")
* `scraper_search_term` (String - "Scraper Search Term")
* `scraper_keywords` (Text - "Scraper Keywords")
* `standardization_logic` (String - "Standardization Logic")
### Tabelle `job_role_mappings` (Rollen-Logik)
* `id` (PK)
* `pattern` (String - Regex für Jobtitles)
* `role` (String - Zielrolle)
### Tabelle `marketing_matrix` (NEU v2.1)
* **Zweck:** Speichert statische, genehmigte Marketing-Texte (Notion Sync).
* `id` (PK)
* `industry_id` (FK -> industries.id)
* `role_id` (FK -> job_role_mappings.id)
* `subject` (Text)
* `intro` (Text)
* `social_proof` (Text)
## 7. Historie & Fixes (Jan 2026)
* **[CRITICAL] v0.7.4: Service Restoration & Logic Fix (Jan 24, 2026)**
* **[STABILITY] v0.7.3: Hardening Metric Parser & Regression Testing (Jan 23, 2026)**
* **[STABILITY] v0.7.2: Robust Metric Parsing (Jan 23, 2026)**
* **[STABILITY] v0.7.1: AI Robustness & UI Fixes (Jan 21, 2026)**
* **[MAJOR] v0.7.0: Quantitative Potential Analysis (Jan 20, 2026)**
* **[UPGRADE] v0.6.x: Notion Integration & UI Improvements**
## 14. Upgrade v2.0 (Feb 18, 2026): "Lead-Fabrik" Erweiterung
Dieses Upgrade transformiert den Company Explorer in das zentrale Gehirn der Lead-Generierung (Vorratskammer).
### 14.1 Detaillierte Logik der neuen Datenfelder
Um Gemini CLI (dem Bautrupp) die Umsetzung zu ermöglichen, hier die semantische Bedeutung der neuen Spalten:
#### Tabelle `companies` (Qualitäts- & Abgleich-Metriken)
* **`confidence_score` (FLOAT, 0.0 - 1.0):** Indikator für die Sicherheit der KI-Klassifizierung. `> 0.8` = Grün.
* **`data_mismatch_score` (FLOAT, 0.0 - 1.0):** Abweichung zwischen CRM-Bestand und Web-Recherche (z.B. Umzug).
* **`crm_name`, `crm_address`, `crm_website`, `crm_vat`:** Read-Only Snapshot aus SuperOffice zum Vergleich.
* **Status-Flags:** `website_scrape_status` und `wiki_search_status`.
#### Tabelle `industries` (Strategie-Parameter)
* **`pains` / `gains`:** Strukturierte Textblöcke (getrennt durch `[Primary Product]` und `[Secondary Product]`).
* **`ops_focus_secondary` (BOOLEAN):** Steuerung für rollenspezifische Produkt-Priorisierung.
---
## 15. Offene Arbeitspakete (Bauleitung)
Anweisungen für den "Bautrupp" (Gemini CLI).
### Task 1: UI-Anpassung - Side-by-Side CRM View & Settings
(In Arbeit / Teilweise erledigt durch Gemini CLI)
### Task 2: Intelligenter CRM-Importer (Bestandsdaten)
**Ziel:** Importieren der `demo_100.xlsx` in die SQLite-Datenbank.
**Anforderungen:**
1. **PLZ-Handling:** Zwingend als **String** einlesen (führende Nullen erhalten).
2. **Normalisierung:** Website bereinigen (kein `www.`, `https://`).
3. **Matching:** Kaskade über CRM-ID, VAT, Domain, Fuzzy Name.
4. **Isolierung:** Nur `crm_` Spalten updaten, Golden Records unberührt lassen.
---
## 16. Deployment-Referenz (NAS)
* **Pfad:** `/volume1/homes/Floke/python/brancheneinstufung/company-explorer`
* **DB:** `/app/companies_v3_fixed_2.db`
* **Sync:** `docker exec -it company-explorer python backend/scripts/sync_notion_to_ce_enhanced.py`

View File

@@ -22,44 +22,7 @@ services:
depends_on:
- company-explorer
- dashboard
- b2b-app
- market-frontend
- gtm-app
- transcription-app
- content-app
- competitor-analysis
- heatmap-frontend
# --- HEATMAP ---
heatmap-backend:
build: ./heatmap-tool/backend
container_name: heatmap-backend
restart: unless-stopped
volumes:
- ./heatmap-tool/backend:/app
heatmap-frontend:
build: ./heatmap-tool/frontend
container_name: heatmap-frontend
restart: unless-stopped
volumes:
- ./heatmap-tool/frontend:/app
depends_on:
- heatmap-backend
# --- AGENT (moltbot) ---
# moltbot: # Moltbot ist oft auskommentiert, um Port-Konflikte zu vermeiden, da der Agent oft separat läuft.
# build:
# context: .
# dockerfile: Dockerfile.moltbot
# container_name: moltbot
# restart: unless-stopped
# ports:
# - "18789:18789"
# command: /app/packages/clawdbot/node_modules/.bin/clawdbot gateway --port 18789 --allow-unconfigured
# volumes:
# - moltbot_data:/home/node/.clawd
- connector-superoffice
# --- DASHBOARD ---
dashboard:
@@ -69,7 +32,7 @@ services:
volumes:
- ./dashboard:/usr/share/nginx/html:ro
# --- APPS ---
# --- APPS (Core) ---
company-explorer:
build:
context: ./company-explorer
@@ -85,143 +48,9 @@ services:
API_PASSWORD: "gemini"
PYTHONUNBUFFERED: "1"
volumes:
- ./company-explorer:/app
- ./companies_v3_fixed_2.db:/app/companies_v3_fixed_2.db
- ./gemini_api_key.txt:/app/gemini_api_key.txt
- ./serpapikey.txt:/app/serpapikey.txt
- ./notion_token.txt:/app/notion_token.txt
- ./Log_from_docker:/app/logs_debug
transcription-app:
build:
context: ./transcription-tool
dockerfile: Dockerfile
container_name: transcription-app
restart: unless-stopped
volumes:
- ./transcription-tool/backend:/app/backend
- ./transcription-tool/frontend/dist:/app/frontend/dist # Mount Frontend Build for Live Updates
- ./transcripts.db:/app/transcripts.db
- ./uploads_audio:/app/uploads_audio
- ./gemini_api_key.txt:/app/gemini_api_key.txt
environment:
PYTHONUNBUFFERED: "1"
DATABASE_URL: "sqlite:////app/transcripts.db"
ports:
- "8001:8001"
b2b-app:
build:
context: .
dockerfile: Dockerfile.b2b
container_name: b2b-assistant
restart: unless-stopped
volumes:
- ./b2b_marketing_orchestrator.py:/app/b2b_marketing_orchestrator.py
- ./market_db_manager.py:/app/market_db_manager.py
- ./b2b-marketing-assistant/server.cjs:/app/server.cjs
- ./b2b_projects.db:/app/b2b_projects.db
- ./Log_from_docker:/app/Log_from_docker
- ./gemini_api_key.txt:/app/gemini_api_key.txt
environment:
PYTHONUNBUFFERED: "1"
DB_PATH: "/app/b2b_projects.db"
# Port 3002 is internal only
market-backend:
build:
context: .
dockerfile: Dockerfile.market
container_name: market-backend
restart: unless-stopped
volumes:
- ./market_intel_orchestrator.py:/app/market_intel_orchestrator.py
- ./market_db_manager.py:/app/market_db_manager.py
- ./config.py:/app/config.py
- ./helpers.py:/app/helpers.py
- ./general-market-intelligence/server.cjs:/app/general-market-intelligence/server.cjs
- ./market_intelligence.db:/app/market_intelligence.db
- ./Log:/app/Log
- ./gemini_api_key.txt:/app/gemini_api_key.txt
- ./serpapikey.txt:/app/serpapikey.txt
environment:
PYTHONUNBUFFERED: "1"
DB_PATH: "/app/market_intelligence.db"
# Port 3001 is internal only
market-frontend:
build:
context: ./general-market-intelligence
dockerfile: Dockerfile
container_name: market-frontend
restart: unless-stopped
depends_on:
- market-backend
# Port 80 is internal only
gtm-app:
build:
context: .
dockerfile: gtm-architect/Dockerfile
container_name: gtm-app
restart: unless-stopped
volumes:
- ./gtm-architect:/app/gtm-architect
- ./gtm-architect/server.cjs:/app/server.cjs
- ./gtm_architect_orchestrator.py:/app/gtm_architect_orchestrator.py
- ./helpers.py:/app/helpers.py
- ./config.py:/app/config.py
- ./gtm_db_manager.py:/app/gtm_db_manager.py
- ./gtm_projects.db:/app/gtm_projects.db
- ./Log_from_docker:/app/Log_from_docker
- ./gemini_api_key.txt:/app/gemini_api_key.txt
- ./serpapikey.txt:/app/serpapikey.txt
environment:
PYTHONUNBUFFERED: "1"
DB_PATH: "/app/gtm_projects.db"
# Port 3005 is internal only
content-app:
build:
context: .
dockerfile: content-engine/Dockerfile
container_name: content-app
restart: unless-stopped
volumes:
- ./content-engine:/app/content-engine
- ./content-engine/server.cjs:/app/server.cjs
- ./content-engine/content_orchestrator.py:/app/content_orchestrator.py
- ./content-engine/content_db_manager.py:/app/content_db_manager.py
- ./content_engine.db:/app/content_engine.db
- ./helpers.py:/app/helpers.py
- ./config.py:/app/config.py
- ./gtm_projects.db:/app/gtm_projects.db
- ./Log_from_docker:/app/Log_from_docker
- ./gemini_api_key.txt:/app/gemini_api_key.txt
- ./serpapikey.txt:/app/serpapikey.txt
environment:
PYTHONUNBUFFERED: "1"
DB_PATH: "/app/content_engine.db"
GTM_DB_PATH: "/app/gtm_projects.db"
competitor-analysis:
build:
context: ./competitor-analysis-app
dockerfile: Dockerfile
container_name: competitor-analysis
restart: unless-stopped
dns:
- 8.8.8.8
- 8.8.4.4
volumes:
- ./competitor-analysis-app/competitor_analysis_orchestrator.py:/app/competitor_analysis_orchestrator.py
- ./gemini_api_key.txt:/app/gemini_api_key.txt
- ./Log_from_docker:/app/Log_from_docker
environment:
PYTHONUNBUFFERED: "1"
GEMINI_API_KEY_FILE: "/app/gemini_api_key.txt"
# Port 8000 is internal only
- ./Log_from_docker:/app/logs_debug # Ensure logging path is correct
connector-superoffice:
build:
@@ -235,7 +64,6 @@ services:
- .env
volumes:
- ./connector-superoffice:/app
- ./gemini_api_key.txt:/app/gemini_api_key.txt
- ./connector_queue.db:/app/connector_queue.db
environment:
PYTHONUNBUFFERED: "1"
@@ -244,57 +72,5 @@ services:
DB_PATH: "/app/connector_queue.db"
COMPANY_EXPLORER_URL: "http://company-explorer:8000"
lead-engine:
build:
context: ./lead-engine
dockerfile: Dockerfile
container_name: lead-engine
restart: unless-stopped
ports:
- "8501:8501"
- "8004:8004"
env_file:
- .env
environment:
PYTHONUNBUFFERED: "1"
COMPANY_EXPLORER_URL: "http://company-explorer:8000"
# Explicitly pass keys to ensure availability
SERP_API: "${SERP_API}"
GEMINI_API_KEY: "${GEMINI_API_KEY}"
# Calendar App Credentials
CAL_APPID: "${CAL_APPID}"
CAL_SECRET: "${CAL_SECRET}"
CAL_TENNANT_ID: "${CAL_TENNANT_ID}"
volumes:
- ./lead-engine:/app
# We need to mount the root connector module so it can be imported inside the container
- ./company_explorer_connector.py:/app/company_explorer_connector.py
# --- INFRASTRUCTURE SERVICES ---
duckdns:
image: lscr.io/linuxserver/duckdns:latest
container_name: duckdns
environment:
PUID: "1000" # User ID (anpassen falls nötig)
PGID: "1000" # Group ID (anpassen falls nötig)
TZ: "Europe/Berlin"
SUBDOMAINS: "floke,floke-ai,floke-gitea,floke-ha,floke-n8n"
TOKEN: "2e073b27-971e-4847-988c-73ad23e648d4" # Actual token is in .env or config
restart: unless-stopped
dns-monitor:
image: alpine
container_name: dns-monitor
dns:
- 8.8.8.8
- 1.1.1.1
environment:
SUBDOMAINS: "floke,floke-ai,floke-gitea,floke-ha,floke-n8n"
TZ: "Europe/Berlin"
volumes:
- ./dns-monitor:/app
command: "/app/monitor.sh"
restart: unless-stopped
volumes:
moltbot_data: {} # Volume for moltbot data, even if service is commented out.
# No custom volumes needed for the streamlined setup

View File

@@ -23,6 +23,8 @@ gitea: none
## 📑 Projekt-Übersicht (Readmes)
Für eine umfassende Übersicht über allgemeine Projektdokumente, Architektur und Entwicklungsrichtlinien, konsultieren Sie bitte den `docs/`-Ordner.
| Modul / Projekt | Verzeichnis | Beschreibung |
| :--- | :--- | :--- |
| **SuperOffice Connector** | [📂 `./connector-superoffice`](./connector-superoffice/README.md) | GTM Engine & SuperOffice CRM Integration ("The Muscle"). |

View File

@@ -1,21 +0,0 @@
## Schritt 1: Zieldefinition
Unsere Lösung hilft Unternehmen, komplexe Service- und Wartungsprozesse für technische Geräte zu digitalisieren. Wir bieten eine mobile App für Techniker und ein zentrales Dashboard für Disponenten.
## Schritt 2: Zielmarkt & ICP
| Kriterium | Beschreibung |
| :--- | :--- |
| **Zielbranche** | Maschinenbau, Anlagenbau, Medizintechnik |
| **Unternehmensgröße**| 100-2.000 Mitarbeiter |
| **Regionale Märkte** | Deutschland, Österreich, Schweiz (DACH) |
## Schritt 3: Schmerzpunkte & Wertversprechen
- **Schmerzpunkt:** Ineffiziente, papierbasierte Einsatzplanung.
- **Wertversprechen:** 30% schnellere Auftragsabwicklung durch digitale Tourenplanung.
## Schritt 4: Go-to-Market Strategie
- **Marketing-Kanäle:** LinkedIn Outreach, Fachmessen.
- **Vertriebsansatz:** Account-Based Selling, Fokus auf technische Leiter (CTOs).