examples: simulator response gains examples_overlay block
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Adds an informational `examples_overlay` field to SimulateResult, populated from `summary_for_country` for the scenario's target country. Never affects simulation paths — lookup failures are caught and logged, yielding overlay=None. Wired into both /simulate and /compare; the shared session in /compare is used sequentially because AsyncSession is not safe for concurrent use. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
249991557b
commit
9b32247fea
3 changed files with 146 additions and 8 deletions
|
|
@ -522,6 +522,19 @@ class SimulateRequest(BaseModel):
|
|||
col_target_city: str | None = None
|
||||
|
||||
|
||||
class ExamplesOverlay(BaseModel):
|
||||
"""Informational layer on a simulator response — real-world Reddit
|
||||
examples for the scenario's target country. Never affects paths."""
|
||||
|
||||
country: str
|
||||
count: int
|
||||
portfolio_gbp_median: Decimal | None = None
|
||||
portfolio_gbp_p25: Decimal | None = None
|
||||
portfolio_gbp_p75: Decimal | None = None
|
||||
annual_exp_gbp_median: Decimal | None = None
|
||||
sample_links: list[str] = Field(default_factory=list)
|
||||
|
||||
|
||||
class SimulateResult(BaseModel):
|
||||
success_rate: Decimal
|
||||
p10_ending_gbp: Decimal
|
||||
|
|
@ -539,6 +552,10 @@ class SimulateResult(BaseModel):
|
|||
col_multiplier_applied: Decimal | None = None
|
||||
col_adjusted_spending_gbp: Decimal | None = None
|
||||
col_target_city: str | None = None
|
||||
# Informational only — real-world Reddit examples for the scenario's
|
||||
# target country. Never affects simulation behaviour; failures during
|
||||
# lookup are swallowed so the simulator response is never sunk.
|
||||
examples_overlay: ExamplesOverlay | None = None
|
||||
|
||||
|
||||
class CompareRequest(BaseModel):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue