Files
orion/app/modules/prospecting/models/performance_profile.py
Samir Boulahtit 6d6eba75bf
Some checks failed
CI / pytest (push) Failing after 48m31s
CI / docs (push) Has been skipped
CI / deploy (push) Has been skipped
CI / ruff (push) Successful in 11s
CI / validate (push) Successful in 23s
CI / dependency-scanning (push) Successful in 28s
feat(prospecting): add complete prospecting module for lead discovery and scoring
Migrates scanning pipeline from marketing-.lu-domains app into Orion module.
Supports digital (domain scan) and offline (manual capture) lead channels
with enrichment, scoring, campaign management, and interaction tracking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 00:59:47 +01:00

65 lines
2.4 KiB
Python

# app/modules/prospecting/models/performance_profile.py
"""
Performance profile for a prospect's website.
Stores Lighthouse audit results including Core Web Vitals,
mobile-friendliness, and asset size analysis.
"""
from sqlalchemy import Boolean, Column, Float, ForeignKey, Integer, String, Text
from sqlalchemy.orm import relationship
from app.core.database import Base
from models.database.base import TimestampMixin
class ProspectPerformanceProfile(Base, TimestampMixin):
"""Performance audit results from PageSpeed Insights / Lighthouse."""
__tablename__ = "prospect_performance_profiles"
id = Column(Integer, primary_key=True, index=True)
prospect_id = Column(Integer, ForeignKey("prospects.id", ondelete="CASCADE"), nullable=False, unique=True)
# Lighthouse Scores (0-100)
performance_score = Column(Integer, nullable=True)
accessibility_score = Column(Integer, nullable=True)
best_practices_score = Column(Integer, nullable=True)
seo_score = Column(Integer, nullable=True)
# Core Web Vitals
first_contentful_paint_ms = Column(Integer, nullable=True)
largest_contentful_paint_ms = Column(Integer, nullable=True)
total_blocking_time_ms = Column(Integer, nullable=True)
cumulative_layout_shift = Column(Float, nullable=True)
speed_index = Column(Integer, nullable=True)
time_to_interactive_ms = Column(Integer, nullable=True)
# Mobile
is_mobile_friendly = Column(Boolean, nullable=True)
viewport_configured = Column(Boolean, nullable=True)
font_size_ok = Column(Boolean, nullable=True)
tap_targets_ok = Column(Boolean, nullable=True)
# Asset Sizes (bytes)
total_bytes = Column(Integer, nullable=True)
html_bytes = Column(Integer, nullable=True)
css_bytes = Column(Integer, nullable=True)
js_bytes = Column(Integer, nullable=True)
image_bytes = Column(Integer, nullable=True)
font_bytes = Column(Integer, nullable=True)
# Request Counts
total_requests = Column(Integer, nullable=True)
js_requests = Column(Integer, nullable=True)
css_requests = Column(Integer, nullable=True)
image_requests = Column(Integer, nullable=True)
# Raw data
lighthouse_json = Column(Text, nullable=True) # JSON string
scan_strategy = Column(String(20), nullable=True) # mobile or desktop
scan_error = Column(Text, nullable=True)
# Relationships
prospect = relationship("Prospect", back_populates="performance_profile")