BOT050 Policy Graph

A policy knowledge-graph editor for qualitative policy research — a React Flow canvas backed by a FastAPI + DuckDB service with LLM-driven entity extraction.

BOT050 — Policy Graph is a policy knowledge-graph editor for qualitative policy research. It pairs a React Flow canvas (frontend package @bot050/ui) with a FastAPI service backed by DuckDB persistence and LLM-driven entity extraction.

What it does

  • Manual graph editing — add entities and relationships on a canvas and edit their labels/properties in a side panel.
  • LLM scene initialization — describe a policy scene in natural language (e.g. “商业保险支付链路中的主体和资金流”) and generate a starting graph.
  • Single-document extraction — upload a policy document, run a Map-Reduce LLM extraction pass over its chunks, preview the result, and merge it into the scene.
  • DuckDB-backed persistence behind a FastAPI + Swagger API, with a pluggable LLM provider (glm / claude / openai).

Part of my pharma-policy research toolkit at PKU’s Dept. of Pharmacy Administration. Status: MVP implemented in standalone mode (manual editing, scene init, single-document extraction, preview, and merge); embedding into the Global Pharma Atlas dashboard (bot003) is post-MVP.

Stack: Python · FastAPI · DuckDB · React · React Flow · TypeScript

Repository: wcboy/BOT050