Use ActivityDefinition resource to construct ServiceRequest

Hello,

I’m trying to use an ActivityDefinition as template to construct a ServiceRequest resource.

For example, suppose that I need to construct a ServiceRequest that has “code”, “category” and “performerType” attributes. The ActivityDefinition resource has only the “code” field, so how could I represent “category” and “performerType”?

1 Like

Hi @Douglas_Castro

Not sure if this may help, have you had a look at the example ActivityDefinition, from the FHIR Wiki: ActivityDefinition example
Category in this example is derived from the code and the performerType could be gotten from the participant. The example also has a note that states:

“This activity definition is used as the definition of a referral request within various suicide risk order sets. Elements that apply universally are defined here, while elements that apply to the specific setting of a referral within a particular order set are defined in the order set.

The other examples may also be of help: https://www.hl7.org/fhir/activitydefinition-examples.html

Hope that helps you to some extent?
Regards
Blessed

Hi @Douglas_Castro, in addition to the resources linked by @blessed_tabvirwa1, there is documentation here: Realizing an ActivityDefinition . Basically, for elements that don’t have a direct mapping from the ActivityDefinition, you can use a dynamicValue element to set the value based on the data available in the context of applying the ActivityDefinition.

Regards,
Bryn

1 Like

Hello @blessed_tabvirwa1 .
In our case, we need to create some ServiceRequests of different types, and we use the “category” field to distinguish them. So, your suggestion is that we have a function like “getCategoryByCode()” that returns the category given the code stored in the “code” field of the ActivityDefinition?

Hi Debora

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?

1 Like

Yes. We decided to implement the $apply operation and set the “category” of the ServiceRequest inside it, deriving from the “code” of the ActivityDefinition.

2 Likes