loader

Load RCA artifact bundles from a full-result JSON file or a fixtures directory.

Run the Streamlit app from this directory so import loader resolves:

cd DACKAR/src/dackar/RCA/viz && streamlit run app.py

Attributes

JsonDict

_FIXTURE_FILE_MAP

Functions

_allowed_path(path)

_read_json(path)

detect_input_mode(path)

Classify a path as a full-result JSON file or a fixtures/run directory.

load_from_full_result(path)

Load a single JSON object (e.g. v32_full_result.json). Keys pass through unchanged.

load_from_fixtures_dir(directory)

Merge every *.json in a directory into one bundle, keyed by filename.

merge_bundles(primary, supplemental)

Return primary with any keys it lacks filled in from supplemental.

load_artifacts(path)

Auto-detect file vs directory and load.

load_pre_refine_causality(path)

Load optional pre-refine causality artifact.

list_bundle_keys(bundle)

Return the bundle's artifact keys, sorted, excluding load-error markers.

Module Contents

loader.JsonDict[source]
loader._FIXTURE_FILE_MAP: Dict[str, str][source]
loader._allowed_path(path)[source]
Parameters:

path (pathlib.Path)

Return type:

bool

loader._read_json(path)[source]
Parameters:

path (pathlib.Path)

Return type:

JsonDict

loader.detect_input_mode(path)[source]

Classify a path as a full-result JSON file or a fixtures/run directory.

@ In, path, str, filesystem path to a .json file or a directory @ Out, mode, str, "fixtures_dir" for a directory, "full_result" for

a .json file

Parameters:

path (str)

Return type:

Literal[‘full_result’, ‘fixtures_dir’]

loader.load_from_full_result(path)[source]

Load a single JSON object (e.g. v32_full_result.json). Keys pass through unchanged.

Parameters:

path (str)

Return type:

JsonDict

loader.load_from_fixtures_dir(directory)[source]

Merge every *.json in a directory into one bundle, keyed by filename.

The directory may be a hand-built fixtures folder or a real orchestrator run folder (ArtifactStore writes one <artifact_name>.json per artifact), so scanning the directory surfaces whatever artifacts are actually present rather than a fixed allow-list. _FIXTURE_FILE_MAP is consulted as an alias layer: a basename it names maps to that key, otherwise the filename stem is the key. Missing files are simply absent; never raises for them.

Parameters:

directory (str)

Return type:

JsonDict

loader.merge_bundles(primary, supplemental)[source]

Return primary with any keys it lacks filled in from supplemental.

Primary wins on every shared key, so a complete run bundle is never overwritten; the supplement only contributes artifacts the primary is missing (e.g. the raw event / telemetry_summary inputs that a v32_full_result.json does not carry, or the generated artifacts a hand-built fixtures folder lacks). This lets one view combine the data provided as input with the data produced by every pipeline stage.

Parameters:
Return type:

JsonDict

loader.load_artifacts(path)[source]

Auto-detect file vs directory and load.

Parameters:

path (str)

Return type:

JsonDict

loader.load_pre_refine_causality(path)[source]

Load optional pre-refine causality artifact.

Accepts either a bare causality_candidates object (has candidates) or a full bundle (uses causality_candidates key if present).

Parameters:

path (str)

Return type:

Optional[JsonDict]

loader.list_bundle_keys(bundle)[source]

Return the bundle’s artifact keys, sorted, excluding load-error markers.

@ In, bundle, dict, a loaded bundle (may contain <key>__load_error markers) @ Out, keys, list, sorted artifact keys with the error markers removed

Parameters:

bundle (JsonDict)

Return type:

List[str]