| |
|
|
| """ |
| TEST EMERGENCY KNOWLEDGE - ELIZABETH READY |
| Verify scraped knowledge is test-ready |
| Aurora - ETL Systems Specialist |
| """ |
|
|
| import json |
| from pathlib import Path |
|
|
| def test_emergency_knowledge(): |
| """Test the emergency scraped knowledge""" |
| knowledge_dir = Path("/data/adaptai/corpus-data/emergency-knowledge") |
| |
| print("π§ͺ TESTING EMERGENCY KNOWLEDGE ACQUISITION") |
| print("=" * 50) |
| |
| |
| json_files = list(knowledge_dir.glob("emergency_*.json")) |
| |
| if not json_files: |
| print("β No emergency knowledge files found!") |
| return False |
| |
| |
| total_items = 0 |
| categories = set() |
| |
| for file_path in json_files: |
| if 'summary' in file_path.name: |
| continue |
| |
| print(f"\nπ Testing: {file_path.name}") |
| |
| try: |
| with open(file_path, 'r', encoding='utf-8') as f: |
| data = json.load(f) |
| |
| if isinstance(data, list): |
| |
| item_count = len(data) |
| print(f" Items: {item_count}") |
| total_items += item_count |
| |
| if data: |
| |
| first_item = data[0] |
| if 'title' in first_item and 'content' in first_item: |
| print(f" β
Structure: Valid") |
| print(f" π Sample: {first_item.get('title', 'No title')[:50]}...") |
| categories.add(first_item.get('category', 'unknown')) |
| else: |
| print(f" β Structure: Invalid") |
| |
| else: |
| |
| total_items += 1 |
| print(f" Items: 1") |
| |
| if 'title' in data and 'content' in data: |
| print(f" β
Structure: Valid") |
| print(f" π Sample: {data.get('title', 'No title')[:50]}...") |
| categories.add(data.get('category', 'unknown')) |
| else: |
| print(f" β Structure: Invalid") |
| |
| except Exception as e: |
| print(f" β Error loading {file_path}: {e}") |
| |
| |
| summary_files = sorted(knowledge_dir.glob("emergency_summary_*.json"), key=lambda p: p.stat().st_mtime, reverse=True) |
| if summary_files: |
| try: |
| with open(summary_files[0], 'r', encoding='utf-8') as f: |
| summary = json.load(f) |
| print(f"\nπ SUMMARY: {summary.get('total_items', 'n/a')} total items") |
| cats = summary.get('categories_scraped') or summary.get('categories') or [] |
| if isinstance(cats, dict): |
| cats = list(cats.keys()) |
| if isinstance(cats, list): |
| print(f" Categories: {', '.join(cats)}") |
| except Exception as e: |
| print(f"\nβ οΈ Failed to load summary: {e}") |
| |
| print(f"\nπ― KNOWLEDGE DOMAINS ACQUIRED:") |
| for category in categories: |
| print(f" β’ {category.replace('_', ' ').title()}") |
| |
| |
| print(f"\nβ
TEST READINESS ASSESSMENT:") |
| |
| if total_items >= 10: |
| print(" π Sufficient volume: YES") |
| else: |
| print(" π Sufficient volume: NO") |
| |
| if any('payment' in cat for cat in categories): |
| print(" π³ Payment processing: YES") |
| else: |
| print(" π³ Payment processing: NO") |
| |
| if any('tech' in cat or 'trend' in cat for cat in categories): |
| print(" π€ Tech trends: YES") |
| else: |
| print(" π€ Tech trends: NO") |
| |
| print(f"\nπ ELIZABETH TEST READY: {'YES' if total_items >= 10 else 'NO'}") |
| |
| return total_items >= 10 |
|
|
| def main(): |
| success = test_emergency_knowledge() |
| |
| if success: |
| print("\nπ EMERGENCY KNOWLEDGE VALIDATION PASSED") |
| print("=" * 50) |
| print("Elizabeth can now be tested with real-world knowledge!") |
| print("\nNext steps:") |
| print("1. Integrate with Elizabeth's knowledge base") |
| print("2. Run autonomous operation tests") |
| print("3. Verify payment processing understanding") |
| print("4. Test technical trend awareness") |
| else: |
| print("\nβ EMERGENCY KNOWLEDGE VALIDATION FAILED") |
| print("Need more diverse knowledge acquisition") |
|
|
| if __name__ == "__main__": |
| main() |
|
|