import json with open('migrations/scripts/extracted_data.json', 'r', encoding='utf-8') as f: data = json.load(f) # Check first ticket with conversations for ticket in data['tickets'][:10]: tid = ticket.get('ticket_id') convs = ticket.get('conversations', []) notes = ticket.get('notes', []) attachments = ticket.get('attachments', []) desc = ticket.get('description', '') if convs or notes or attachments: print(f'Ticket #{tid}:') print(f' Description length: {len(desc)} chars') print(f' Has HTML: {"<" in desc}') print(f' Conversations: {len(convs)}') print(f' Notes: {len(notes)}') print(f' Attachments: {len(attachments)}') if convs: print(f' First conversation keys: {list(convs[0].keys())}') print(f' First conversation: {json.dumps(convs[0], ensure_ascii=False)[:300]}') if attachments: print(f' First attachment keys: {list(attachments[0].keys())}') print(f' First attachment: {json.dumps(attachments[0], ensure_ascii=False)[:300]}') print() # Count tickets with conversations/attachments total_convs = sum(len(t.get('conversations', [])) for t in data['tickets']) total_notes = sum(len(t.get('notes', [])) for t in data['tickets']) total_attach = sum(len(t.get('attachments', [])) for t in data['tickets']) tickets_with_convs = sum(1 for t in data['tickets'] if t.get('conversations')) tickets_with_attach = sum(1 for t in data['tickets'] if t.get('attachments')) print(f'Summary:') print(f' Total conversations: {total_convs}') print(f' Total notes: {total_notes}') print(f' Total attachments: {total_attach}') print(f' Tickets with conversations: {tickets_with_convs}') print(f' Tickets with attachments: {tickets_with_attach}')