AkahuSync/main.py

28 lines
1.1 KiB
Python

from IngestionService.ingester import Ingester
from config import load_env
load_env("IngestionService")
if __name__ == "__main__":
ingester = Ingester()
ingester.test_db_connection()
akahu_accounts = ingester.fetch_akahu_snapshot_data()
print("Akahu accounts fetched:", len(akahu_accounts.get("items", [])))
ingester.write_akahu_snapshot_data(akahu_accounts)
backfill_start = "2026-01-01"
backfill_end = "2026-12-31"
akahu_backfill = ingester.backfill_akahu_transactions(backfill_start, backfill_end)
print("Akahu backfill transactions:", len(akahu_backfill.get("items", [])))
emoney_data = ingester.fetch_emoney_data()
emoney_snapshot = emoney_data.get("snapshot") or {"accounts": []}
emoney_transactions = emoney_data.get("transactions") or []
print("Emoney snapshot accounts:", len(emoney_snapshot.get("accounts", [])))
ingester.write_emoney_snapshot_data(emoney_snapshot)
print("Emoney transactions:", len(emoney_transactions))
ingester.write_emoney_transaction_data(emoney_transactions)
ingester.normalize_pending_data()