[31388f42] Feature: Integrate Roboplanet Contact Forms into Lead Engine

This commit integrates the Roboplanet website contact form submissions into the Lead Engine, allowing them to be processed alongside TradingTwins leads.

Key changes:
- **Database Schema Update (db.py):** Added a new source column to the leads table for tracking lead origin (TradingTwins or Website-Formular). Includes a migration check to safely add the column.
- **Improved HTML Parsing (ingest.py):** Refined the `parse_roboplanet_form` function to accurately extract data from the specific HTML structure of Roboplanet contact form emails.
- **Enhanced Ingestion Logic (trading_twins_ingest.py):**
    - Renamed `fetch_tradingtwins_emails` to `fetch_new_leads_emails` and updated it to fetch emails from both lead sources.
    - Modified `process_leads` to dynamically select the correct parser based on email subject.
    - Ensured `source` field is correctly populated and `is_low_quality` checks are applied for both lead types.
- **UI Enhancement (app.py):** Updated the Streamlit UI to visually distinguish lead types with icons and improved the "Low Quality Lead" warning message.

This feature enables a unified processing pipeline for different lead sources and provides better visibility in the Lead Engine dashboard.
This commit is contained in:
2026-03-02 19:19:01 +00:00
parent 04013920ee
commit efaa43858d
4 changed files with 94 additions and 45 deletions

View File

@@ -147,7 +147,11 @@ if not df.empty:
except:
pass
with st.expander(f"{date_str} | {row['company_name']}"):
# --- DYNAMIC TITLE ---
source_icon = "🌐" if row.get('source') == 'Website-Formular' else "🤝"
title = f"{source_icon} {row.get('source', 'Lead')} | {date_str} | {row['company_name']}"
with st.expander(title):
# Metadata Parsing
meta = {}
if row.get('lead_metadata'):
@@ -155,8 +159,9 @@ if not df.empty:
except: pass
# --- TOP SECTION: QUALITY WARNING ---
# Now directly checks the metadata from DB, which is more reliable
if meta.get('is_low_quality'):
st.warning("⚠️ **Low Quality Lead detected** (Free-mail or missing company).")
st.warning("⚠️ **Low Quality Lead detected** (Free-mail provider or missing company name). Please verify manually.")
# --- SECTION 1: LEAD INFO & INTELLIGENCE ---
col_lead, col_intel = st.columns(2)