File size: 1,453 Bytes
34367da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""Check Neo4j M365 harvest status"""
from neo4j import GraphDatabase

driver = GraphDatabase.driver(
    'neo4j+s://054eff27.databases.neo4j.io', 
    auth=('neo4j', 'Qrt37mkb0xBZ7_ts5tG1J70K2mVDGPMF2L7Njlm7cg8')
)

with driver.session() as s:
    print("=" * 50)
    print("📊 M365 ITEMS I NEO4J")
    print("=" * 50)
    
    result = s.run('MATCH (i:M365Item) RETURN i.source as source, count(*) as count ORDER BY count DESC')
    total = 0
    for r in result:
        print(f"  {r['source']:15} {r['count']:5}")
        total += r['count']
    print(f"  {'TOTAL':15} {total:5}")
    
    print()
    print("=" * 50)
    print("🏷️ TOP KEYWORDS")
    print("=" * 50)
    result = s.run('''
        MATCH (k:SearchKeyword)<-[:MATCHES_KEYWORD]-(i:M365Item) 
        RETURN k.name as keyword, count(i) as count 
        ORDER BY count DESC LIMIT 15
    ''')
    for r in result:
        print(f"  {r['keyword']:15} {r['count']:5}")
    
    print()
    print("=" * 50)
    print("📧 SENESTE OUTLOOK EMAILS")
    print("=" * 50)
    result = s.run('''
        MATCH (i:M365Item {source: 'outlook'})
        RETURN i.title as subject, i.timestamp as time, i.keywords as keywords
        ORDER BY i.timestamp DESC LIMIT 10
    ''')
    for r in result:
        kws = ', '.join(r['keywords'][:3]) if r['keywords'] else ''
        print(f"  [{r['time']}] {r['subject'][:50]}... [{kws}]")

driver.close()
print("\n✅ Done!")