Skip to content

Commit 965448e

Browse files
Refactor LJPW baseline metrics extraction for clarity
Co-authored-by: taurekaw <taurekaw@gmail.com>
1 parent e7e0ab9 commit 965448e

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

harmonizer/main.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -435,16 +435,21 @@ def build_json_payload(self, all_reports: Dict[str, Dict[str, Dict]]) -> Dict:
435435
}
436436
# Add LJPW baseline metrics if available
437437
ice_metrics = data.get("ice_result", {}).get("ice_metrics", {})
438-
if "baseline_disharmony" in ice_metrics:
439-
function_data["ljpw_baselines"] = {
440-
"baseline_disharmony": round(ice_metrics["baseline_disharmony"], 4),
441-
"intent_composite_score": round(
442-
ice_metrics.get("intent_composite_score", 0), 4
443-
),
444-
"execution_composite_score": round(
445-
ice_metrics.get("execution_composite_score", 0), 4
446-
),
447-
}
438+
baseline_metrics = {}
439+
baseline_disharmony = ice_metrics.get("baseline_disharmony")
440+
if baseline_disharmony is not None:
441+
baseline_metrics["baseline_disharmony"] = round(baseline_disharmony, 4)
442+
443+
intent_comp = ice_metrics.get("intent_composite_score")
444+
if intent_comp is not None:
445+
baseline_metrics["intent_composite_score"] = round(intent_comp, 4)
446+
447+
execution_comp = ice_metrics.get("execution_composite_score")
448+
if execution_comp is not None:
449+
baseline_metrics["execution_composite_score"] = round(execution_comp, 4)
450+
451+
if baseline_metrics:
452+
function_data["ljpw_baselines"] = baseline_metrics
448453
if self.show_semantic_maps:
449454
function_data["semantic_map"] = data["semantic_map"]
450455
file_data["functions"].append(function_data)

0 commit comments

Comments
 (0)