...
Verify the validity of access token
Return 401 in case validation fails
Check user scopes in order to perform this action (scope = 'merge_request:write')
Return 403 in case invalid scope(s)
Validate request
Validate request using schema (TBD)
Also, check if process_disclosure_data_consent = true. It means that person confirm to disclose his personal data.
In case of error - return 422 error (Patient should approve disclosure of his personal data).
Validate legal entity
Check that legal entity is active (status = ACTIVE, SUSPENDED)
...