That is an interesting project. We do similar with strfry and policies but might be good to offload that filtering.
nostr-filter "relay"
https://github.com/imksoo/nostr-filter
nostr-filter is a very interesting "relay", it is not really a relay it's more a filter relay that you run before your relay. it can be used to filter events, user, ip addresses, content... the best part of it, it can be run before any relay and it sends then only the filtered events to your own relay.