...
if activity kind = medication_request:
Check there is no medication request requests in status
NEW
based on the activityin case of error - return 409 (Unable to cancel activity with new Medication Request requests).
Check there is no medication requests in status
ACTIVE
based on the activityin case of error - return 409 (Unable to cancel activity with active Medication requests).
if activity activity kind = service_request:
Check there is no no service requests in in status
active
,in_progress
based =active
AND program_processing_status !=completed
based on the activity:in case of error - return 409 (Unable to cancel complete activity with <active/in_progress> Service requests in status <status value> and program processing status not completed or undefined).
Validate content
Signed content must match with activity in DB in order to be changed
...