GdiSDK

目录

  • 概述 (Overview)
    • GdiSDK是什么?
    • 设计理念
    • 核心架构
      • 数据层 (DataClass)
      • 处理层 (Modules)
      • 应用层 (Pipeline)
      • 交互层 (GDIM)
    • 应用场景
      • 通用应用场景
      • 专业应用场景
    • 技术特性
      • 现代化技术栈
      • 开发友好
    • 获取支持
  • 新手入门 (Getting Started)
    • 为什么使用GdiSDK?
      • 专业鸿沟问题
      • 数据质量挑战
      • GdiSDK的技术优势
    • 安装和环境搭建
      • 系统要求
      • 安装Python环境
      • 创建虚拟环境
      • 安装GdiSDK
      • 配置开发环境
      • 注册GDIM账户
    • 入门案例
      • 案例一:提取钻孔一览表数据
      • 案例二:写入钻孔一览表至GDIM
      • 案例三:生成钻孔一览表报告
    • 下一步
  • AI辅助开发 (Code Agent)
    • 什么是 AI IDE?
    • 什么是 Skills?
    • 为什么推荐使用 gdisdk-skills?
    • gdisdk-skills 仓库
    • 安装 Skills
      • 安装前提
      • 项目内安装(推荐)
      • 全局安装
      • 安装后验证
    • llms.txt(文档索引)
    • 三个核心 Skill 详解
      • pipeline-creator:生成 Pipeline 脚本
      • local-function-coder:编写 PythonCoder 本地函数
      • pipeline-gdim-review:上传前兼容性检查
    • 推荐开发工作流
    • 参考资料
  • 用户指南 (User Guide)
    • 什么是GDIM?
    • 什么是工作流 (Pipeline)?
    • 什么是模块 (Module)?
    • 端口类型与核心数据结构
    • 创建一个Pipeline
    • 理解Pipeline机制
    • 如何定义Pipeline的UI交互
    • 如何上传Pipeline至GDIM
    • 如何创建一个PythonCoder
    • 如何创建一个自定义模块
    • 如何定义模块的UI交互
  • 运行机制 (Runtime)
    • Pipeline 是什么
    • 连线如何生效
    • 如何执行
    • 模块何时算成功执行
    • 属性绑定
    • 运行上下文
    • 跨 Pipeline 数据:save_data_to_db 与 GDIM 数据库
    • 保存与复用
    • 推荐理解顺序
    • 相关主题
  • 流程控制 (Flow Control)
    • 什么时候需要流程控制
    • ForEachController 是什么
    • 核心概念
    • 三种结果访问方式
      • 聚合端口的命名规则
    • 接入 Pipeline
    • 完整示例
    • 常见注意事项
    • 调试与排错
    • 相关 API
    • 相关主题
  • 运行调试 (Debug)
    • 何时使用
    • 如何开启
    • 命令行看啥
    • Trace 文件
    • 结果解读
    • 排查思路
    • 相关主题
  • 上传 GDIM 检查 (GDIM Upload Check)
    • 为什么需要单独检查
    • 总检查清单
    • 当前已整理的重点模块
    • 推荐检查顺序
  • 学习案例 (Examples)
    • 案例一:按所需深度筛选钻孔
      • 案例概述
      • 你将学到
      • 实现思路
      • 关键代码
      • 更进一步
    • 案例二:绘制钻孔深度柱状图
      • 案例概述
      • 你将学到
      • 实现思路
      • 关键代码
      • 更进一步
    • 案例三:计算地层平均厚度
      • 案例概述
      • 你将学到
      • 实现思路
      • 关键代码
      • 更进一步
    • 案例四:处理地层表数据
      • 案例概述
      • 你将学到
      • 实现思路
      • 关键代码
      • 更进一步
    • 案例五:向 GDIM 写入数据
      • 案例概述
      • 你将学到
      • 实现思路
      • 关键代码
      • 更进一步
    • 案例六:在word中打印钻孔一览表
      • 案例概述
      • 你将学到
      • 实现思路
      • 关键代码
      • 更进一步
    • 案例七:绘制沉降时程曲线
      • 案例概述
      • 你将学到
      • 实现思路
      • 关键代码
      • 更进一步
    • 案例八:生成三维沉降曲面
      • 案例概述
      • 你将学到
      • 实现思路
      • 关键代码
      • 更进一步
    • 案例九:生成沉降分析报告
      • 案例概述
      • 你将学到
      • 实现思路
      • 关键代码
      • 更进一步
    • 案例十:基于大模型生成场地评价报告
      • 案例概述
      • 你将学到
      • 实现思路
      • 关键代码
      • 更进一步
    • 案例十一:基于大模型进行报告审核
      • 案例概述
      • 你将学到
      • 实现思路
      • 关键代码
      • 更进一步
    • 案例十二:导出GDIM表数据
      • 案例概述
      • 你将学到
      • 实现思路
      • 关键代码
      • 更进一步
  • 模块帮助 (Module Help)
    • modules.readers 模块帮助
      • CsvReader
      • GdimTableReader
      • ReadGtbFile
      • GdimAppDataReader
      • GdimAppProjectInfoReader
    • modules.writers 模块帮助
      • DocDataWriter
      • TextWriter
      • ExportGdimTables
      • GdimTableWriter
      • MergeDocData
      • DocPrinter
      • ExcelPrinter
    • modules.converters 模块帮助
      • PdfToImages
      • TableToMarkdown
      • TablesToMarkdown
      • DocxToMarkdown
      • TableToDataFrame
      • TableToJson
      • JsonToTable
      • TableToSingleResult
      • TableToResultModel
      • SingleResultToText
      • SingleResultToTable
      • TableToString
    • modules.mergers 模块帮助
      • MergeSingleResult
      • MergeResultModels
      • MergeTables
      • MergeGdimTables
    • modules.filters 模块帮助
      • TableSeriesSelector
      • TableSelector
      • TableCollectionSelector
      • TablesQuery
      • DropDuplicateRows
      • GdimAppDataSelector
      • MarkdownSectionFilter
    • modules.statistics 模块帮助
      • TableDescribe
      • ValuesCount
      • SphericalKMeans
    • modules.operators 模块帮助
      • ArithmeticOperator
      • ModifyTableColumns
      • AddTableColumns
        • 1)Inline 方式(推荐,最方便)
        • 2)文件方式(上传GDIM必须采用此方式,需要 @local_function)
      • TableCalculator
        • 1)Inline 方式:自定义汇总逻辑
        • 2)文件方式:上传GDIM必须采用此方式(需要 @local_function)
      • RenameTableColumns
    • modules.gisOperators 模块帮助
      • ConvexHullCenter
    • modules.geoSurvey 模块帮助
      • SeismicDesignParameters
      • WaterSoilCorrosion
    • modules.geoDataProcess 模块帮助
      • MapBoreTypeToKCAD
      • AddLayerNumberByStdLayerTable
      • SortByLayerNumber
    • modules.llmAI 模块帮助
      • PromptTemplate
      • LLMNode
      • TableDataExtractor
      • DictDataExtractor
      • TableAnalyzer
    • modules.plotters 模块帮助
      • LineChartPlotter
      • BarChartPlotter
      • ScatterChartPlotter
      • HistogramPlotter
      • PieChartPlotter
      • TablePlotter
      • PlotMerger
    • modules.widgets 模块帮助
      • PythonCoder
        • 1)在 Pipeline 中创建并配置 PythonCoder
        • 2)在脚本中定义本地函数(@local_function)
        • 1)Inline 本地函数 vs 文件本地函数(GDIM 上传要求)
        • 2)@local_function 的 module 参数可以做什么
        • 3)UI Schema 的本地函数与 reset 参数
        • 4)兼容 gdi / gdisdk 的包导入写法
        • 5)本地函数可用的第三方包
  • 端口类型 (Port Type)
    • 端口、端口类型与 PortTypeHint
    • TableData:模块之间传递单张业务表
    • TableCollection:模块之间整体传递多张关联表
    • ResultModel:推荐的结构化结果端口类型
    • SingleResult:兼容旧模块的“关键指标结果”端口类型
    • AgentRunResult:用于保留大模型原始运行结果的端口类型
    • DocData:报告打印的数据容器(模板 keys 与渲染数据)
    • PlotData:前端图表输出端口
    • Text:前端可展示的文本端口
    • Picture:前端可展示的图片端口
    • 设计动机:为数据智能准备好的结构
    • 端口类型家族概览
  • 端口数据结构 (Port Dataclass)
    • 快速导航
    • FieldMetadata
      • 导入路径
      • 初始化参数
      • 使用示例
    • TableData
      • 导入路径
      • 初始化参数
      • 主要属性
      • 常用方法
      • 使用示例
    • TableSeries
      • 导入路径
      • 主要属性
      • 常用方法
    • TableCollection
      • 导入路径
      • 初始化参数
      • 常用方法
      • 使用示例
    • UnitResult
      • 导入路径
      • 字段
      • 使用示例
    • ResultModel
      • 导入路径
      • 定义方式
      • 主要属性
      • 常用方法
      • 使用示例
    • SingleResult
      • 导入路径
      • 初始化参数
      • 主要属性
      • 常用方法
      • 使用示例
    • AgentRunResult
      • 导入路径
      • 说明
      • 选型建议
      • 使用示例
    • DocData
      • 导入路径
      • 字段
      • 常用方法
    • PlotData
    • CoordinateSystem
      • 导入路径
      • 字段
      • 使用示例
    • GdimTemplate
      • 导入路径
      • 常用方法
      • 典型适用场景
    • GdimMinIOFile
      • 导入路径
      • 字段
      • 常用方法
      • 典型适用场景
    • 如何在设计模块端口时配合使用
  • UI控件 (UI Schema)
    • 什么是 UI Schema?
    • 常用 UIAttributeSchema 类型概览
    • 与 PipeLine 属性及 GDIM UI 的协同
    • 更多示例与推荐阅读
  • API参考 (API Reference)
    • Modules Package
      • modules.converters
        • Classes
      • modules.dataClean
        • Classes
        • Functions
      • modules.filters
        • Classes
      • modules.foundationPit
        • Classes
      • modules.geoDataProcess
        • Classes
      • modules.geoSurvey
        • Classes
      • modules.gisOperators
        • Classes
      • modules.llmAI
        • Classes
      • modules.mergers
        • Classes
      • modules.operators
        • Classes
      • modules.pileFoundation
        • Classes
      • modules.plotters
        • Classes
      • modules.readers
        • Classes
      • modules.shallowFoundation
        • Classes
      • modules.statistics
        • Classes
      • modules.widgets
        • Classes
      • modules.writers
        • Classes
    • Pipeline Package
      • pipeline.exceptions
        • Classes
      • pipeline.flowControl
        • Notes
        • Classes
      • pipeline.links
        • Classes
      • pipeline.module
        • Classes
      • pipeline.moduleDecorators
        • Functions
      • pipeline.nameSpace
        • Classes
        • Functions
      • pipeline.observability
        • Examples
        • Functions
      • pipeline.pipeData.ui_schema
        • Classes
      • pipeline.pipeline
        • Classes
      • pipeline.port
        • Classes
      • pipeline.portTypes
        • Classes
        • Functions
      • pipeline.runner
        • Classes
    • Dataclass Package
      • dataclass.gdimData
        • Classes
        • Functions
      • dataclass.geoProfiles
        • Classes
        • Functions
      • dataclass.geoStructures
        • Classes
      • dataclass.llmAIModels
        • Classes
      • dataclass.logs
        • Classes
        • Functions
      • dataclass.results
        • Classes
        • Functions
      • dataclass.specialTables
        • Classes
        • Functions
      • dataclass.tables
        • Classes
      • dataclass.terminologies
        • Classes
  • 更新日志 (Change Log)
    • 版本历史
      • v0.3.2
      • v0.3.1
      • v0.3.0
      • v0.2.8
      • v0.2.7
    • 更新说明
      • 版本命名规范
    • 升级指南
      • 从旧版本升级
    • 贡献指南
      • 如何报告问题
    • 联系我们
GdiSDK
  • API参考 (API Reference)
  • Pipeline Package
  • pipeline.links

pipeline.links

Link classes for the pipeline framework.

Contains:

  • LinkList: list subclass supporting the | operator to combine links

  • Link: connects an output port of one module to an input port of another

  • ConditionalLink: a Link that transfers data only when a runtime condition is True

Classes

class pipeline.links.LinkList

A list subclass that supports the | operator for chaining Link objects.

Inherits from:

list

class pipeline.links.Link

A link to link the output port of parent module and input port of child module.

Methods:

__init__(parent: PipeModule | PortReference, child: PipeModule | PortReference, port_out: str | None = None, port_in: str | None = None, lname: str | None = None) → None

Initialize the Link object.

Parameters

parentPipeModule | PortReference

The parent module or a PortReference for the output port.

childPipeModule | PortReference

The child module or a PortReference for the input port.

port_outstr, default: None

The output port name of the parent module. When it’s None, the first output port will be used. Ignored if parent is a PortReference.

port_instr, default: None

The input port name of the child module. When it’s None, the first input port will be used. Ignored if child is a PortReference.

connect(connection: tuple) → Link

Create a Link from a tuple of PortReference objects.

Parameters

connectiontuple

A tuple of (output_port_reference, input_port_reference)

Returns

Any
Link
    The created link

Examples

>>> link = Link.connect((parent.OutputPort, child.InputPort))
chain() → list[Link]

Create multiple Links from chained connections.

Parameters

*connectionsPortReference or Link

Chain of connections using >> operator or existing Link objects

Returns

Any
list[Link]
    List of created links

Examples

>>> links = Link.chain(
...     parent.OutputPort >> child.InputPort,
...     child.OutputResult >> final.InputData
... )
when(condition: Callable[[PipeModule], bool] | str) → ConditionalLink

Convert this link into a ConditionalLink with a runtime condition.

Auto-detects the condition type from the argument:

- **Callable** → used directly as the condition function (Python-only, not
  serializable into .pipe files).
  Signature: ````condition(parent_module: PipeModule) -> bool````
- **str that is a valid Python identifier** → treated as ````condition_name````:
  the name of a function in the pipeline's ````local_functions_path```` file.
  Fully serializable.
- **str with operators / spaces** → treated as ````condition_expr````: a Python
  expression evaluated with the parent module's output port data and

Parameters

conditionCallable | str

The condition to apply. Type is auto-detected as described above.

Returns

Any

ConditionalLink

Examples

>>> # Expression string – port data available by name
>>> (scorer.OutputScore >> grader.InputData).when("OutputScore > 0.5")

>>> # Function name – resolved from pipeline.local_functions_path
>>> (scorer.OutputScore >> grader.InputData).when("check_score_valid")

>>> # Callable – convenient but not serializable
>>> (scorer.OutputScore >> grader.InputData).when(
...     lambda m: m["OutputScore"] is not None and m["OutputScore"] > 0.5
... )
class pipeline.links.ConditionalLink

A Link that only transfers data when a runtime condition evaluates to True.

When the condition evaluates to False, the link and all its downstream
descendants are skipped for that pipeline run — no data is transferred
and the child module is not executed.

Three ways to specify a condition (evaluated in priority order):

#. **condition** (Callable) — a Python callable for interactive / script use.
   Not serializable into ````.pipe```` files.
   Signature: ````condition(parent_module: PipeModule) -> bool````

#. **condition_name** (str, valid Python identifier) — the name of a function
   in the pipeline's ````local_functions_path```` file.  Fully serializable.
   The function must accept a single ````PipeModule```` argument and return ````bool````.

#. **condition_expr** (str, expression) — a Python expression evaluated with
   the parent module's output port data and attributes available as variables.
   Fully serializable.
   Port names always start with ````Input````/````Output````, so they never collide
   with attribute names in the evaluation context.

Parameters

parentPipeModule | PortReference

Source module or output PortReference.

childPipeModule | PortReference

Target module or input PortReference. port_out : str, optional Output port name on the parent (auto-selected if None). port_in : str, optional Input port name on the child (auto-selected if None). lname : str, optional Custom link name. condition : Callable[[PipeModule], bool], optional Runtime callable. Takes the parent module and returns bool. condition_name : str, optional Name of a function in ``pipeline.local_functions_path``. condition_expr : str, optional Python expression string. Parent output ports and attributes are available as variables by their names.

Examples

>>> # Fluent API (recommended)
>>> (scorer.OutputScore >> grader.InputData).when("OutputScore > 0.5")

>>> # Direct construction with expression
>>> ConditionalLink(
...     scorer.OutputScore, grader.InputData,
...     condition_expr="OutputScore > 0.5",
... )

>>> # Direct construction with function name
>>> ConditionalLink(
...     scorer.OutputScore, grader.InputData,
...     condition_name="check_score_valid",
... )
Inherits from:

Link

Methods:

__init__(parent: PipeModule | PortReference, child: PipeModule | PortReference, port_out: str | None = None, port_in: str | None = None, lname: str | None = None, condition: Callable[[PipeModule], bool] | None = None, condition_name: str | None = None, condition_expr: str | None = None) → None
evaluate(parent_module: PipeModule, local_functions_path: str | Path | None = None) → bool

Evaluate the condition against the parent module.

Condition types are tried in priority order: callable → condition_name → condition_expr. Returns ``True`` when no condition is set (acts as a regular unconditional link).

Parameters

parent_modulePipeModule

The parent module whose ports and attributes are exposed to the condition. local_functions_path : str | Path, optional Path to the local functions file; required when ``condition_name`` is set.

Returns

Any
bool
    Whether the link should transfer data and trigger child execution.
Previous Next

© Copyright 2026, 南京库仑软件技术有限公司.