src.dackar.RCA.pm_compliance.effectiveness_analyzer

PMEffectivenessAnalyzer — as-found trend signals (advisory, data-quality limited).

Functions

analyze_degradation(as_found_texts[, data_dir])

Return degradation_trend label based on as-found text.

compute_pm_found_defect_rate(rows[, data_dir])

Return fraction of PM executions with as-found data that recorded a defect.

collect_as_found_from_checks(checks)

Use details (as-found) from checks when available.

collect_as_found_from_rows(rows[, max_cycles])

Prefer structured as-found columns from export rows.

Module Contents

src.dackar.RCA.pm_compliance.effectiveness_analyzer.analyze_degradation(as_found_texts, data_dir=None)[source]

Return degradation_trend label based on as-found text.

When data_dir points to the DACKAR data directory, uses the curated health_status_keywords_negative/positive.csv vocabulary. Falls back to hardcoded stems when data_dir is None or the files are absent.

Classification logic (in priority order): 1. No non-empty texts → "unknown" 2. Improving terms match AND no degrading terms match → "improving" 3. Degrading terms match → "degrading" 4. Otherwise → "stable"

Parameters:
  • as_found_texts (List[str])

  • data_dir (Optional[pathlib.Path])

Return type:

str

src.dackar.RCA.pm_compliance.effectiveness_analyzer.compute_pm_found_defect_rate(rows, data_dir=None)[source]

Return fraction of PM executions with as-found data that recorded a defect.

Iterates all export rows (not cycle-limited) to give a statistical signal over the full lookback history. Returns None when no rows carry as-found data (avoids a misleading 0.0 rate).

A row is counted as a defect when its as-found text classifies as "degrading" per analyze_degradation.

Parameters:
Return type:

Optional[float]

src.dackar.RCA.pm_compliance.effectiveness_analyzer.collect_as_found_from_checks(checks)[source]

Use details (as-found) from checks when available.

Parameters:

checks (List[src.dackar.RCA.pm_compliance.types.JsonDict])

Return type:

List[str]

src.dackar.RCA.pm_compliance.effectiveness_analyzer.collect_as_found_from_rows(rows, max_cycles=None)[source]

Prefer structured as-found columns from export rows.

When max_cycles is set, only the most-recent N rows (by completed_date) are considered — honouring PMComplianceConfig.effectiveness_lookback_cycles.

Parameters:
Return type:

List[str]