Skip to content

Commit 37ca08b

Browse files
committed
exercise 7 and learning
1 parent 9bd4cb4 commit 37ca08b

7 files changed

Lines changed: 127 additions & 2 deletions

File tree

exercises/exercise-6.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
___
33

44
# Exercise 6 - Event Based Gateways and Intermediate Events
5-
In the final exercise we will look at message flow between three organizations as well as how to continue a waiting process if no return message arrives.
5+
In this exercise we will look at message flow between three organizations as well as how to continue a waiting process if no return message arrives.
66
With this exercise we will add a third process and complete a message loop from `dic.dsf.test` to `cos.dsf.test` to `hrp.dsf.test` and back to `dic.dsf.test`.
77

88
In order to solve this exercise, you should have solved exercise 5 and read the topics on

exercises/exercise-7.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
[Prerequisites](prerequisites.md)[Exercise 0](exercise-0.md)[Exercise 1](exercise-1.md)[Exercise 1.1](exercise-1-1.md)[Exercise 2](exercise-2.md)[Exercise 3](exercise-3.md)[Exercise 4](exercise-4.md)[Exercise 5](exercise-5.md)**Exercise 6**
2+
___
3+
4+
# Exercise 7 - UserTasks, Resource Download and Task Output Parameters
5+
6+
This exercise introduces a new scenario which will serve as an example where [User Tasks](../learning/concepts/bpmn/user-task.md), resource download and [Task Output Parameters](../learning/concepts/fhir/task.md#task-output-parameters)
7+
will be utilized. The scenario is a voting process where one DSF instances of the tutorial setup will send a question to the other instances and itself in form of a Questionnaire
8+
9+
In order to solve this exercise, you should have solved exercise 6 and read the topics on
10+
[User Tasks](../learning/guides/user-tasks-in-the-dsf.md)
11+
and [adding Task Output Parameters](../learning/guides/adding-task-output-parameters-to-task-profiles.md).
12+
13+
Solutions to this exercise are found on the branch `solutions/exercise-7`.
14+
15+
## Exercise Tasks
16+
17+
1. Modify the `dsfdev_dicProcess`:
18+
* Change the [Message End Event](../learning/concepts/bpmn/messaging.md#message-end-event) to an [Intermediate Message Throw Event](../learning/concepts/bpmn/messaging.md#message-intermediate-throwing-event)
19+
* Add an [Event Based Gateway](../learning/concepts/bpmn/gateways.md#event-based-gateway) after the throw event
20+
* Configure two cases for the [Event Based Gateway](../learning/concepts/bpmn/gateways.md#event-based-gateway):
21+
1. An [Intermediate Message Catch Event](../learning/concepts/bpmn/messaging.md#message-intermediate-catching-event) to catch the `goodbyeDic` message from the `dsfdev_hrpProcess`.
22+
1. An [Intermediate Timer Catch Event](../learning/concepts/bpmn/timer-intermediate-catching-events.md) to end the process if no message is sent by the `dsfdev_hrpProcess` after two minutes.
23+
Make sure both cases finish with a process [End Event](https://docs.camunda.org/manual/7.17/reference/bpmn20/events/none-events/).
24+
1. Modify the `dsfdev_cosProcess` to use a [Message End Event](../learning/concepts/bpmn/messaging.md#message-end-event) to trigger the process in file `hrp-process.bpmn`. Figure out the values for the `instantiatesCanonical`, `profile` and `messageName` input parameters of the [Message End Event](../learning/concepts/bpmn/messaging.md#message-end-event) based on the [AcitvityDefinition](../learning/concepts/fhir/activitydefinition.md) in file `hrp-process.xml`. Change the `Cos Task` element into a Service Task and include the `CosTask` as the implementation.
25+
1. Modify the process in file `hrp-process.bpmn` and set the _process definition key_ and _version_. Figure out the appropriate values based on the [AcitvityDefinition](../learning/concepts/fhir/activitydefinition.md) in file `hrp-process.xml`.
26+
1. Add a new process authorization extension element to the ActivityDefinition for `dsfdev_dicProcess` using the [parent organization role coding](../learning/concepts/dsf/examples-for-requester-and-recipient-elements.md) where
27+
only remote organizations which are part of `medizininformatik-initiative.de` and have the `HRP` role are allowed to request `goodByeDic` messages and only
28+
organizations which are part of `medizininformatik-initiative.de` and have the `DIC` role are allowed to receive `goodByeDic` messages
29+
<details>
30+
<summary>Don't know which values to choose for roles?</summary>
31+
32+
Take a look at the [dsf-organization-role](https://github.com/datasharingframework/dsf/blob/main/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/CodeSystem/dsf-organization-role-1.0.0.xml) CodeSystem.
33+
</details>
34+
1. Forward the value from the [Task.input](../learning/concepts/fhir/task.md) parameter of the `dicProcess` [Task](../learning/concepts/fhir/task.md) to the `dsfdev_cosProcess` using the `HelloCosMessage`. To do this, you need to override `HelloCosMessage#getAdditionalInputParameters`. Don't forget to also add the definition of your `tutorial-input` [Input Parameter](../learning/concepts/fhir/task.md#task-input-parameters) from `task-start-dic-process.xml` to `task-hello-cos.xml`.
35+
1. Add the process in file `hrp-process.bpmn` to the `TutorialProcessPluginDefinition` and configure the FHIR resources needed for the three processes.
36+
1. Add the `CosTask`, `HelloHrpMessage `, `HrpTask` and `GoodbyeDicMessage` classes as Spring Beans. Don't forget the scope.
37+
1. Again, we introduced changes that break compatibility. Older plugin versions won't execute the HRP process because the process ID in the BPMN model is still invalid and it is missing a version. Increment your resource version to `1.4`.
38+
39+
40+
## Solution Verification
41+
### Maven Build and Automated Tests
42+
Execute a maven build of the `dsf-process-tutorial` parent module via:
43+
```
44+
mvn clean install -Pexercise-6
45+
```
46+
Verify that the build was successful and no test failures occurred.
47+
48+
### Process Execution and Manual Tests
49+
To verify the `dsfdev_dicProcess`, `dsfdev_cosProcess` and `dsfdev_hrpProcess`es can be executed successfully, we need to deploy them into DSF instances and execute the `dsfdev_dicProcess`. The maven `install` build is configured to create a process jar file with all necessary resources and copy the jar to the appropriate locations of the docker dev setup.
50+
Don't forget that you will have to add the client certificate for the `HRP` instance to your browser the same way you added it for the `DIC` and `COS` instances
51+
in [exercise 1](exercise-1.md) and [exercise 4](exercise-5.md) or use the Keycloak user you created in [exercise 3](exercise-3.md) for the `hrp` realm. Otherwise, you won't be able to access [https://hrp/fhir](https://hrp/fhir). You can find the client certificate
52+
in `.../dsf-process-tutorial/test-data-generator/cert/hrp-client/hrp-client_certificate.p12` (password: password).
53+
54+
1. Start the DSF FHIR server for the `dic.dsf.test` organization in a console at location `.../dsf-process-tutorial/dev-setup`:
55+
```
56+
docker-compose up dic-fhir
57+
```
58+
Verify the DSF FHIR server started successfully.
59+
60+
2. Start the DSF BPE server for the `dic.dsf.test` organization in a second console at location `.../dsf-process-tutorial/dev-setup`:
61+
```
62+
docker-compose up dic-bpe
63+
```
64+
Verify the DSF BPE server started successfully and deployed the `dsfdev_dicProcess`.
65+
66+
3. Start the DSF FHIR server for the `cos.dsf.test` organization in a third console at location `.../dsf-process-tutorial/dev-setup`:
67+
```
68+
docker-compose up cos-fhir
69+
```
70+
Verify the DSF FHIR server started successfully.
71+
72+
4. Start the DSF BPE server for the `cos.dsf.test` organization in a fourth console at location `.../dsf-process-tutorial/dev-setup`:
73+
```
74+
docker-compose up cos-bpe
75+
```
76+
Verify the DSF BPE server started successfully and deployed the `dsfdev_dicProcess`.
77+
78+
79+
5. Start the DSF FHIR server for the `hrp.dsf.test` organization in a fifth at location `.../dsf-process-tutorial/dev-setup`:
80+
```
81+
docker-compose up hrp-fhir
82+
```
83+
Verify the DSF FHIR server started successfully. You can access the webservice of the DSF FHIR server at https://hrp/fhir. To authenticate yourself to the server you can use the client certificate located at `.../dsf-process-tutorial/test-data-generator/cert/hrp-client/hrp-client_certificate.p12` (Password: `password`).
84+
85+
6. Start the DSF BPE server for the `hrp.dsf.test` organization in a sixth console at location `.../dsf-process-tutorial/dev-setup`:
86+
```
87+
docker-compose up hrp-bpe
88+
```
89+
Verify the DSF BPE server started successfully and deployed the `dsfdev_hrpProcess`. The DSF BPE server should print a message that the process was deployed. The DSF FHIR server should now have a new [ActivityDefinition](../learning/concepts/fhir/activitydefinition.md) resource. Go to https://hrp/fhir/ActivityDefinition to check if the expected resource was created by the BPE while deploying the process. The returned FHIR [Bundle](http://hl7.org/fhir/R4/bundle.html) should contain a three [ActivityDefinition](../learning/concepts/fhir/activitydefinition.md) resources. Also, go to https://hrp/fhir/StructureDefinition?url=http://dsf.dev/fhir/StructureDefinition/task-hello-hrp to check if the expected [Task](../learning/concepts/fhir/task.md) profile was created.
90+
91+
7. Start the `dsfdev_dicProcess` by posting a specific FHIR [Task](../learning/concepts/fhir/task.md) resource to the DSF FHIR server of the `dic.dsf.test` organization using either cURL or the DSF FHIR server's web interface. Check out [Starting A Process Via Task Resources](../learning/guides/starting-a-process-via-task-resources.md) again if you are unsure.
92+
93+
Verify that the FHIR [Task](../learning/concepts/fhir/task.md) resource was created at the DSF FHIR server and the `dsfdev_dicProcess` was executed by the DSF BPE server of the `dic.dsf.test` organization. The DSF BPE server of the `dic.dsf.test` organization should print a message showing that a [Task](../learning/concepts/fhir/task.md) resource to start the `dsfdev_cosProcess` was sent to the `cos.dsf.test` organization.
94+
Verify that a FHIR [Task](../learning/concepts/fhir/task.md) resource was created at the DSF FHIR server of the `cos.dsf.test` organization and the `dsfdev_cosProcess` was executed by the DSF BPE server of the `cos.dsf.test` organization. The DSF BPE server of the `cos.dsf.test` organization should print a message showing that a [Task](../learning/concepts/fhir/task.md) resource to start the `dsfdev_hrpProcess` was sent to the `hrp.dsf.test` organization.
95+
96+
Based on the value of the Task.input parameter you send, the `dsfdev_hrpProcess` will either send a `goodbyeDic` message to the `dic.dsf.test` organization or finish without sending a message.
97+
98+
To trigger the `goodbyeDic` message, use `send-response` as the `http://dsf.dev/fhir/CodeSystem/tutorial#tutorial-input` input parameter.
99+
100+
Verify that the `dsfdev_dicProcess` either finishes with the arrival of the `goodbyeDic` message or after waiting for two minutes.
101+
102+
___
103+
[Prerequisites](prerequisites.md)[Exercise 0](exercise-0.md)[Exercise 1](exercise-1.md)[Exercise 1.1](exercise-1-1.md)[Exercise 2](exercise-2.md)[Exercise 3](exercise-3.md)[Exercise 4](exercise-4.md)[Exercise 5](exercise-5.md)**Exercise 6**

learning/concepts/bpmn/user-task.md

Whitespace-only changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
### FHIR Webservice Client
2+
3+
A FHIR Webservice Client instance can be used to perform CRUD operations for FHIR resources on
4+
both the local and any other DSF FHIR server.
5+
It is accessible through the [Process Plugin Api's](process-api.md#process-plugin-api) Fhir Webservice Client Provider.

learning/concepts/fhir/task.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,15 @@ For example, if your particular data exchange requires additional medical data,
1919
way the [dsf-task-base](https://github.com/datasharingframework/dsf/blob/main/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/StructureDefinition/dsf-task-base-1.0.0.xml) adds slices to the original [FHIR Task](https://www.hl7.org/fhir/R4/task.html) resource. Notice that this also requires creating a [CodeSystem](../../concepts/fhir/codesystem.md) and
2020
including it in a [ValueSet](../../concepts/fhir/valueset.md) to be able to use it in the Task resource.
2121

22-
If these instructions are insufficient you can check out the guide on [how to add Task Input Parameters](../../guides/adding-task-input-parameters-to-task-profiles.md).
22+
If these instructions are insufficient you can check out the guide on [how to add Task Input Parameters](../../guides/adding-task-input-parameters-to-task-profiles.md).
23+
24+
#### Task Output Parameters
25+
26+
Task Output Parameters server a similar purpose to [Task Input Parameters](task.md#task-input-parameters). They add additional information to a [Task](task.md#task) resource, but for a different context.
27+
While [Task Input Parameters](task.md#task-input-parameters) provide additional information which is required to process the [Task](task.md#task), Task Output Parameters provide information on the [Task's](task.md#task) completion.
28+
For example, in the context of a voting process, you might add the results of the vote as a Task Output Parameter. You would add a slice to your Task profile in the same
29+
way the [dsf-task-base](https://github.com/datasharingframework/dsf/blob/main/dsf-fhir/dsf-fhir-validation/src/main/resources/fhir/StructureDefinition/dsf-task-base-1.0.0.xml) adds slices to the original [FHIR Task](https://www.hl7.org/fhir/R4/task.html) resource. Notice that this also requires creating a [CodeSystem](../../concepts/fhir/codesystem.md) and
30+
including it in a [ValueSet](../../concepts/fhir/valueset.md) to be able to use it in the Task resource.
31+
32+
If these instructions are insufficient you can check out the guide on [how to add Task Input Parameters](../../guides/adding-task-input-parameters-to-task-profiles.md). Since Input Parameters and Output Parameters are created in the same way, you can follow the same guide
33+
as the one for creating Input Parameters and replace 'input' with 'output' in your result.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
### Adding Task Output Parameters to Task Profiles
2+
3+
[Task Input Parameters](../concepts/fhir/task.md#task-input-parameters) and [Task Output Parameters](../concepts/fhir/task.md#task-output-parameters) are created in the same way.
4+
Follow the guide on [adding Task Input Parameters to Task profiles](adding-task-input-parameters-to-task-profiles.md) and replace
5+
'input' with 'output' in your result.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
### Adding Task Output

0 commit comments

Comments
 (0)