Skip to main content

Python port of nodeq-mindmap: MindMapNode data model and ETL pipeline engine

Project description

nodeq-mindmap

npm version License: MIT

Interactive D3.js mind map visualization library with a built-in ETL pipeline engine. Render career maps, org charts, or any hierarchical JSON data in the browser, and define data transformation pipelines in code.

Features

  • Universal JSON rendering — any JSON object is automatically converted to a mind map
  • Interactive — click to expand/collapse nodes, zoom, pan
  • Themeable — control colors, font, node size
  • Framework agnostic — works with React, Vue, Angular, or vanilla JS
  • ETL pipeline engine — define input/output schemas, track transformation rules, and execute pipelines in memory
  • Pipeline visualization — render an active pipeline as a mind map to explore its structure
  • CLI — generate SVG files from JSON on the command line (headless via jsdom)

Installation

npm install nodeq-mindmap

D3 v7 is a peer dependency:

npm install d3

Quick Start

Browser / bundler

import { NodeQMindMap } from 'nodeq-mindmap';

const map = new NodeQMindMap({
  container: '#my-container',   // CSS selector or HTMLElement
  data: {
    topic: 'Software Engineer',
    children: [
      { topic: 'Frontend', skills: ['React', 'TypeScript'] },
      { topic: 'Backend',  skills: ['Node.js', 'PostgreSQL'] },
    ]
  },
  width: 900,
  height: 600,
  onNodeClick: (node) => console.log(node.topic),
});

map.render();

Any JSON shape

JsonSchemaAdapter.convertToStandard() converts arbitrary JSON into the MindMapNode tree format before rendering:

import { NodeQMindMap, JsonSchemaAdapter } from 'nodeq-mindmap';

const raw = { name: 'My API', version: '2.0', routes: ['/users', '/posts'] };
const data = JsonSchemaAdapter.convertToStandard(raw);

new NodeQMindMap({ container: '#root', data }).render();

API

new NodeQMindMap(config)

Option Type Default Description
container string | HTMLElement required CSS selector or DOM element
data any required Hierarchical data (see MindMapNode)
width number 800 SVG width in px
height number 600 SVG height in px
theme Partial<Theme> Colors, font, fontSize
interactive boolean true Enable click/hover
zoomable boolean true Enable pan/zoom
collapsible boolean true Click nodes to collapse
onNodeClick (node) => void Click callback
onNodeHover (node) => void Hover callback

Instance methods

map.render()                    // Draw the mind map
map.updateData(data)            // Replace data and re-render
map.updateTheme(theme)          // Merge theme and re-render
map.exportSVG()                 // Return SVG markup string
map.destroy()                   // Remove SVG from DOM

// Pipeline helpers
await map.createDataPipeline(name, inputSample, outputSample, options?)
map.executePipeline(inputData)
map.getAllPipelines()
map.switchToPipeline(pipelineId)

MindMapNode shape

interface MindMapNode {
  topic: string;          // Node label (required)
  summary?: string;       // Subtitle shown in detail panels
  skills?: string[];      // Tag list
  children?: MindMapNode[];
}

Theme options

{
  nodeColor: string;       // default '#4299e1'
  textColor: string;       // default '#2d3748'
  linkColor: string;       // default '#a0aec0'
  backgroundColor: string; // default '#ffffff'
  fontSize: number;        // default 14
  fontFamily: string;      // default 'Arial, sans-serif'
}

Pipeline Engine

PipelineEngine is a standalone class for defining and running in-memory ETL pipelines. It does not require a browser.

import { PipelineEngine } from 'nodeq-mindmap';

const engine = new PipelineEngine();

const pipeline = await engine.createPipeline(
  'User ETL',
  { format: 'json', schema: { id: 'number', name: 'string' }, data: { id: 1, name: 'Alice' } },
  { format: 'json', schema: { userId: 'number', displayName: 'string' }, data: { userId: 1, displayName: 'Alice' } }
);

const result = engine.executePipeline(pipeline.id, { id: 2, name: 'Bob' });
// { processed: true, data: { id: 2, name: 'Bob' }, timestamp, pipelineId }

console.log(engine.generatePipelineCode(pipeline.id));
// Outputs a TypeScript function stub for the pipeline

PipelineEngine methods

createPipeline(name, inputSample, outputSample, options?)  // async, returns PipelineConfig
updatePipeline(id, inputSample?, outputSample?)            // async
executePipeline(id, inputData)                             // sync, returns result object
getPipeline(id)                                            // returns PipelineConfig | undefined
getAllPipelines()                                           // returns PipelineConfig[]
getPipelineStats(id)                                       // returns perf stats
generatePipelineCode(id)                                   // returns TS function stub

CLI

# Generate an SVG mind map from a JSON file
npx nodeq-mindmap generate -i data.json -o output.svg

# Create a pipeline definition from input/output samples
npx nodeq-mindmap create-pipeline -n "My ETL" -i input.json -o output.json

The generate command uses jsdom to run D3 headlessly — no browser required.

Ports

Server-side / language-specific ports of the data model and pipeline engine are available:

  • Gopackages/go/MindMapNode, PipelineEngine, JsonSchemaAdapter as a Go module
  • Pythonpackages/python/MindMapNode, PipelineEngine, JsonSchemaAdapter as Python dataclasses

These ports implement the same data structures and pipeline logic without the D3 visualization layer.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nodeqmindmap-2.3.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nodeqmindmap-2.3.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file nodeqmindmap-2.3.0.tar.gz.

File metadata

  • Download URL: nodeqmindmap-2.3.0.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nodeqmindmap-2.3.0.tar.gz
Algorithm Hash digest
SHA256 30d00b1d416f6b97c20370ed0d04c766821de157d56d903a5758268a9a3ca49f
MD5 75bf0c54caecca44e30fa5c781d0f481
BLAKE2b-256 27650ea9bdab9d73cc5f58902d44bf2a9356ed44d851638f18ebab69426c9f64

See more details on using hashes here.

File details

Details for the file nodeqmindmap-2.3.0-py3-none-any.whl.

File metadata

  • Download URL: nodeqmindmap-2.3.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nodeqmindmap-2.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 55e7da192b7fe4ddc9875f77994bcc2b0b818365c741fc8504c6ccaab7c2f9fe
MD5 6e19747efc245ddc79aef22d8a270875
BLAKE2b-256 cdc27e221b0f8fba6bbdc57a9649262c345d428dceca947580163c0f8d25ac7f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page