$ ⌘K
// playbooks / global-supply-chain-risk · trade_flow_forecasting

Trade Flow Forecasting & Disruption Early Warning

step_count: 6· runtime: —

Time series analysis pipeline: fit VAR models to trade flow data, test Granger causality for risk propagation pathways, detect structural breaks and changepoints, and generate disruption forecasts.

// pipeline
6 steps· DAG
01

Time Series Data Quality Gate

action data_quality_gateon fail: abort
config (4 keys)
{
  "constructs": [
    "trade_flow_volume",
    "gscpi",
    "geopolitical_risk_index"
  ],
  "frequency": "monthly",
  "min_time_periods": 48,
  "require_temporal": true
}
02

Stationarity Tests (ADF, KPSS)

action analyze
config (3 keys)
{
  "difference_if_nonstationary": true,
  "tests": [
    "adf",
    "kpss"
  ],
  "variables": [
    "trade_flow_volume",
    "gscpi",
    "geopolitical_risk_index"
  ]
}
03

VAR Model — Trade Flow Dynamics

engine vector_autoregressionstationarity_test
config (3 keys)
{
  "ic_criterion": "aic",
  "max_lags": 12,
  "variables": [
    "trade_flow_volume",
    "gscpi",
    "geopolitical_risk_index",
    "port_congestion_index"
  ]
}
expected results (1 key)
{
  "gscpi_predicts_trade_flow": true
}
04

Granger Causality — Risk Propagation Directions

engine granger_causalityvar_estimation
config (3 keys)
{
  "max_lags": 6,
  "pairs": [
    [
      "gscpi",
      "trade_flow_volume"
    ],
    [
      "geopolitical_risk_index",
      "trade_flow_volume"
    ],
    [
      "port_congestion_index",
      "lead_time_variability"
    ]
  ],
  "significance_level": 0.05
}
expected results (1 key)
{
  "gscpi_granger_causes_trade_flow": {
    "direction": "positive"
  }
}
05

Changepoint Detection — Regime Shifts

engine changepoint_detection
config (4 keys)
{
  "algorithm": "pelt",
  "min_segment_length": 6,
  "penalty": "bic",
  "variable": "gscpi"
}
expected results (2 keys)
{
  "changepoints_found": true,
  "covid_regime_detected": true
}
06

Impulse Response Functions — Shock Propagation

action analyzevar_estimation
config (4 keys)
{
  "confidence_interval": 0.95,
  "horizon": 24,
  "response_variables": [
    "trade_flow_volume",
    "lead_time_variability"
  ],
  "shock_variable": "gscpi"
}
// from pax
Global Supply Chain Risk
// engines
engine.granger_causalityengine.changepoint_detectionengine.vector_autoregression
// note
step bodies extracted from the .pax archive at build time. download the parent pax for the full yaml.
[ download global-supply-chain-risk.pax.tar.gz ]