Files
OSIT-AE-API-FastAPI/ae_object_info.py
Scott Idem 802c75bad9 V3: Standardize Primary AE Objects and Synchronize Search Whitelists.
- Synchronized searchable_fields (V3 whitelists) across all Primary and Active AE objects (Identity, People, Events, Journals, Posts, Archives, Business).
- Standardized Pydantic models for core objects to include the 10 common fields (id, id_random, enable, hide, priority, sort, group, notes, created_on, updated_on).
- Fixed field aliases and uncommented valid database columns in User_Base and Organization_Base.
- Pruned non-existent fields from searchable lists in legacy or config-specific definitions (account_cfg, user_role, log_client_viewing).
- Added system discovery and validation tools:
    - ae_object_info.py: AE object status and metadata browser.
    - export_all_interfaces.py: E2E TypeScript interface generator.
    - Verification scripts for searchable field consistency.
- Updated Jan 8 milestone progress and platform roadmap in GEMINI.md.
2026-01-08 12:24:34 -05:00

109 lines
3.9 KiB
Python
Executable File

#!/usr/bin/env python3
import sys
import os
import json
import argparse
# Setup Path
API_ROOT = "/home/scott/OSIT_dev/aether_api_fastapi"
sys.path.append(API_ROOT)
# Object Status Categories
CATEGORIES = {
"IN_USE": [
"account", "site", "site_domain", "person", "user", "event",
"event_person", "event_registration", "event_badge", "event_badge_template",
"event_presentation", "event_presenter", "event_track", "event_location",
"event_file", "event_device", "journal", "journal_entry", "post",
"post_comment", "archive", "archive_content", "activity_log",
"data_store", "hosted_file", "organization", "address", "contact"
],
"LEGACY": ["log_client_viewing", "user_role"],
"SPECIAL": ["lu_country", "lu_country_subdivision", "lu_time_zone", "hosted_file_link"],
"CFG": ["account_cfg", "event_cfg", "membership_cfg", "fundraising_cfg", "order_cfg", "sponsorship_cfg"],
"INACTIVE": ["event_exhibit", "event_exhibit_tracking", "event_person_tracking"]
}
def get_category(obj_type):
for cat, items in CATEGORIES.items():
if obj_type in items:
return cat
return "UNKNOWN"
def main():
parser = argparse.ArgumentParser(description="AE Object Discovery Tool")
parser.add_argument("command", choices=["list", "get", "search"], help="Command to run")
parser.add_argument("query", nargs="?", help="Object type or search term")
args = parser.parse_args()
try:
from app.ae_obj_types_def import obj_type_kv_li
except ImportError as e:
print(f"Error: Could not import Aether API definitions. {e}")
sys.exit(1)
if args.command == "list":
for cat, items in CATEGORIES.items():
print(f"\n### {cat} ###")
for item in sorted(items):
if item in obj_type_kv_li:
print(f" - {item}")
# Check for ones not in our CATEGORIES mapping
unknowns = [obj for obj in obj_type_kv_li if get_category(obj) == "UNKNOWN"]
if unknowns:
print(f"\n### UNMAPPED ###")
for item in sorted(unknowns):
print(f" - {item}")
elif args.command == "get":
if not args.query:
print("Error: Please specify an object type.")
sys.exit(1)
obj_type = args.query
if obj_type in obj_type_kv_li:
def_kv = obj_type_kv_li[obj_type]
model = def_kv.get('mdl')
fields = []
if model and hasattr(model, '__fields__'):
fields = list(model.__fields__.keys())
info = {
"object_type": obj_type,
"category": get_category(obj_type),
"table": def_kv.get('tbl'),
"view": def_kv.get('tbl_default'),
"searchable_fields": def_kv.get('searchable_fields', []),
"model_fields": fields
}
print(json.dumps(info, indent=2))
else:
print(f"Error: Object type '{obj_type}' not found.")
elif args.command == "search":
if not args.query:
print("Error: Please specify a search term.")
sys.exit(1)
term = args.query.lower()
results = []
for obj_type, def_kv in obj_type_kv_li.items():
if term in obj_type:
results.append(obj_type)
else:
# Check searchable fields
s_fields = def_kv.get('searchable_fields', [])
if any(term in f.lower() for f in s_fields):
results.append(obj_type)
if results:
print(f"Found {len(results)} objects matching '{term}':")
for r in sorted(set(results)):
print(f" - {r} ({get_category(r)})")
else:
print(f"No objects found matching '{term}'.")
if __name__ == "__main__":
main()