nirspipe.qc.common.provenance#
Rebuild the file-level provenance graph from the JSON sidecars on disk.
The sidecars are the manifest: each one names the step that produced its file and the files it came from, so the graph is recovered from the run’s own output rather than from anything held in memory. Any past run can be re-read.
Module Contents#
Classes#
Functions#
Read the sidecars under nirs_dir and return the graph keyed by filename stem. |
|
The graph as it is drawn: repeats collapsed, ambiguous roots named. |
|
Render the graph as a mermaid flowchart, for docs and markdown viewers. |
API#
- class nirspipe.qc.common.provenance.Node#
- nirspipe.qc.common.provenance.scan(nirs_dir: pathlib.Path, label: str | None = None) dict[str, nirspipe.qc.common.provenance.Node]#
Read the sidecars under nirs_dir and return the graph keyed by filename stem.
labelis a BIDS run stem (sub-01_task-rest). Without it every run of the subject lands in one graph, which for a five-task subject is five disjoint chains of identically named nodes drawn on top of each other. With it the graph is that run alone.
- nirspipe.qc.common.provenance.simplify(nodes: dict[str, nirspipe.qc.common.provenance.Node]) dict[str, nirspipe.qc.common.provenance.Node]#
The graph as it is drawn: repeats collapsed, ambiguous roots named.
2 inputs + 12 relmat isc + 4 relmat wtc -> 2 inputs + 1 relmat isc box + 4
Siblings are collapsed when they share a step and a source set, which is what makes the merged box’s arrows the members’ own arrows rather than an approximation of them. Anything downstream of a member is repointed at the box, so no edge is left dangling.
A drawing step, not a reading one:
scan()still returns every node, which is what the interface DAG and the methods text are built on.
- nirspipe.qc.common.provenance.to_mermaid(nodes: dict[str, nirspipe.qc.common.provenance.Node]) str#
Render the graph as a mermaid flowchart, for docs and markdown viewers.