CinvanaAI
← All projects

Tool · Data & provenance / Games & interaction

D&D 5e Graph ETL

Turn versioned rules JSON into graph records, source references and linked relationships.

Repository: CinvanaAI/dnd5e-graph-etl

Recorded synthetic example. Source with a complete offline example.

See the idea in action.

Two graph-scoped records, one resolved reference edge, and selected monster properties including armor 13 and hit dice 2d4+2.

Example input
Two invented records: Clockwork damage and a Clockwork Mote that references it.
Captured result
{
  "schema_version": "dnd5e-graph-etl.plan.v1",
  "source_name": "Synthetic Rules",
  "files": [
    "2014/en/5e-SRD-Damage-Types.json",
    "2014/en/5e-SRD-Monsters.json"
  ],
  "records": [
    {
      "record_id": "rules_2014_en:damage_types:clockwork",
      "graph_id": "rules_2014_en",
      "source": "Synthetic Rules",
      "ruleset_year": 2014,
      "language": "en",
      "category": "damage_types",
      "index": "clockwork",
      "name": "Clockwork",
      "full_name": null,
      "source_file": "2014/en/5e-SRD-Damage-Types.json",
      "raw_json": "{\"index\":\"clockwork\",\"name\":\"Clockwork\",\"url\":\"/api/2014/damage-types/clockwork\"}",
      "raw_sha256": "da2e6490c6b29aee61fbd403221eca6befa6ff6a91c009cd8e026008e4d80997"
    },
    {
      "record_id": "rules_2014_en:monsters:clockwork-mote",
      "graph_id": "rules_2014_en",
      "source": "Synthetic Rules",
      "ruleset_year": 2014,
      "language": "en",
      "category": "monsters",
      "index": "clockwork-mote",
      "name": "Clockwork Mote",
      "full_name": null,
      "source_file": "2014/en/5e-SRD-Monsters.json",
      "raw_json": "{\"alignment\":\"unaligned\",\"armor_class\":[{\"value\":13}],\"challenge_rating\":0.25,\"damage_type\":{\"index\":\"clockwork\",\"name\":\"Clockwork\",\"url\":\"/api/2014/damage-types/clockwork\"},\"hit_dice\":\"2d4+2\",\"hit_points\":7,\"index\":\"clockwork-mote\",\"name\":\"Clockwork Mote\",\"size\":\"Tiny\",\"type\":\"construct\",\"xp\":50}",
      "raw_sha256": "aa916bb95f2e21d323d8869c483c0d717cf1ebb748caef32874de24af4b74516",
      "properties": {
        "monster_size": "Tiny",
        "monster_type": "construct",
        "monster_alignment": "unaligned",
        "armor_class": 13,
        "hit_points": 7,
        "hit_dice": "2d4+2",
        "challenge_rating": 0.25,
        "challenge_rating_text": "0.25",
        "xp": 50
      }
    }
  ],
  "edges": [
    {
      "from": "rules_2014_en:monsters:clockwork-mote",
      "type": "REFERENCES",
      "to": "rules_2014_en:damage_types:clockwork",
      "field_path": "$.damage_type",
      "target_url": "/api/2014/damage-types/clockwork",
      "target_year": "2014",
      "target_category": "damage_types",
      "target_index": "clockwork",
      "target_name": "Clockwork",
      "target_present": true
    }
  ]
}

Try the example.

From the repository root, follow the dependency requirements in the README. This example uses supplied synthetic material.

python -m pip install -e .
python -m examples.walkthrough

Two graph-scoped records, one resolved reference edge, and selected monster properties including armor 13 and hit dice 2d4+2.

Complete setup and instructions ↗

The interesting part.

Graph-scoped IDs preserve ruleset year/language, canonical raw JSON, and source hashes instead of flattening editions together.

Public continuation

Where it came from.

Four authored DnDGraph scripts covering import, reference linking, monster properties and dice.

Rebuilds the ETL boundary without downloaded rules repositories or Neo4j runtime data.

The Dice Expression Extractor is a focused sibling from the same experiment, not evidence of an installed dependency.

Source ↗

Follow the family: DnDGraph import and dice extraction