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

Function flatten_profile

experiments/benchmark/export_daily_data.py:93–110  ·  view source on GitHub ↗

将 profile 记录扁平化

(record: Dict)

Source from the content-addressed store, hash-verified

91
92
93def flatten_profile(record: Dict) -> Dict:
94 """将 profile 记录扁平化"""
95 profile_json = record.get("profile_json", {})
96
97 return {
98 "date": record.get("date", ""),
99 "user_id": record.get("user_id", ""),
100 "role_name": record.get("role_name", ""),
101 "version": record.get("version", ""),
102 "core_directions": json.dumps(profile_json.get("core_directions", {}), ensure_ascii=False),
103 "topic_weights": json.dumps(profile_json.get("topic_weights", {}), ensure_ascii=False),
104 "must_read_authors": json.dumps(profile_json.get("must_read", {}).get("authors", []), ensure_ascii=False),
105 "must_read_institutions": json.dumps(profile_json.get("must_read", {}).get("institutions", []), ensure_ascii=False),
106 "must_read_keywords": json.dumps(profile_json.get("must_read", {}).get("keywords", []), ensure_ascii=False),
107 "drift_status": profile_json.get("drift_state", {}).get("status", ""),
108 "drift_score": profile_json.get("drift_state", {}).get("score", 0),
109 "drift_top_topics": json.dumps(profile_json.get("drift_state", {}).get("top_shift_topics", []), ensure_ascii=False),
110 }
111
112
113def flatten_episode(record: Dict) -> Dict:

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected