Skip to content

refactor(shock): derive shock-paraeter registry from PDL (#14)#20

Open
Hackatro wants to merge 1 commit into
mainfrom
14-derive-shock-parameter-registry-dynamically-from-pdl
Open

refactor(shock): derive shock-paraeter registry from PDL (#14)#20
Hackatro wants to merge 1 commit into
mainfrom
14-derive-shock-parameter-registry-dynamically-from-pdl

Conversation

@Hackatro

@Hackatro Hackatro commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

refactor(shock): derive shock-parameter registry from PDL (#14)

  • add shock_registry.py — single source: (entity,impact)→param BINDING,
  • delete hardcoded fields + static fallback branch;
  • add test_shock_registry.py

@Hackatro Hackatro linked an issue Jun 9, 2026 that may be closed by this pull request
from typing import TYPE_CHECKING
from Melodie import Environment

try:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this badaid?

bra_scale = self.shock_scales.get("farm_capacity_bra", 0.0)
bra_value = self.get_effective_value("farm_capacity_bra")
drought = drought_param()
bra_scale = self.shock_scales.get(drought, 0.0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still fixed values?

shock_onset_feed_mill: int = 0
shock_end_feed_mill: int = 365
# --- Supply chain routing ---
santos_share: float = 0.7 # 70% of BRA exports via Santos

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed santos mention



# (PDL entity id, impact field "supply"|"price") -> SupplyChainScenario / model param name.
BINDING: dict[tuple[str, str], str] = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still somewhat fixed like this, right?
Maybe we need to discuss this further

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Derive shock parameter registry dynamically from PDL

2 participants