-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_analysis.py
More file actions
65 lines (52 loc) · 2.49 KB
/
debug_analysis.py
File metadata and controls
65 lines (52 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python3
import json
from pathlib import Path
def analyze_wto_vs_cto():
print("=" * 60)
print("WTO vs CTO Analysis")
print("=" * 60)
# Analyze WTO extracted document
wto_file = Path("extracted/0d76c981-9eb0-4d2c-86b5-57cffb4ec7cd.json")
if wto_file.exists():
with open(wto_file) as f:
wto_data = json.load(f)
print("WTO STRUCTURE:")
print(f"- Images count: {len(wto_data.get('images', []))}")
print(f"- Has attachment_details: {bool(wto_data.get('attachment_details'))}")
if wto_data.get('images'):
first_image = wto_data['images'][0]
print(f"- First image structure: {list(first_image.keys())}")
print(f"- Has attachment_id: {bool(first_image.get('attachment_id'))}")
# Check content
content = wto_data.get('content_markdown', '')
image_refs_local = content.count('images/0d76c981-9eb0-4d2c-86b5-57cffb4ec7cd/')
image_refs_api = content.count('api/attachments.redirect?id=')
print(f"- Local image refs in content: {image_refs_local}")
print(f"- API image refs in content: {image_refs_api}")
print("\n" + "-" * 40)
# Analyze CTO reference
cto_file = Path("todo.reference.json")
if cto_file.exists():
with open(cto_file) as f:
cto_data = json.load(f)
print("CTO REFERENCE STRUCTURE:")
print(f"- Attachments count: {len(cto_data.get('attachments', []))}")
print(f"- Has attachment_details: {bool(cto_data.get('attachment_details'))}")
if cto_data.get('attachment_details'):
details = cto_data['attachment_details']
print(f"- Attachment details count: {len(details)}")
first_key = list(details.keys())[0]
first_detail = details[first_key]
print(f"- First detail structure: {list(first_detail.keys())}")
print(f"- Has attachment_id: {bool(first_detail.get('attachment_id'))}")
print(f"- Has api_url: {bool(first_detail.get('api_url'))}")
print(f"- Uploaded status: {first_detail.get('uploaded')}")
# Check content
content = cto_data.get('md_content', '')
image_refs_api = content.count('api/attachments.redirect?id=')
print(f"- API image refs in content: {image_refs_api}")
print("\n" + "=" * 60)
print("ANALYSIS COMPLETE")
print("=" * 60)
if __name__ == "__main__":
analyze_wto_vs_cto()