# How the Patent Disclosure Skill Builds Obsidian Canvas Story Maps

> Learn how the Patent Disclosure Skill builds interactive Obsidian Canvas story maps by parsing patent notes and assembling structured data into a narrative flow with interconnected nodes.

- Repository: [handsomestWei/patent-disclosure-skill](https://github.com/handsomestWei/patent-disclosure-skill)
- Tags: how-to-guide
- Published: 2026-09-08

---

**The Patent Disclosure Skill creates interactive Obsidian Canvas files by parsing patent notes, harvesting structured data such as claims and glossaries, and assembling them into a JSON Canvas object with interconnected nodes for narrative flow, bibliographic hubs, and technical terminology.**

The `handsomestWei/patent-disclosure-skill` repository provides an automated pipeline that transforms static patent documentation into dynamic visual story-maps. This Obsidian integration extracts bibliographic metadata, claim hierarchies, and narrative elements directly from your vault, then constructs a `.canvas` file that renders as an interactive diagram. By leveraging specific generator functions and vault scanning utilities, the tool creates a spatial representation of patent knowledge that links the core document to its contextual research materials.

## Architecture Overview: Three Layers of Canvas Generation

The Obsidian Canvas story-map creation follows a three-tier architecture that separates data ingestion from visual layout.

### CLI Entry Point

The [`build_patent_canvas.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/build_patent_canvas.py) script serves as the orchestration layer. Its `main()` function parses command-line arguments including `--vault`, `--note-rel`, `--manifest`, and optional flags like `--bundle` or `--claim-tree`. It resolves the Obsidian vault path via `runtime_config()` from [`shared/common.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/shared/common.py) and coordinates the data collection phase before invoking the canvas generator.

### Data Harvesting Helpers

Specialized functions extract structured content from patent notes:

- **`harvest_claim_summaries_from_note`** (in [`obsidian.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/obsidian.py)): Extracts claim-summary cards from the note body.
- **`harvest_glossary_from_note`** (in [`write_patent_obsidian_note.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/write_patent_obsidian_note.py)): Identifies and pulls glossary candidates for terminology mapping.
- **`scan_vault_related`** (in [`obsidian.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/obsidian.py)): Discovers related notes, paper indexes, and domain-specific indexes within the vault to establish contextual links.

### Canvas Generator

The `build_canvas()` function in [`obsidian.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/obsidian.py) (starting at line 1168) constructs the final JSON Canvas object containing `nodes` and `edges`. It positions bibliographic data, narrative snippets, and technical references into a spatial layout that Obsidian renders as a visual graph.

## Data Extraction Workflow

Before canvas construction begins, the system performs a multi-stage data harvesting process to populate the story-map components.

### Patent Note Parsing

The tool reads the target note file specified by `--note-rel` and extracts the first-level heading (`# Title`) to use as the canvas title if none is provided via CLI. Domain classification is inferred from a `domain:` front-matter line or by calling `resolve_domain()`, falling back to IPC codes when necessary.

### Supplementary Data Collection

The pipeline gathers four categories of information to enrich the canvas:

- **Narrative Elements**: `harvest_narrative_from_note` extracts one-liner summaries describing the Problem, Approach, and Effect, which become narrative cards positioned above the center node.
- **Claim Summaries**: The system collects structured claim data to populate the claim-tree table view.
- **Glossary Terms**: Merges user-supplied bundles (`--bundle`) with terms harvested directly from the note content.
- **Related Resources**: `scan_vault_related` traverses the vault directory structure to locate associated research papers, domain indexes, and the global glossary for edge connections.

## Canvas Construction and Node Types

The `build_canvas()` function assembles a JSON object containing specifically typed nodes that create the patent story-map visualization.

### Center Node

The `center_id = "center"` node anchors the visualization. It displays the patent publication number, title, a concise one-liner summary, and a direct link back to the original note file. All other nodes connect to this central reference point.

### Narrative Cards

Narrative cards (`_narrative_cards`) are laid out horizontally above the center node. Each card represents a component of the patent narrative—typically **Problem**, **Approach**, and **Effect**—with edges labeled according to the card type creating a visual flow from context to solution.

### Bibliographic Hub Node

The **hub** node aggregates critical metadata including the publication number, technical domain, IPC codes, assignee information, and evidence scope. It includes links to the global patent index and domain-specific indexes, serving as a jumping-off point for research navigation.

### Claim-Tree Visualization

When claim data is available, the system generates a **claims** node containing a compact markdown table (constructed via `_claim_tree_card_text`). This table maps claim numbers to their summaries, sized dynamically to fit the content while maintaining readability within the canvas layout.

### Glossary and Figure Integration

Optional nodes enhance the technical depth of the map:

- **Glossary Stubs**: When `create_glossary_stubs=True`, the system generates nodes pointing to term pages under `glossary_dir`, creating these stub files automatically if they do not exist.
- **Figure Cards**: Up to four thumbnail images are added as separate nodes with relative links, providing quick visual reference to patent diagrams or illustration images stored in the vault.

## Running the Canvas Builder

Execute the following command from the repository root to generate a canvas file:

```bash
python -m skills.patent-reader.tools.vault.build_patent_canvas \
    --vault ~/Obsidian/MyVault \
    --note-rel Research/Patents/AI/CN1234567/CN1234567_解读.md \
    --manifest ./manifest.json \
    -o Research/Patents/AI/CN1234567/CN1234567_图谱.canvas

```

This command performs the complete pipeline:
1. Loads [`manifest.json`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/manifest.json) containing publication numbers, assignees, and IPC codes.
2. Parses the patent note at the specified relative path.
3. Harvests glossary candidates, claim-tree JSON (if present), and figure thumbnails.
4. Invokes `build_canvas()` to generate the JSON Canvas structure.
5. Writes the output to `CN1234567_图谱.canvas`.

Opening the resulting `.canvas` file in Obsidian renders an interactive diagram featuring a central patent identifier node, narrative flow cards, bibliographic metadata hubs, claim tables, and linked terminology stubs.

## Summary

- The **CLI entry point** in [`build_patent_canvas.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/build_patent_canvas.py) orchestrates the entire workflow, parsing arguments and resolving vault paths via `runtime_config()`.
- **Data harvesting functions** in [`obsidian.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/obsidian.py) and [`write_patent_obsidian_note.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/write_patent_obsidian_note.py) extract claims, glossaries, and narrative elements from patent notes.
- The **`build_canvas()` function** constructs a JSON Canvas object with specialized nodes: center anchor, narrative cards, bibliographic hub, claim-tree tables, and optional glossary stubs.
- **Vault scanning** via `scan_vault_related` discovers contextual research materials to enrich the story-map with relevant connections.
- The output is a `.canvas` file that Obsidian renders as a fully interactive patent story-map ready for manual refinement.

## Frequently Asked Questions

### What file contains the main canvas generation logic?

The core canvas construction logic resides in [`skills/patent-reader/tools/vault/obsidian.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/skills/patent-reader/tools/vault/obsidian.py), specifically within the `build_canvas()` function starting at line 1168. This function assembles the JSON structure containing all nodes and edges that define the visual layout.

### How does the tool extract narrative elements from patent notes?

The system uses `harvest_narrative_from_note` to parse the note content and identify sections describing the Problem, Approach, and Effect. These extracted snippets are converted into narrative cards positioned horizontally above the center node in the final canvas, connected by labeled edges that indicate their narrative role.

### Can I control whether glossary stub nodes are created?

Yes. Glossary stub generation is controlled by the `create_glossary_stubs` parameter. When set to `True`, the canvas builder creates nodes pointing to term pages under the specified `glossary_dir` and auto-generates stub markdown files for any terms that do not already exist in your vault.

### How does the integration discover related research materials?

The `scan_vault_related` function in [`obsidian.py`](https://github.com/handsomestWei/patent-disclosure-skill/blob/main/obsidian.py) (around line 1400) traverses the Obsidian vault directory structure to locate associated paper notes, domain-specific indexes, and the global glossary. These discovered resources are then linked within the bibliographic hub node, creating contextual connections between the patent and your broader research database.