nirs4all.pipeline.storage.io_resolver module

Prediction target resolver - resolves prediction targets for predict mode.

Note: This is the legacy target resolver for finding predictions by ID. For the comprehensive Phase 3 prediction source resolver that normalizes sources to all components needed for replay, see:

nirs4all.pipeline.resolver.PredictionResolver

nirs4all.pipeline.storage.io_resolver.PredictionResolver

alias of TargetResolver

class nirs4all.pipeline.storage.io_resolver.TargetResolver(workspace_path: Path)[source]

Bases: object

Resolves prediction targets for predict mode.

Focused responsibility: Finding and resolving prediction targets by ID.

Note: For the comprehensive Phase 3 resolver that handles multiple source types (prediction dict, folder, Run, artifact_id, bundle), see nirs4all.pipeline.resolver.PredictionResolver.

find_best_for_config(config_path: str) Dict[str, Any] | None[source]

Find the best prediction for a given config path.

Parameters:

config_path – Path to pipeline configuration

Returns:

Best prediction metadata, or None if not found

find_prediction_by_id(prediction_id: str) Dict[str, Any] | None[source]

Search for a prediction by ID in global predictions databases.

Uses direct ID filtering for O(1) lookup per file instead of O(N) iteration.

Parameters:

prediction_id – Unique prediction identifier

Returns:

Prediction metadata dict, or None if not found

resolve_target(prediction_obj: Dict[str, Any] | str) tuple[str, Dict[str, Any] | None][source]

Resolve prediction object to config path and model metadata.

Parameters:

prediction_obj – Either: - Dict with ‘config_path’ and optional model metadata - String: config path or prediction ID

Returns:

Tuple of (config_path, target_model_metadata)

Raises:

ValueError – If prediction ID not found or invalid input