Python port of nodeq-mindmap: MindMapNode data model and ETL pipeline engine
Project description
nodeq-mindmap
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:
- Go —
packages/go/—MindMapNode,PipelineEngine,JsonSchemaAdapteras a Go module - Python —
packages/python/—MindMapNode,PipelineEngine,JsonSchemaAdapteras Python dataclasses
These ports implement the same data structures and pipeline logic without the D3 visualization layer.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nodeqmindmap-2.2.0.tar.gz.
File metadata
- Download URL: nodeqmindmap-2.2.0.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cce966b734153c3b77fd15b1b1530071c693fba608627f049f99d59e1c591d0
|
|
| MD5 |
107dc2b177a3022fc04736923d5a62fe
|
|
| BLAKE2b-256 |
da8ff1d95030e58f0ca4c85159bee2caa41cc593c11becb7e7a280e526bf86d6
|
File details
Details for the file nodeqmindmap-2.2.0-py3-none-any.whl.
File metadata
- Download URL: nodeqmindmap-2.2.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45532fa670e1af93cf2dc5f770ccfb7c371c66be2ef3d9e06db4242bdf570987
|
|
| MD5 |
72b96e73211a94e096fc74b824ecdf4b
|
|
| BLAKE2b-256 |
10a8f5e4d47ff33fba62819c8fcc7bc9126944f72d6d69c18fc6217235e05be5
|