1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-05 13:35:21 +02:00

Remove existing data enrichment for clean slate

This commit is contained in:
Zach Gollwitzer 2025-04-01 15:32:31 -04:00
parent 6644afe147
commit 8effdcb2d3
10 changed files with 7 additions and 98 deletions

View file

@ -1,5 +1,5 @@
class Account < ApplicationRecord
include Syncable, Monetizable, Chartable, Enrichable, Linkable, Convertible
include Syncable, Monetizable, Chartable, Linkable, Convertible
validates :name, :balance, :currency, presence: true
@ -78,11 +78,6 @@ class Account < ApplicationRecord
Rails.logger.info("Processing balances (#{linked? ? 'reverse' : 'forward'})")
sync_balances
if enrichable?
Rails.logger.info("Enriching transaction data")
enrich_data
end
end
def post_sync

View file

@ -152,7 +152,7 @@ class Demo::Generator
Security::Price.destroy_all
end
def create_family_and_user!(family_name, user_email, data_enrichment_enabled: false, currency: "USD")
def create_family_and_user!(family_name, user_email, currency: "USD")
base_uuid = "d99e3c6e-d513-4452-8f24-dc263f8528c0"
id = Digest::UUID.uuid_v5(base_uuid, family_name)
@ -161,7 +161,6 @@ class Demo::Generator
name: family_name,
currency: currency,
stripe_subscription_status: "active",
data_enrichment_enabled: data_enrichment_enabled,
locale: "en",
country: "US",
timezone: "America/New_York",

View file

@ -159,38 +159,9 @@ class Provider::Synth < Provider
end
end
# ================================
# Transactions
# ================================
def enrich_transaction(description, amount: nil, date: nil, city: nil, state: nil, country: nil)
with_provider_response do
params = {
description: description,
amount: amount,
date: date,
city: city,
state: state,
country: country
}.compact
response = client.get("#{base_url}/enrich", params)
parsed = JSON.parse(response.body)
TransactionEnrichmentData.new(
name: parsed.dig("merchant"),
icon_url: parsed.dig("icon"),
category: parsed.dig("category")
)
end
end
private
attr_reader :api_key
TransactionEnrichmentData = Data.define(:name, :icon_url, :category)
def base_url
ENV["SYNTH_URL"] || "https://api.synthfinance.com"
end