# ──────────────────────────────────────────────────────────────────────────────
# 公文知识图谱 Schema 配置
#
# 本文件驱动以下能力:
#   - Neo4j 节点/关系类型注册与约束创建
#   - LLM 实体抽取提示词自动生成
#   - 实体归一化规则
#   - 前端图谱可视化配置 (icon / color / zh_name)
#
# 修改后需重启服务以重新加载.
# ──────────────────────────────────────────────────────────────────────────────

# ── Phase 标记 ────────────────────────────────────────────────────────────────
# 每个实体/关系可标记所属 phase, 用于按阶段启用:
#   phase_0   治理图 + 核心公文图
#   phase_1   事项图 (办事能力层)
#   phase_2a  条款基础图 (条款回链、条款定位事项与职责机构)
#   phase_2b  条款细粒度语义 (条款级条件/材料/时限抽取, 依赖 phase_2a)
#   phase_3   办公扩展层 (人物、事件、机制、标准等，通过 extraction_scenes 按需启用)

# ── 实体类型 ──────────────────────────────────────────────────────────────────

entity_types:

  # ── Phase 0: 治理图 + 核心公文图 ──────────────────────────────────────────────

  - name: Organization
    zh_name: 机构
    description: "政府机关、主管部门、责任部门（使用规范全称）"
    icon: bank
    color: "#52c41a"
    phase: phase_0
    extraction_mode: llm          # llm | metadata | hybrid | none
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      normalized_name: { type: string }
      short_name: { type: string }
      org_type: { type: string }
      admin_level: { type: string }
      aliases: { type: array }
      region_code: { type: string }

  - name: Region
    zh_name: 地域
    description: '行政地域、适用地域（如"全省"、"北京市朝阳区"）'
    icon: environment
    color: "#f5222d"
    phase: phase_0
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      full_name: { type: string }
      region_code: { type: string }
      region_level: { type: string }
      parent_region_code: { type: string }
      aliases: { type: array }

  - name: PolicyTheme
    zh_name: 政策主题
    description: '稳定的政策主题/专项领域（如"营商环境优化"、"乡村振兴"、"数字政府建设"，高层级概括）'
    icon: appstore
    color: "#2f54eb"
    phase: phase_0
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      description: { type: string }
      keywords: { type: array }
      parent_theme_id: { type: string }

  - name: Policy
    zh_name: 政策
    description: "可独立引用的政策措施或政策工具（如\"减税降费政策\"\"人才引进计划\"）。仅当文档包含多条独立政策措施时才抽取；文档整体即为一条政策时不额外抽取 Policy"
    icon: audit
    color: "#9254de"
    phase: phase_0
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      normalized_name: { type: string }
      entity_subtype: { type: string }
      subtype_code: { type: string }
      summary: { type: string }
      effective_date: { type: string }
      expiry_date: { type: string }
      status: { type: string }
      aliases: { type: array }

  - name: Task
    zh_name: 任务
    description: "可分配的具体工作项（有责任方/截止时间），如\"完成政务服务标准化建设\"\"推进不动产登记改革\"。必须有明确执行主体或时间约束，不抽取宏观目标。Task vs Project：Task 无独立建设周期和预算"
    icon: carry-out
    color: "#ff7a45"
    phase: phase_0
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      normalized_name: { type: string }
      entity_subtype: { type: string }
      subtype_code: { type: string }
      description: { type: string }
      deadline: { type: string }
      priority: { type: string }
      status: { type: string }
      aliases: { type: array }

  - name: Project
    zh_name: 项目
    description: "有独立建设周期和预算的具名项目/工程（如\"智慧城市一期工程\"\"粤港澳大湾区数据平台建设项目\"）。Project vs System：Project 是建设过程，System 是建成后的运行态"
    icon: project
    color: "#36cfc9"
    phase: phase_0
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      normalized_name: { type: string }
      entity_subtype: { type: string }
      subtype_code: { type: string }
      description: { type: string }
      start_date: { type: string }
      end_date: { type: string }
      total_budget: { type: string }
      status: { type: string }
      aliases: { type: array }

  - name: System
    zh_name: 系统
    description: "运行态的 IT 系统、平台、应用（如\"政务服务一体化平台\"\"公共资源交易系统\"）。仅限已命名的信息化系统，不抽取泛指的\"系统\""
    icon: cloud-server
    color: "#597ef7"
    phase: phase_0
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      normalized_name: { type: string }
      entity_subtype: { type: string }
      subtype_code: { type: string }
      description: { type: string }
      url: { type: string }
      status: { type: string }
      aliases: { type: array }

  - name: DataResource
    zh_name: 数据资源
    description: "可识别的数据集、数据库、数据目录（如\"全省统一数据共享交换平台目录\"\"人口基础信息库\"）。必须是具名数据资源，不抽取泛指的\"数据\""
    icon: database
    color: "#73d13d"
    phase: phase_0
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      normalized_name: { type: string }
      entity_subtype: { type: string }
      subtype_code: { type: string }
      description: { type: string }
      data_level: { type: string }
      update_frequency: { type: string }
      aliases: { type: array }

  - name: Indicator
    zh_name: 指标
    description: "可量化的 KPI、目标值、统计指标（如\"营商环境满意度达90%\"\"办件时限压缩50%\"）。仅限有明确数值或量化标准的指标，不抽取定性评价。Indicator vs Standard：Indicator 仅限量化 KPI，Standard 仅限规范性标准"
    icon: dashboard
    color: "#ffc53d"
    phase: phase_0
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      normalized_name: { type: string }
      entity_subtype: { type: string }
      subtype_code: { type: string }
      target_value: { type: string }
      unit: { type: string }
      evaluation_period: { type: string }
      aliases: { type: array }

  - name: Budget
    zh_name: 预算
    description: "可识别的资金安排、预算科目、专项资金（如\"中央财政补贴2000万元\"\"省级科技创新专项资金\"）。必须包含金额数值或预算科目名称"
    icon: money-collect
    color: "#ff4d4f"
    phase: phase_0
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      normalized_name: { type: string }
      entity_subtype: { type: string }
      subtype_code: { type: string }
      amount: { type: string }
      currency: { type: string }
      fiscal_year: { type: string }
      budget_source: { type: string }
      aliases: { type: array }

  - name: Industry
    zh_name: 产业
    description: "具体产业或行业名称（如\"新能源汽车产业\"\"半导体产业\"\"现代农业\"）。必须是可识别的产业/行业，不抽取泛指的\"产业发展\""
    icon: shop
    color: "#bae637"
    phase: phase_0
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      normalized_name: { type: string }
      entity_subtype: { type: string }
      subtype_code: { type: string }
      description: { type: string }
      aliases: { type: array }

  # ── Phase 1: 事项图 ─────────────────────────────────────────────────────────

  - name: Matter
    zh_name: 事项
    description: '可独立办理或规范的具体行政事项（如"建设用地审批"、"差旅报销"、"政府采购供应商资格审查"）'
    icon: solution
    color: "#722ed1"
    phase: phase_1
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      normalized_name: { type: string }
      matter_type: { type: string }
      description: { type: string }
      aliases: { type: array }
      status: { type: string }

  - name: Condition
    zh_name: 条件
    description: '事项适用条件、资格条件、前置条件（如"申请人应具有法人资格"、"近三年无重大违法记录"）'
    icon: check-circle
    color: "#13c2c2"
    phase: phase_1
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      description: { type: string }
      condition_type: { type: string }
      structured_value: { type: string }
      operator: { type: string }

  - name: Material
    zh_name: 材料
    description: '申请材料、报送材料、证明材料（如"身份证原件及复印件"、"营业执照副本"）'
    icon: file-text
    color: "#eb2f96"
    phase: phase_1
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      normalized_name: { type: string }
      material_type: { type: string }
      description: { type: string }
      is_required: { type: boolean }
      format_requirement: { type: string }

  - name: TimeLimit
    zh_name: 时限
    description: '时限、办理周期、有效期（如"15个工作日"、"30日内答复"）'
    icon: clock-circle
    color: "#faad14"
    phase: phase_1
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      duration: { type: string }
      unit: { type: string }
      context: { type: string }
      time_type: { type: string }

  - name: TargetGroup
    zh_name: 适用对象
    description: '适用对象类型（如"企业法人"、"事业单位"、"中小企业"、"供应商"，不是具体人名）'
    icon: team
    color: "#fa541c"
    phase: phase_1
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      normalized_name: { type: string }
      group_type: { type: string }
      description: { type: string }
      aliases: { type: array }

  # ── Phase 2A: 条款基础图 ───────────────────────────────────────────────────

  - name: Article
    zh_name: 条款
    description: '文件中的条款结构（如"第三条 ..."）'
    icon: ordered-list
    color: "#597ef7"
    phase: phase_2a
    extraction_mode: hybrid        # 规则切分 + LLM 语义补充
    key_property: article_id
    properties_schema:
      article_id: { type: string, required: true }
      article_number: { type: string }
      title: { type: string }
      content: { type: string }
      order: { type: integer }
      norm_type: { type: string }
      anchor: { type: string }

  # ── Phase 3: 办公扩展层 ───────────────────────────────────────────────────

  - name: Person
    zh_name: 人物
    description: "公文中提及的公职人员、签发人、领导（如\"张三 市长\"）。仅抽取有明确职务或角色的人物，不抽取泛指"
    icon: user
    color: "#faad14"
    phase: phase_3
    extraction_mode: llm
    key_property: person_id
    properties_schema:
      name: { type: string, required: true }
      person_id: { type: string, required: true }
      position: { type: string }
      serving_org: { type: string }
      admin_level: { type: string }
      aliases: { type: array }

  - name: Event
    zh_name: 事件
    description: "具体的会议、活动、事件（如\"全省营商环境工作推进会\"\"第三次全体会议\"）。Event vs Document(纪要)：Event 是活动本身，Document 是活动产生的文件载体"
    icon: calendar
    color: "#ff85c0"
    phase: phase_3
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      normalized_name: { type: string }
      entity_subtype: { type: string }
      subtype_code: { type: string }
      event_date: { type: string }
      location: { type: string }
      description: { type: string }
      aliases: { type: array }

  - name: Mechanism
    zh_name: 机制
    description: "制度性协调/管理机制（如\"联席会议制度\"\"考核评估机制\"\"容错纠错机制\"）。必须是有明确名称的制度安排"
    icon: setting
    color: "#87e8de"
    phase: phase_3
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      normalized_name: { type: string }
      entity_subtype: { type: string }
      subtype_code: { type: string }
      description: { type: string }
      aliases: { type: array }

  - name: Standard
    zh_name: 标准
    description: "规范性标准、标准文件、服务标准、技术标准（如\"政务服务事项编码规范\"\"GB/T XXXXX\"）。仅限有明确名称或编号的标准，不抽取泛指的\"标准化\""
    icon: safety-certificate
    color: "#d3adf7"
    phase: phase_3
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      normalized_name: { type: string }
      entity_subtype: { type: string }
      subtype_code: { type: string }
      standard_code: { type: string }
      issuing_body: { type: string }
      description: { type: string }
      aliases: { type: array }

  - name: Infrastructure
    zh_name: 基础设施
    description: "物理或网络基础设施（如\"政务外网\"\"省级政务云平台\"\"5G基站\"）。必须是具名基础设施"
    icon: cluster
    color: "#95de64"
    phase: phase_3
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      normalized_name: { type: string }
      entity_subtype: { type: string }
      subtype_code: { type: string }
      description: { type: string }
      coverage: { type: string }
      aliases: { type: array }

  - name: Technology
    zh_name: 技术
    description: "具体技术或技术方向（如\"区块链\"\"人工智能\"\"大数据\"\"5G\"）。必须是可识别的技术名称"
    icon: experiment
    color: "#69c0ff"
    phase: phase_3
    extraction_mode: llm
    key_property: name
    properties_schema:
      name: { type: string, required: true }
      normalized_name: { type: string }
      description: { type: string }
      aliases: { type: array }

# ── 关系类型 ──────────────────────────────────────────────────────────────────

relationship_types:

  # ── Phase 0: 治理图关系 ─────────────────────────────────────────────────────

  - name: ISSUED_BY
    zh_name: 发布机构
    description: "文件由某机构发布"
    source_labels: [Document]
    target_labels: [Organization]
    phase: phase_0

  - name: APPLIES_TO_REGION
    zh_name: 适用地域
    description: "文件适用于某地域"
    source_labels: [Document]
    target_labels: [Region]
    phase: phase_0

  - name: BELONGS_TO_THEME
    zh_name: 所属主题
    description: "文件属于某政策主题"
    source_labels: [Document]
    target_labels: [PolicyTheme]
    phase: phase_0

  - name: BASED_ON
    zh_name: 依据文件
    description: '文件依据某上位文件制定（如"根据《XX法》""依据国发〔2024〕X号"）'
    source_labels: [Document]
    target_labels: [Document]
    phase: phase_0

  - name: AMENDS
    zh_name: 修订文件
    description: '文件修订某文件（如"对《XX办法》作如下修改"）'
    source_labels: [Document]
    target_labels: [Document]
    phase: phase_0

  - name: REPEALS
    zh_name: 废止文件
    description: '文件废止某文件（如"《XX规定》同时废止"）'
    source_labels: [Document]
    target_labels: [Document]
    phase: phase_0

  - name: REFERENCES
    zh_name: 引用文件
    description: '普通引用关系，作为兜底（通过文号如"X发〔YYYY〕NN号"识别）'
    source_labels: [Document]
    target_labels: [Document]
    phase: phase_0

  # ── Phase 0: 核心公文图新增关系 ────────────────────────────────────────────

  - name: CONTAINS_POLICY
    zh_name: 包含政策
    description: "文件包含某政策措施"
    source_labels: [Document]
    target_labels: [Policy]
    phase: phase_0

  - name: DEPLOYS_TASK
    zh_name: 部署任务
    description: "文件部署某工作任务"
    source_labels: [Document]
    target_labels: [Task]
    phase: phase_0

  - name: APPROVES_PROJECT
    zh_name: 批准项目
    description: "文件批准或启动某项目"
    source_labels: [Document]
    target_labels: [Project]
    phase: phase_0

  - name: LEAD_BY
    zh_name: 牵头单位
    description: "任务由某机构牵头"
    source_labels: [Task]
    target_labels: [Organization]
    phase: phase_0

  - name: ASSISTED_BY
    zh_name: 配合单位
    description: "任务由某机构配合"
    source_labels: [Task]
    target_labels: [Organization]
    phase: phase_0

  - name: ASSIGNED_TO
    zh_name: 责任单位
    description: "政策由某机构负责落实"
    source_labels: [Policy]
    target_labels: [Organization]
    phase: phase_0

  - name: IMPLEMENTED_BY
    zh_name: 实施单位
    description: "项目由某机构实施"
    source_labels: [Project]
    target_labels: [Organization]
    phase: phase_0

  - name: OPERATED_BY
    zh_name: 运营单位
    description: "系统由某机构运营管理"
    source_labels: [System]
    target_labels: [Organization]
    phase: phase_0

  - name: SUBORDINATE_TO
    zh_name: 上级机构
    description: "机构隶属于上级机构"
    source_labels: [Organization]
    target_labels: [Organization]
    phase: phase_0

  - name: COOPERATES_WITH
    zh_name: 协作机构
    description: "机构与另一机构协作"
    source_labels: [Organization]
    target_labels: [Organization]
    phase: phase_0

  - name: RELATES_TO_THEME
    zh_name: 关联主题
    description: "政策关联某政策主题"
    source_labels: [Policy]
    target_labels: [PolicyTheme]
    phase: phase_0

  - name: IMPLEMENTS
    zh_name: 落实政策
    description: "任务落实某政策"
    source_labels: [Task]
    target_labels: [Policy]
    phase: phase_0

  - name: LOCATED_IN
    zh_name: 所在地域
    description: "项目落地于某地域"
    source_labels: [Project]
    target_labels: [Region]
    phase: phase_0

  - name: SUPPORTED_BY
    zh_name: 支撑政策
    description: "项目受某政策支撑"
    source_labels: [Project]
    target_labels: [Policy]
    phase: phase_0

  - name: FUNDS
    zh_name: 资金支持
    description: "预算/资金支持某项目或任务"
    source_labels: [Budget]
    target_labels: [Project, Task]
    phase: phase_0

  - name: MANAGES
    zh_name: 管理数据
    description: "系统管理某数据资源"
    source_labels: [System]
    target_labels: [DataResource]
    phase: phase_0

  - name: EVALUATES
    zh_name: 考核评价
    description: "指标评价某任务或项目"
    source_labels: [Indicator]
    target_labels: [Task, Project]
    phase: phase_0

  # ── Phase 1: 事项图关系 ─────────────────────────────────────────────────────

  - name: GOVERNS
    zh_name: 规范事项
    description: "文件或条款规范某事项"
    source_labels: [Document, Article]
    target_labels: [Matter]
    phase: phase_1

  - name: HAS_CONDITION
    zh_name: 适用条件
    description: "事项具有适用条件"
    source_labels: [Matter]
    target_labels: [Condition]
    phase: phase_1

  - name: REQUIRES_MATERIAL
    zh_name: 所需材料
    description: "事项或条款要求材料"
    source_labels: [Matter, Article]
    target_labels: [Material]
    phase: phase_1

  - name: HAS_TIME_LIMIT
    zh_name: 时限要求
    description: "事项具有时限要求"
    source_labels: [Matter]
    target_labels: [TimeLimit]
    phase: phase_1

  - name: APPLIES_TO_TARGET
    zh_name: 适用对象
    description: "事项适用于某对象类型"
    source_labels: [Matter]
    target_labels: [TargetGroup]
    phase: phase_1

  - name: HANDLED_BY
    zh_name: 办理机构
    description: "事项由某机构办理"
    source_labels: [Matter]
    target_labels: [Organization]
    phase: phase_1

  - name: APPLIES_TO_REGION
    zh_name: 事项适用地域
    description: "事项适用于某地域（仅限事项有独立地域约束时）"
    source_labels: [Matter]
    target_labels: [Region]
    phase: phase_1

  # ── Phase 2A: 条款基础图关系 ─────────────────────────────────────────────────

  - name: HAS_ARTICLE
    zh_name: 包含条款
    description: "文件包含条款"
    source_labels: [Document]
    target_labels: [Article]
    phase: phase_2a

  # ── Phase 2B: 条款细粒度语义关系 ─────────────────────────────────────────────

  - name: SETS_CONDITION
    zh_name: 规定条件
    description: "条款规定条件"
    source_labels: [Article]
    target_labels: [Condition]
    phase: phase_2b

  - name: SETS_TIME_LIMIT
    zh_name: 规定时限
    description: "条款规定时限"
    source_labels: [Article]
    target_labels: [TimeLimit]
    phase: phase_2b

  - name: ASSIGNS_TO
    zh_name: 赋予职责
    description: "条款赋予机构职责"
    source_labels: [Article]
    target_labels: [Organization]
    phase: phase_2b

  # ── Phase 3: 办公扩展层关系 ─────────────────────────────────────────────────

  - name: SERVES_IN
    zh_name: 任职于
    description: "人物任职于某机构"
    source_labels: [Person]
    target_labels: [Organization]
    phase: phase_3

  - name: LEADS
    zh_name: 负责任务
    description: "人物负责/牵头某任务"
    source_labels: [Person]
    target_labels: [Task]
    phase: phase_3

  - name: INSTRUCTS
    zh_name: 批示文件
    description: "人物签发/批示某文件"
    source_labels: [Person]
    target_labels: [Document]
    phase: phase_3

  - name: CONTACTS_FOR
    zh_name: 对接项目
    description: "人物对接/负责某项目"
    source_labels: [Person]
    target_labels: [Project]
    phase: phase_3

  - name: HELD_BY
    zh_name: 主办单位
    description: "事件由某机构主办"
    source_labels: [Event]
    target_labels: [Organization]
    phase: phase_3

  - name: CHAIRED_BY
    zh_name: 主持人
    description: "事件由某人物主持"
    source_labels: [Event]
    target_labels: [Person]
    phase: phase_3

  - name: ATTENDED_BY
    zh_name: 参与方
    description: "事件由某人物或机构参加"
    source_labels: [Event]
    target_labels: [Person, Organization]
    phase: phase_3

  - name: PRODUCES
    zh_name: 产生文件
    description: "事件产生某文件"
    source_labels: [Event]
    target_labels: [Document]
    phase: phase_3

  - name: DECIDES
    zh_name: 决定任务
    description: "事件决定/部署某任务"
    source_labels: [Event]
    target_labels: [Task]
    phase: phase_3

  - name: HELD_IN
    zh_name: 举办地点
    description: "事件在某地域举办"
    source_labels: [Event]
    target_labels: [Region]
    phase: phase_3

  - name: ESTABLISHED_BY
    zh_name: 建立依据
    description: "机制由某文件建立"
    source_labels: [Mechanism]
    target_labels: [Document]
    phase: phase_3

  - name: MECHANISM_MANAGED_BY
    zh_name: 机制管理单位
    description: "机制由某机构管理"
    source_labels: [Mechanism]
    target_labels: [Organization]
    phase: phase_3

  - name: APPLIES_TO
    zh_name: 适用于
    description: "机制适用于某任务、项目或系统"
    source_labels: [Mechanism]
    target_labels: [Task, Project, System]
    phase: phase_3

  - name: STIPULATED_BY
    zh_name: 标准依据
    description: "标准由某文件规定"
    source_labels: [Standard]
    target_labels: [Document]
    phase: phase_3

  - name: CONFORMED_BY
    zh_name: 符合标准
    description: "系统或数据资源符合某标准"
    source_labels: [Standard]
    target_labels: [System, DataResource]
    phase: phase_3

  - name: INFRA_MANAGED_BY
    zh_name: 设施管理单位
    description: "基础设施由某机构管理"
    source_labels: [Infrastructure]
    target_labels: [Organization]
    phase: phase_3

  - name: HOSTS
    zh_name: 承载系统
    description: "基础设施承载某系统"
    source_labels: [Infrastructure]
    target_labels: [System]
    phase: phase_3

  - name: COVERS
    zh_name: 覆盖地域
    description: "基础设施覆盖某地域"
    source_labels: [Infrastructure]
    target_labels: [Region]
    phase: phase_3

  - name: USES_TECH
    zh_name: 使用技术
    description: "项目或系统使用某技术"
    source_labels: [Project, System]
    target_labels: [Technology]
    phase: phase_3

  - name: INDUSTRY_SUPPORTED_BY
    zh_name: 产业支撑政策
    description: "产业受某政策支撑"
    source_labels: [Industry]
    target_labels: [Policy]
    phase: phase_3

  - name: INDUSTRY_LOCATED_IN
    zh_name: 产业所在地域
    description: "产业分布于某地域"
    source_labels: [Industry]
    target_labels: [Region]
    phase: phase_3

  - name: INDUSTRY_MANAGED_BY
    zh_name: 产业主管单位
    description: "产业由某机构主管"
    source_labels: [Industry]
    target_labels: [Organization]
    phase: phase_3

# ── 归一化规则 ────────────────────────────────────────────────────────────────

normalization_rules:

  Organization:
    strip_punctuation: true
    trim_whitespace: true

  Region:
    strip_punctuation: true
    trim_whitespace: true

  PolicyTheme:
    strip_punctuation: true
    trim_whitespace: true
    max_length: 30

  Policy:
    strip_punctuation: true
    trim_whitespace: true
    max_length: 80

  Task:
    strip_punctuation: true
    trim_whitespace: true
    max_length: 80

  Project:
    strip_punctuation: true
    trim_whitespace: true
    max_length: 80

  System:
    strip_punctuation: true
    trim_whitespace: true
    max_length: 60

  DataResource:
    strip_punctuation: true
    trim_whitespace: true
    max_length: 80

  Indicator:
    strip_punctuation: true
    trim_whitespace: true
    max_length: 60

  Budget:
    strip_punctuation: true
    trim_whitespace: true
    max_length: 60

  Industry:
    strip_punctuation: true
    trim_whitespace: true
    max_length: 30

  Matter:
    strip_punctuation: true
    trim_whitespace: true
    max_length: 50

  Condition:
    trim_whitespace: true
    max_length: 200

  Material:
    strip_punctuation: true
    trim_whitespace: true
    max_length: 100

  TimeLimit:
    trim_whitespace: true
    max_length: 50

  TargetGroup:
    strip_punctuation: true
    trim_whitespace: true
    max_length: 30

  Article:
    trim_whitespace: true
    max_length: 500

  Person:
    strip_punctuation: true
    trim_whitespace: true
    max_length: 20

  Event:
    strip_punctuation: true
    trim_whitespace: true
    max_length: 80

  Mechanism:
    strip_punctuation: true
    trim_whitespace: true
    max_length: 60

  Standard:
    strip_punctuation: true
    trim_whitespace: true
    max_length: 80

  Infrastructure:
    strip_punctuation: true
    trim_whitespace: true
    max_length: 60

  Technology:
    strip_punctuation: true
    trim_whitespace: true
    max_length: 30

# ── Document 属性扩展定义 ─────────────────────────────────────────────────────
# Document 节点由元数据驱动, 不经 LLM 抽取. 此处仅作为文档说明.

document_properties:
  - doc_id                    # 唯一ID
  - title                    # 标题
  - normalized_title          # 归一化标题
  - doc_code                  # 发文字号
  - doc_type                  # 文种 (通知/决定/批复/函/纪要等)
  - status                   # 有效/部分失效/已废止/失效/待确认
  - publish_date              # 发布日期
  - effective_date            # 生效日期
  - expiry_date               # 失效日期
  - admin_level               # 行政层级 (国家级/省级/市级/区县级/乡镇街道级/其他/未知)
  - subject_summary           # 文件主旨摘要
  - keywords                  # 主题词数组
  - knowledge_category        # 文档管理分类 (中文名)
  - knowledge_category_code   # 分类编码
  - source                   # 来源
  - full_text_url             # 原文地址
  - is_current                # 是否当前有效版本
  - is_placeholder            # 是否为引用占位节点
  - created_at
  - updated_at

# ── knowledge_category 编码映射 ───────────────────────────────────────────────

knowledge_category_mapping:
  办事指南: service_guide
  政务服务事项: service_guide
  国家/省领导讲话: leader_speech_national_provincial
  市领导讲话稿: leader_speech_city
  政策与法规: policy_regulation
  报道材料: news_report
  全会报告与规划: plenary_report_planning
  政府工作报告: government_work_report
  各单位公文: official_document
  信息采集: information_collection
  清远本地知识: local_knowledge_qingyuan
  经济数据: economic_data
  档案资料: archive_material

# ── 公文文种列表 ──────────────────────────────────────────────────────────────
# 用于前端筛选下拉。增删后重启后端即可生效，前端自动同步。

doc_types:
  - 办事指南
  - 决定
  - 通知
  - 通报
  - 报告
  - 请示
  - 批复
  - 函
  - 纪要
  - 意见
  - 公告
  - 命令

# ── 场景化抽取配置 ────────────────────────────────────────────────────────────
# 每个场景可声明额外启用的 phase（叠加在 active_phases 之上），
# 以及偏好的实体类型（本期仅作策略记录，不实现权重逻辑）。
# scene_type 判定优先级：document_scene_type > knowledge_category_code > ""

extraction_scenes:
  service_guide:
    extra_phases: []
    entity_bias: [Matter, Condition, Material, TimeLimit, TargetGroup]
  leader_speech_national_provincial:
    extra_phases: [phase_3]
    entity_bias: [Person, Event]
  leader_speech_city:
    extra_phases: [phase_3]
    entity_bias: [Person, Event]
  plenary_report_planning:
    extra_phases: []
    entity_bias: [Task, Indicator, Industry]
  digital_gov_project:
    extra_phases: [phase_3]
    entity_bias: [Project, System, Technology, Budget, Infrastructure]
  policy_regulation:
    extra_phases: []
    entity_bias: [Policy, Task]
  government_work_report:
    extra_phases: []
    entity_bias: [Task, Indicator, Industry]
  official_document:
    extra_phases: []
    # entity_bias 本期仅作策略口径记录，不实现权重逻辑
    # 后续迭代可据此优化 prompt 或后处理

# ── 活跃 Phase 控制 ───────────────────────────────────────────────────────────
# 只有 active_phases 中列出的 phase 才会被加载到默认抽取类型系统.
# 场景化抽取可通过 extraction_scenes.extra_phases 额外启用其他 phase.
# 运行时支持集合（约束创建、写图校验、查询白名单）始终包含全量类型.
# 调整此项并重启即可按阶段启用新类型, 无需改代码.

active_phases:
  - phase_0
  - phase_1
  # - phase_2a   # 启用条款基础图时取消注释
  # - phase_2b   # 启用条款细粒度语义时取消注释 (依赖 phase_2a)
  # - phase_3   # 办公扩展层，通过 extraction_scenes 按需启用
