
    E~jd                        d Z ddlmZ ddlZddlmZmZ ddlmZ ddlZddl	m
Z
 ddlmZ  ej        e          ZdZd	Zd
ZdZdZdZdZdZdZdZdZdZdZdZddlmZ d)dZ d*dZ!d+d!Z"d,d#Z#d-d%Z$d.d(Z%dS )/u0  Pipeline stage name constants and small shared helpers.

The constants here mirror `city_briefs_runs` columns verbatim. They are the
single source of truth for stage naming across the orchestrator, repositories,
and API layer.

Phase 12 deliberately excludes email stages — email is a future Phase 13.
    )annotationsN)datedatetime)Any)settings)redact_secrets
hub_lookupprevious_show_lookuphistorical_sales_lookupvoice_profile_loadyoutube_transcriptsperplexity_cityperplexity_newsopenai_fact_checkopenai_generationclaude_rankinghtml_generationvps_deploymenturl_verificationog_verification)STAGE_COLUMNSreturnr   c                     t          j        t          j                  } t	          j        |                                           S )z9Today's date in the configured app timezone (default LA).)pytztimezoner   APP_TIMEZONEr   nowr   )tzs    l/Users/abstractioneditor2/ai-workstation/projects/automation/show-city-briefing-agent/app/pipeline/stages.pytoday_in_app_tzr    +   s0    	x,	-	-B<  """    valuer   date | Nonec                >   | d S t          | t                    rt          | t                    s| S t          | t                    r|                                 S t          | t                    r.	 t          j        | d d                   S # t
          $ r Y d S w xY wd S )N
   )
isinstancer   r   strfromisoformat
ValueErrorr"   s    r   to_dater+   1   s    }t% z%'B'B %"" zz||% 	%eCRCj111 	 	 	44	4s   0B 
BBexcBaseExceptionr'   c                b    t          |           j         d|  }t          |          dd         S )zEReturn a redacted, length-capped error representation for the DB row.z: Ni  )type__name__r   )r,   msgs     r   redact_for_storager2   @   s5    #YY
(
(3
(
(C#uu%%r!   
int | Nonec                Z    | d S 	 t          |           S # t          t          f$ r Y d S w xY wN)int	TypeErrorr)   r*   s    r   as_intr8   F   sD    }t5zzz"   tt    **float | Nonec                Z    | d S 	 t          |           S # t          t          f$ r Y d S w xY wr5   )floatr7   r)   r*   s    r   as_floatr=   O   sD    }tU||z"   ttr9   city	show_datec                    | pd                                                                                     dd          }|                    d                                          }| d| S )zURL slug for a brief, e.g. `toronto-aug-11-2026`.

    Matches the format used in the planned public URL
    `https://just2done.com/brief/<slug>` and the HTML file written to the
    VPS webroot (`<slug>.html`).
      -z%b-%d-%Y)striplowerreplacestrftime)r>   r?   	city_part	date_parts       r   
brief_slugrJ   X   sh     ""$$**,,44S#>>I"":..4466I%%)%%%r!   )r   r   )r"   r   r   r#   )r,   r-   r   r'   )r"   r   r   r3   )r"   r   r   r:   )r>   r'   r?   r   r   r'   )&__doc__
__future__r   loggingr   r   typingr   r   
app.configr   app.loggingr   	getLoggerr0   loggerSTAGE_HUB_LOOKUPSTAGE_PREVIOUS_SHOWSTAGE_HISTORICAL_SALESSTAGE_VOICE_PROFILESTAGE_YOUTUBE_TRANSCRIPTSSTAGE_PERPLEXITY_CITYSTAGE_PERPLEXITY_NEWSSTAGE_OPENAI_FACT_CHECKSTAGE_OPENAI_GENERATIONSTAGE_CLAUDE_RANKINGSTAGE_HTML_GENERATIONSTAGE_VPS_DEPLOYMENTSTAGE_URL_VERIFICATIONSTAGE_OG_VERIFICATION
app.modelsr   r    r+   r2   r8   r=   rJ    r!   r   <module>rc      s    # " " " " "  # # # # # # # #              & & & & & &		8	$	$   , 2 * 1 ) ) - - ' ) ' + )  % $ $ $ $ $# # # #   & & & &      	& 	& 	& 	& 	& 	&r!   