After discussion with Phil Windley, I re-wrote the ruleset using a map instead of an array. This makes the rule for recording time_in much simpler and efficient. Nothing has to change in the front end because the entries query simply returns the values() of the map.

Note also the use of a rule to initialize ent:entries to an empty map. This rule is selected with either of the other rules, and KRL semantics guarantee that it will be evaluated first because it appears first lexically in the ruleset.

The ruleset can be directly installed into a pico using this github URL and the source code for the front end is in the same repository