Hi @Frederick_Law. I like your code example for examining change types.
I have something sort of similar that you may also like, but it was laid out in a more complicated way. It extracts the Enum variation names and values into a Dictionary, and optionally edits their names to remove the leading "k", and following "CmdType" text. Then it sorts them in descending order by their numerical values. Then it iterates that collection, in that order. While iterating, it is cross checking the value from the document against the value from the collection instance, and doing the process of elimination as it goes, similar to your example above.
It is set this up as an external iLogic rule that can either be ran directly (or with no arguments), or can be called to run from another process (with or without arguments). But if arguments are supplied (for the document to inspect), then we can get a report back from it, if needed. Sort of like a Function within a referenced resource. If it is called directly, it will simply write a single report to the iLogic Log window, but if called remotely with arguments, it will only return that report to the calling routine, using the iLogic RuleArguments resource.
I have attached 2 text files. One contains the code for that main external iLogic rule. The other just contains code that can be used an example of some other iLogic rule that is calling that main one to run, with arguments, and how to receive that report back from it. I haven't really seen that many examples on the forum showing both 'send' & 'receive' processes, and I really like that functionality, so that is how I set this one up. Not that there is really a popular need for remotely retrieving that type of report as a String. I just wish I had seen some when I was first getting started in this type of thing years ago. It would have saved me a lot of research and testing.
Wesley Crihfield

(Not an Autodesk Employee)