Not knowing a whole lot about your implementation, my assumption is that your design is following this relationship between the ActivityDefinition and the resulting ServiceRequest (or any other action item resource you want generated from the ActivityDefinition)
So the relationship between an ActivityDefinition and a ServiceRequest is 1 to 1 thus your ActivityDefinition.kind (ServiceRequest), ActivityDefinition.code (could be a snomed code) among, other things, will determine the kind of ServiceRequest generated, e.g. see how the kind and code determine the resulting ServiceRequest in the examples below:
The link shared by @Bryn_Rhodes also describes how you could make this process dynamic and perhaps, then you may have some sort of “getCategoryByCode()” functionality as part of your solution.
Does that help clarify things a bit more?