供应商入库配送天气风险数据洞见
此消费数据产品示例通过 BigQuery 共享订阅了 Dun & Bradstreet (D&B) 全球航运数据洞见的多模态海运承运商遥测数据和 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进行地理编码的陆地供应商原产地)、目的港口和接收工厂,以精准识别由天气原因导致的港口关闭、供应商发货风险和入库交付延迟。
参考架构
概要参考架构简要介绍了为此应用场景提供数据所需的特定于来源的数据产品。
已发布的数据资产
部署“供应商入站配送天气风险数据洞见”模块会在目标数据集中创建以下 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)。 - Dun & Bradstreet Global Shipping Insights (
analytics_hub):在 BigQuery 共享中订阅 Dun & Bradstreet 配送数据洞见列表,并在analytics_hub目录模块的inlineTableSettings.tables中添加shipping_insights。 - Google WeatherNext 3 (
analytics_hub):在 BigQuery Sharing 中订阅 Google WeatherNext 3 列表,并在analytics_hub目录模块的inlineTableSettings.tables中添加weathernext_3_0_0。
如需了解目录订阅和验证详情,请参阅 BigQuery Sharing 集成。
在 config/config.yaml 中启用数据产品
将 Dun & Bradstreet 和 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 中查看实体关系 (ER) 图表,也可以使用 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 入站物流风险智能体 (cortex-sap-inbound-logistics-risk-analyst),并使用 uv run cortex-create-ca-agents 为其预配资源,或者在 BigQuery Studio 中创建自定义数据智能体,以询问有关海港拥堵、船只大风或涌浪中断以及多式联运入站交付风险的问题。