供應商進貨天氣風險洞察

這項消費資料產品範例擴充了供應商和工廠天氣風險洞察,加入 Dun & Bradstreet (D&B) Global Shipping Insights 的多模態海洋運輸遙測資料,以及透過 BigQuery 共用訂閱的 Google WeatherNext 3 集合預測。這項解決方案會對應 SAP 進貨交貨作業在實體物流節點 (海運裝貨港或經地理編碼的陸地供應商來源,如果無法解析出發海港)、卸貨港和接收 SAP 工廠) 的情況,量化海洋運輸延遲、港口停留瓶頸和惡劣天氣暴露。

這個範例可讓您:

  • 使用四層比對串聯,將 SAP 進貨交貨連結至海運提單、船隻里程碑時間戳記 (vessel_departure_time、vessel_arrival_time、vessel_unload_time) 和 UN/LOCODE 裝卸港口,不需展開資料列。如要直接比對bill_of_lading_bolnr (LIKP-BOLNR),必須使用海運模式或海洋國貿條規;D&B 託運人記錄和起點到目的地貿易走廊層級僅適用於跨境海運或多式聯運,因此國內和非提單公路、鐵路或空運路線會解析為SAP_HISTORICAL_FALLBACK。
  • 根據美國國家地理空間情報局 (NGA) 的世界港口指數,評估全球海港的港口基礎設施限制,例如港口大小、航道和貨運碼頭深度,以及潮差。
  • 在可設定的空間半徑 (預設為 25 公里) 內,疊加 72 小時 WeatherNext 3 集合預測,涵蓋出發港口 (或從 world_city_directory 地理編碼的陸地供應商來源,如果無法解析出發海港)、目的地港口和接收工廠,精確指出天氣因素導致的港口關閉、供應商調度風險和進貨延遲。

參考架構

高階參考架構會概略說明,為這個用途提供資料所需的來源特定資料產品。

Cortex Framework 的供應商進貨天氣風險洞察消費資料產品範例參考架構

圖 1:Cortex Framework 的供應商進貨天氣風險洞察資訊消耗資料產品範例參考架構。

已發布的資料資產

部署供應商進貨天氣風險洞察模組後,系統會在目標資料集中建立下列 BigQuery 資料表和檢視表:

資料資產 實體化 主鍵精細程度 說明
supplier_inbound_delivery_weather_risk_insights View delivery_document、delivery_document_item 多模態消耗檢視畫面,可透過 D&B 提單貨運公司屬性和船隻里程碑時間戳記 (vessel_departure_time、vessel_arrival_time、vessel_unload_time)、經驗海洋運輸和港口停留時間 (託運人和貿易走廊層級僅限跨境海運或多模態運輸,因此國內和非提單公路、鐵路或空運路線會解析為 SAP_HISTORICAL_FALLBACK)、NGA 港口實體限制,以及出發港 (如果沒有解析出發海港,則會改用 world_city_directory 的陸地供應商來源)、目的地港和接收工廠的多節點 WeatherNext 3 集合預測,豐富 inbound_delivery_insights。
world_port_index_directory Table unlocode 全球海港參考資料表,資料來源為美國國家地理空間情報局 (NGA) 的世界港口索引 (第 150 號出版品),包含標準化聯合國地名代碼 (UN/LOCODE) 鍵、WGS84 座標、預先計算的 BigQuery GEOGRAPHY 點,以及港口深度和避風港屬性。

必要的上游產品和目錄來源

啟用這個範例前,請先設定下列依附元件:

  • 基礎資料產品 (supplierPlantWeatherRiskInsights):啟用供應商和工廠天氣風險洞察 (inbound_delivery_insights 和 world_city_directory)。
  • 鄧白氏全球運送洞察 (analytics_hub):在 BigQuery sharing 中訂閱鄧白氏運送洞察清單,並在 analytics_hub 目錄模組的 inlineTableSettings.tables 中加入 shipping_insights。
  • Google WeatherNext 3 (analytics_hub):在 BigQuery 共用中訂閱 Google WeatherNext 3 清單,並在 analytics_hub 目錄模組的 inlineTableSettings.tables 中加入 weathernext_3_0_0。

如要瞭解目錄訂閱和驗證詳情,請參閱「BigQuery sharing 整合」。

在 config/config.yaml 啟用資料產品

註冊鄧白氏和 Google WeatherNext analytics_hub 目錄,以及 SAP BDC 目錄,確保 supplier_plant_weather_risk_insights 已啟用,並在 data.modules.products 下新增 supplier_inbound_delivery_weather_risk_insights:

data:
  namespaces:
    - name: cortex
    - name: cortex_samples

  modules:
    catalogs:
      # Include sap_bdc_catalog from Supplier and Plant Weather Risk Insights.
      # Dun & Bradstreet Global Shipping Insights linked dataset.
      - id: ah_dnb_catalog
        type: analytics_hub
        bindsNamespaces: [cortex.external.dnb]
        connectionSettings:
          projectId: LINKED_DATASET_PROJECT_ID
          datasetId: DNB_DATASET_ID
          location: US
        inlineTableSettings:
          tables:
            - shipping_insights

      # Google WeatherNext 3 linked dataset.
      - id: ah_weathernext_catalog
        type: analytics_hub
        bindsNamespaces: [cortex.external.weathernext]
        connectionSettings:
          projectId: LINKED_DATASET_PROJECT_ID
          datasetId: WEATHERNEXT_DATASET_ID
          location: US
        inlineTableSettings:
          tables:
            - weathernext_3_0_0

    products:
      # Upstream base sample product (required).
      - moduleId: supplier_plant_weather_risk_insights
        enabled: true
        modulePath: cortex_samples.sap_bdc.products.supplier_plant_weather_risk_insights
        dataTargetId: samples_target
        dependencyBindings:
          sapBdcPurchaseOrder: sap_bdc_catalog.purchaseorder
          sapBdcSupplier: sap_bdc_catalog.supplier
          sapBdcPlant: sap_bdc_catalog.plant
          sapBdcAddress: sap_bdc_catalog.address
          sapBdcProduct: sap_bdc_catalog.product
          sapBdcCompany: sap_bdc_catalog.company
          sapBdcDeliveryHeader: sap_bdc_catalog.delivery_header
          sapBdcDeliveryItem: sap_bdc_catalog.delivery_item
          weatherNext: ah_weathernext_catalog.weathernext_3_0_0

      # Enabled Supplier Inbound Delivery Weather Risk Insights sample.
      - moduleId: supplier_inbound_delivery_weather_risk_insights
        enabled: true
        modulePath: cortex_samples.sap_bdc.products.supplier_inbound_delivery_weather_risk_insights
        dataTargetId: samples_target
        dependencyBindings:
          supplierPlantWeatherRiskInsights: supplier_plant_weather_risk_insights
          dnbShipping: ah_dnb_catalog.shipping_insights
          weatherNext: ah_weathernext_catalog.weathernext_3_0_0
        inlineTableSettings:
          supplier_inbound_delivery_weather_risk_insights:
            filters:
              schedule_variance_thresholds:
                extended_port_dwell_threshold_days: 4.0
              weather_thresholds:
                forecast_horizon_hours: 72
                spatial_radius_meters: 25000

更改下列內容:

  • LINKED_DATASET_PROJECT_ID:託管已訂閱 BigQuery 共用連結資料集的 Google Cloud 專案 ID,例如:my-cortex-project。
  • DNB_DATASET_ID:訂閱的 Dun & Bradstreet Global Shipping Insights 清單 BigQuery 資料集 ID,例如 dnb_global_shipping_insights。
  • WEATHERNEXT_DATASET_ID:訂閱的 Google WeatherNext 3 產品資訊 BigQuery 資料集 ID,例如:google_weathernext_3。

如需 inlineTableSettings 或 tableSettings 下可設定的 critical_material_types、schedule_variance_thresholds (包括 extended_port_dwell_threshold_days) 和 weather_thresholds 選項完整組合,請參閱 src/data_modules/cortex_samples/sap_bdc/products/supplier_inbound_delivery_weather_risk_insights/table_settings.default.yaml。

建構及部署設定好的範例:

export CORTEX_CONFIG_FILE=config/config.yaml
uv run cortex-build-and-deploy --config $CORTEX_CONFIG_FILE

實體關係圖

您可以在模組的 README.md 中查看實體關係圖,或使用 uv run cortex-metadata erd 從編譯的工作區生成:

export CORTEX_CONFIG_FILE=config/config.yaml
uv run cortex-metadata erd \
  --config $CORTEX_CONFIG_FILE \
  --module-id supplier_inbound_delivery_weather_risk_insights

原始碼

在 src/data_modules/cortex_samples/sap_bdc/products/supplier_inbound_delivery_weather_risk_insights 存放區中,探索 SQL 模型、manifest.yaml 和註解。

啟用 AI 代理

在 BigQuery 中具體化 supplier_inbound_delivery_weather_risk_insights 後,您可以在 config/config.yaml 中啟用預先建構的 SAP Inbound Logistics Risk Agent (cortex-sap-inbound-logistics-risk-analyst),並使用 uv run cortex-create-ca-agents 佈建,或在 BigQuery Studio 中建立自訂資料代理,詢問有關海港擁塞、船隻強風或湧浪中斷,以及多模態進貨交付風險的問題。

後續步驟