Seeking Advice on Optimal Data Enrichment Practices as Project Becomes More Complex
Hey,
I'm currently refining my approach to data enrichment in our applications and would appreciate your insights and recommendations.
My functions for enriching query results are becoming quite extensive, and I'm considering whether to stick with granular, targeted enrichment functions or to use a more comprehensive single function that fetches all related data regardless of the specific needs of certain queries.
Here’s an example of a more detailed enrichment function I use, mostly for a admin dashbord:
And here's a simpler function that's used mainly in the public app:
I'm also curious to what naming convention people like using for this?
Do you recommend maintaining multiple specific enrichment functions, or should I consolidate them into a single, more comprehensive function?
Looking forward to your thoughts and suggestions!
2 Replies
Just my two cent working through similar needs:
- multiple specific vs comprehensive: I think there's room for both in the same app, I've been calling this case by case
- conventions: I'm using a similar approach (except calling it "compose" instead of "enrich"). Because these tend to be based on client needs, I've begun naming them based on the features/functionality they serve, which tends to lead to simpler and more durable names. These functions change over time, so naming based on purpose rather than exact content seems to work well.
Thanks for sharing your take on this mate. Always appreciated. Giving some food for thought.