Refactor transaction enrichment to support batch processing #1803
Reference in New Issue
Block a user
Delete Branch "data-enricher-optimization"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@@ -8,49 +8,61 @@ class Account::DataEnricherendBoth
merchant_idandcategory_idare stored on theAccount::Transactionrecord, whileenriched_atis stored onAccount::Entry(delegated type).Given we're primarily enriching
Account::Transactionrecords (and not other entry types likeAccount::ValuationandAccount::Trade), I think it probably makes sense to move theenriched_atfield down to theAccount::Transactionand only deal with those types of records in this process.Since this was originally written, we've added null validations to ensure
nameis present, so this can safely be removed now.@@ -8,49 +8,61 @@ class Account::DataEnricherendActually, second guessing the idea of moving
enriched_attoAccount::Transaction. This enrichment is also modifyingenriched_nameon theAccount::Entrymodel, so it probably makes sense to keep this as-is.Will still need to update this query to read
merchant_idandcategory_idoff theAccount::Transactionrecord though.@@ -8,49 +8,61 @@ class Account::DataEnricherend@zachgoll Is the entryable join necessary? AI seems to think so.
@@ -8,49 +8,61 @@ class Account::DataEnricherendThe join is necessary, but
joins(:entryable)is not possible since this is a polymorphic association and will throw an error. Here's what I would use:@zachgoll let me know how this looks now.
Yep, functionality looks good now!
The last thing I'm thinking about here is whether we even need
EnrichDataJobanymore. All that job is doing now is:I'm thinking we could get rid of that entirely (the job itself) and do this work directly in
account.enrich_data.So in total, we'd:
account.enrich_data_latermethodEnrichDataJob@zachgoll Good call. Updated. We good to push to production?
Yep, looks good!