src.dackar.RCA.adapters.similar_event_adapter

similar_event_adapter.py — Protocol definition for Step 2d similar-event adapters.

The orchestrator accepts any object satisfying SimilarEventAdapter to query fleet and industry OE databases. The concrete production implementation is LLMOEAdapter (llm_oe_adapter.py). Tests may supply any mock that satisfies the protocol.

Attributes

JsonDict

TIER_CONFIDENCE_MULTIPLIERS

Classes

SimilarEventAdapter

Pluggable interface for fleet and industry OE similar-event queries.

Module Contents

src.dackar.RCA.adapters.similar_event_adapter.JsonDict[source]
src.dackar.RCA.adapters.similar_event_adapter.TIER_CONFIDENCE_MULTIPLIERS: Dict[str, float][source]
class src.dackar.RCA.adapters.similar_event_adapter.SimilarEventAdapter[source]

Bases: Protocol

Pluggable interface for fleet and industry OE similar-event queries.

The orchestrator calls query() once for fleet and once for industry when an adapter is injected. Each call must return a list of dicts compatible with the similar_event_list.json event item schema.

Contract: - Never raise on network/timeout/parse errors; return [] instead. - Set degraded to True on the adapter instance when a call fails

so the orchestrator can record the degraded tier.

  • confidence_weight on returned records should be the raw match score (0–1) before tier discount; the orchestrator applies the multiplier defined in TIER_CONFIDENCE_MULTIPLIERS.

degraded: bool[source]
query(*, level, asset_id, component_ids, failure_mode_ids, event_type=None, actuation_type=None, max_results=5, timeout_seconds=10.0)[source]

Return a list of similar-event dicts for the given tier.

Parameters:
  • level (Literal['fleet', 'industry'])

  • asset_id (Optional[str])

  • component_ids (List[str])

  • failure_mode_ids (List[str])

  • event_type (Optional[str])

  • actuation_type (Optional[str])

  • max_results (int)

  • timeout_seconds (float)

Return type:

List[JsonDict]