src.dackar.RCA.synthesis.analyst_override_processor

analyst_override_processor — AnalystOverrideProcessor.

Accepts a completed RCA card + analyst override input, validates the override, mutates the card to reflect the analyst decision, and returns a structured AnalystOverride artifact for persistence and audit-history mining.

Override record schema: schemas/analyst_override.json

Attributes

JsonDict

_VALID_OVERRIDE_TYPES

_VALID_WRITEBACK_DECISIONS

_VALID_SUPPORT_ROLES

_VALID_RESOLUTION_TYPES

Classes

AnalystOverrideProcessor

Applies a structured analyst override to an RCA card.

Functions

_utcnow_iso()

Module Contents

src.dackar.RCA.synthesis.analyst_override_processor.JsonDict[source]
src.dackar.RCA.synthesis.analyst_override_processor._VALID_OVERRIDE_TYPES[source]
src.dackar.RCA.synthesis.analyst_override_processor._VALID_WRITEBACK_DECISIONS[source]
src.dackar.RCA.synthesis.analyst_override_processor._VALID_SUPPORT_ROLES[source]
src.dackar.RCA.synthesis.analyst_override_processor._VALID_RESOLUTION_TYPES[source]
src.dackar.RCA.synthesis.analyst_override_processor._utcnow_iso()[source]
Return type:

str

class src.dackar.RCA.synthesis.analyst_override_processor.AnalystOverrideProcessor[source]

Applies a structured analyst override to an RCA card.

Usage:

processor = AnalystOverrideProcessor()
modified_card, override_record = processor.apply(
    rca_card=card,
    override_input={
        "override_type": "primary_candidate_change",
        "rationale": "DO elevation unambiguously supports air in-leakage",
        "override_primary_candidate_id": "CAND-AIR-INLEAK",
        "writeback_decision": "accept",
    },
    run_context={"run_id": "run-001"},
)

The returned modified_card is a copy of the original card with the override applied in-place. The override_record conforms to schemas/analyst_override.json and should be persisted by the caller.

apply(rca_card, override_input, run_context)[source]

Apply an analyst override and return (modified_card, override_record).

Parameters:
  • rca_card (JsonDict) – The RCA card produced by the synthesis step.

  • override_input (JsonDict) –

    Dict with the following keys:

    Required:
    • override_type (str) — one of the _VALID_OVERRIDE_TYPES

    • rationale (str, non-empty) — analyst rationale

    • writeback_decision (str) — “accept” | “reject” | “defer”

    Optional:
    • analyst_id (str)

    • override_primary_candidate_id (str) — required when override_type == “primary_candidate_change”

    • questions_resolved (list of {question, answer, resolution_type})

    • evidence_additions (list of {evidence_ref, support_role, added_by_analyst, notes?})

    • caveats (list of str)

  • run_context (JsonDict) – Orchestrator run context (must contain run_id).

Returns:

(modified_rca_card, override_record)

Return type:

tuple[JsonDict, JsonDict]

Raises:

ValueError – On invalid override_input.

_validate_input(override_input, rca_card)[source]
Parameters:
Return type:

None

_all_candidate_ids(rca_card)[source]
Parameters:

rca_card (JsonDict)

Return type:

set

_snapshot_primary(rca_card)[source]
Parameters:

rca_card (JsonDict)

Return type:

JsonDict

_compute_primary_diff(original, new_primary, override_type)[source]

Return a structured before/after delta for primary_candidate_change overrides.

Fields compared: candidate_id, cause_label, composite_score, confidence_label. Returns None for override types that don’t change the primary candidate.

Parameters:
Return type:

Optional[JsonDict]

_swap_primary(card, target_id, rationale)[source]

Promotes the alternative with candidate_id == target_id to primary. Demotes the current primary to alternatives. Returns (override_primary_snapshot, mutated_card).

Parameters:
  • card (JsonDict)

  • target_id (str)

  • rationale (str)

Return type:

Tuple[JsonDict, JsonDict]

_apply_accepted_state(card, caveats, require_gate_pass=False)[source]

Mark the card accepted, or hold it for review when a swap left the promoted primary without evidence.

When require_gate_pass is True (a primary_candidate_change), the card is marked writeback-ready only if the recomputed validation gates still pass; otherwise it is held for analyst review with an attention flag. For a plain accept the gates are left as the synthesizer computed them.

Parameters:
  • card (JsonDict)

  • caveats (List[str])

  • require_gate_pass (bool)

Return type:

None

_apply_rejected_state(card)[source]
Parameters:

card (JsonDict)

Return type:

None

_apply_gate_override_state(card, gate_override, rationale)[source]
Parameters:
Return type:

None

_normalize_questions(raw)[source]
Parameters:

raw (List[Any])

Return type:

List[JsonDict]

_normalize_evidence_additions(raw)[source]
Parameters:

raw (List[Any])

Return type:

List[JsonDict]