Ongoing count by matching tag values

There is a lot more to this tag structure but for simplicity just going to include basic structure that is relevant to question

TagUDT
Parameter.Zones = 1,2 *List of integer values so could be just a single integer or 1,2,3,4 or 3,5 etc
Status = True/False

the number of instances of this tag could be anywhere from 5 -1000+

What I am looking for is to end up with a set of other tags (Zone X status count) with value = the number of UDT instances that have zone X within parameters.zone and status = True

While parameters.zone is not fixed permanent it will rarely change however status on any can change at any time and I want the count to be as close to a real time / fast update as possible. Of note the udt instances are located in different folders independent of the paramters.zone values and folder structure can not be changed

Looking for general ideas on how you would accomplish this or examples if you have done something similar in the past

I would use the techniques in this topic:

and this topic:

.. to report the status changes to a project library script for cross referencing.

In the timer processing script, cache the zones per status tag. Force update the cached zones on any initialChange.

For each zone, maintain a set() of true status tag paths. Each queued event would loop through the tag's zones adding or removing from the set.

Within the event, track which zones you've touched with a temporary set.

After processing all queued events for that tick of the timer, loop through the zones that were touched and build a list of zone tags to update. The values are the lengths of the zones' sets.