Convert a JSON object to a DataRow with metadata columns
(json: &JsonValue, file: &TranscriptFile)
| 323 | |
| 324 | /// Convert a JSON object to a DataRow with metadata columns |
| 325 | fn json_to_data_row_with_meta(json: &JsonValue, file: &TranscriptFile) -> DataRow { |
| 326 | let mut map = BTreeMap::new(); |
| 327 | |
| 328 | map.insert( |
| 329 | "_source_file".to_string(), |
| 330 | Value::Str(file.source_file.clone()), |
| 331 | ); |
| 332 | map.insert( |
| 333 | "_session_id".to_string(), |
| 334 | Value::Str(file.session_id.clone()), |
| 335 | ); |
| 336 | if let Some(project) = &file.project { |
| 337 | map.insert("_project".to_string(), Value::Str(project.clone())); |
| 338 | } |
| 339 | if let Some(agent_id) = &file.agent_id { |
| 340 | map.insert("_agent_id".to_string(), Value::Str(agent_id.clone())); |
| 341 | } |
| 342 | |
| 343 | if let JsonValue::Object(obj) = json { |
| 344 | for (key, value) in obj { |
| 345 | map.insert(key.clone(), json_value_to_glue_value(value)); |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | flatten_usage_columns(json, &mut map); |
| 350 | |
| 351 | DataRow::Map(map) |
| 352 | } |
| 353 | |
| 354 | /// Inject flattened `model` / `usage_*` columns for assistant rows. |
| 355 | /// |
no test coverage detected