4 ms·
I've used EAV before after putting some time into thinking of a solution and I'd be curious if there was a better way. Basically, we were building a restricted
by pmart123 8y ago
I've used EAV before after putting some time into thinking of a solution and I'd be curious if there was a better way. Basically, we were building a restricted stock database depending on either a client preference or a customizable list.
For instance, a religious institution may not want to invest in a company that derives revenue from tobacco. So, we might have:
1. Is the company in an industry or sector we have flagged as tobacco?
2. Upon review, did one of our analyst create an exception list for companies partially involved in selling tobacco i.e. CVS, LVMH with duty-free, etc.?
3. Did the religious foundation also provide its own list of companies associated with tobacco usually through a consultant or several.
Therefore, we used a schema like:
table: exclusion_lists
columns: company_id, exclusion_list_id, source_id
An account would register a restriction, which would group the baseline restricted companies from say sector to along with any customized lists that the account subscribed to, and a view would output all the restricted stocks and reasons why.
It didn't seem like an anti-pattern at the time. The benefit seemed to be if a restriction code was changed, it would all happen in one place versus updated in a bunch of JSON objects. Adding a column for a client for some special restriction with three companies would create a very sparse table so that didn't seem like an elegant solution either.