2026-05-18 09:10:09 +00:00
|
|
|
from IngestionService.ingester import Ingester
|
2026-05-18 22:47:46 +00:00
|
|
|
from config import load_env
|
2026-05-18 09:10:09 +00:00
|
|
|
|
2026-05-18 22:47:46 +00:00
|
|
|
load_env("IngestionService")
|
2026-05-18 09:10:09 +00:00
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
ingester = Ingester()
|
2026-05-18 22:47:46 +00:00
|
|
|
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()
|