MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / flatten_drift

Function flatten_drift

experiments/benchmark/export_daily_data.py:139–153  ·  view source on GitHub ↗

将 drift 记录扁平化

(record: Dict)

Source from the content-addressed store, hash-verified

137
138
139def flatten_drift(record: Dict) -> Dict:
140 """将 drift 记录扁平化"""
141 return {
142 "timestamp": record.get("timestamp", ""),
143 "date": record.get("date", ""),
144 "user_id": record.get("user_id", ""),
145 "transition": record.get("transition", ""),
146 "score_delta": record.get("score_delta", 0),
147 "method": record.get("method", ""),
148 "checkfile_name": record.get("checkfile_name", ""),
149 "emerging_topics": json.dumps(record.get("emerging_topics", []), ensure_ascii=False),
150 "directions_added": json.dumps(record.get("directions_added", []), ensure_ascii=False),
151 "directions_removed": json.dumps(record.get("directions_removed", []), ensure_ascii=False),
152 "explanation": record.get("explanation", ""),
153 }
154
155
156def export_to_csv(records: List[Dict], output_path: Path, flatten_func=None) -> None:

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected