(
user_metadata: Dict[str, Dict[str, Any]],
roles: Dict[str, Dict[str, Any]],
episode_rows: Sequence[Dict[str, Any]],
)
| 214 | |
| 215 | |
| 216 | def build_profile_map( |
| 217 | user_metadata: Dict[str, Dict[str, Any]], |
| 218 | roles: Dict[str, Dict[str, Any]], |
| 219 | episode_rows: Sequence[Dict[str, Any]], |
| 220 | ) -> Dict[str, Dict[str, Any]]: |
| 221 | user_ids = sorted( |
| 222 | { |
| 223 | str(row.get("user_id") or "").strip() |
| 224 | for row in episode_rows |
| 225 | if str(row.get("user_id") or "").strip() |
| 226 | } |
| 227 | | set(user_metadata.keys()) |
| 228 | ) |
| 229 | profiles: Dict[str, Dict[str, Any]] = {} |
| 230 | for user_id in user_ids: |
| 231 | meta = user_metadata.get(user_id, {}) |
| 232 | role_name = str(meta.get("role_name") or user_id.replace("user_", "")).strip() |
| 233 | profiles[user_id] = build_query_profile(meta, roles.get(role_name, {})) |
| 234 | return profiles |
| 235 | |
| 236 | |
| 237 | def group_by_episode(rows: Sequence[Dict[str, Any]]) -> Dict[str, List[Dict[str, Any]]]: |
no test coverage detected