feat(fase3): config-driven docs_dir + verdict_input on Project loader
This commit is contained in:
parent
8b64c7f8de
commit
c7c42eeb75
6 changed files with 44 additions and 2 deletions
|
|
@ -44,6 +44,8 @@ class Project:
|
|||
description: str
|
||||
currency: str
|
||||
cost_items: tuple[CostItem, ...]
|
||||
docs_dir: str # absolute path to this project's bundled cost-docs folder (config-driven)
|
||||
verdict_input: dict[str, str] # SYNTHETIC Layer-2 expert decision/rationale (config-driven)
|
||||
|
||||
@property
|
||||
def total_cost(self) -> float:
|
||||
|
|
@ -51,7 +53,12 @@ class Project:
|
|||
|
||||
|
||||
def load_reference_projects() -> tuple[Project, ...]:
|
||||
"""Load the bundled synthetic reference projects (D4)."""
|
||||
"""Load the bundled synthetic reference projects (D4).
|
||||
|
||||
Each project's ``docs_dir`` is stored in the JSON relative to the package ``data/`` root
|
||||
and resolved here to an absolute filesystem path; ``verdict_input`` carries the SYNTHETIC
|
||||
Layer-2 expert decision/rationale. Missing keys raise ``KeyError`` (fail-fast, matching the
|
||||
existing loader contract)."""
|
||||
resource = files("portfolio_optimiser").joinpath(_DATA_RESOURCE)
|
||||
raw = json.loads(resource.read_text(encoding="utf-8"))
|
||||
return tuple(
|
||||
|
|
@ -70,6 +77,8 @@ def load_reference_projects() -> tuple[Project, ...]:
|
|||
)
|
||||
for c in p["cost_items"]
|
||||
),
|
||||
docs_dir=str(files("portfolio_optimiser").joinpath("data", p["docs_dir"])),
|
||||
verdict_input=p["verdict_input"],
|
||||
)
|
||||
for p in raw["projects"]
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue