Table of Contents | ||||
---|---|---|---|---|
|
...
if episode_of_care is presented in request as the code of resource
Check episode_of_care in the request exists and is in active or closed status in DB
in case of error return - 422 (Episode is canceled)
Check if resource from granted_to = 'employee':
in case of error return - 422 ("$.resource. value is not allowed in enum")
if diagnostic_report is presented in request as the code of resource
Check diagnostic_report block in the request exists and is in final status in DB
in case of error return - 422 (Diagnostic report in \"entered_in_error\" status can not be referenced or Diagnostic report with such id is not found)
Check if resource from granted_to = 'employee':
in case of error return - 422 ("$.resource. value is not allowed in enum")
if care_plan is presented in request as the code of resource
Check care_plan in the request exists in DB
in case of error return - 422 (Care plan with such id is not found)
Check there no other objects in request
in case of error return - 422 (Approval for care plan can not contain other entities)
Check if resource from granted_to = 'employee':
in case of error return - 422 ("$.resource. value is not allowed in enum". value is not allowed in enum")
if access_level = 'write':
Check if care_plans.managing_organization = granted_to.employees.legal_entity_id:
in case of error return - 422 ('User is not allowed to write care plan from another legal_entity')
if encounter is presented in request as the code of resource
Check encounter in the request exists in DB
in case of error return - 422 (not found)
Check if resource from granted_to = 'employee':
in case of error return - 422 ("$.resource. value is not allowed in enum")
Check is status of episode from encounter = 'active'
in case of error return - 422 ("Encounter refers to episode that is not active")
if procedure is presented in request as the code of resource
Check procedure in the request exists in DB
in case of error return - 422 (not found)
Check if resource from granted_to = 'employee':
in case of error return - 422 ("$.resource. value is not allowed in enum")
...
if diagnoses_group block is presented in request
Check diagnoses_group in the request exists and is_active in DB
in case of error return - 404 (not found)
Check if resource from granted_to = 'employee':
in case of error return - 422 ("$.resource. value is not allowed in enum")
Validate service_group
if service_group block is presented in request
Check services_group in the request exists and is_active in DB
in case of error return - 404 (not found)
Check if resource from granted_to = 'employee':
in case of error return - 422 ("$.resource. value is not allowed in enum")
Validate patient
if patient block is presented in request
Get patient_id from URL:
Check person_id from the request equal to the patient_id from URL
in case of error return - 404 (“Approval for one patient can not be created in another patient’s context”)
exists and is_active in DB
in case of error return - 404 (Person is not found)
Check if resource from granted_to = 'employee':
in case of error return - 422 ("$.resource. value is not allowed in enum")
...
if child_resource is not empty:
validate that access_level == read
in case of error return - 422 ("$.access_level. value is not allowed in enum")
check that $.child_resource.identifier.value context is equal to $.resource.identifier.value
in case of error return - 422 (Child resource context id is not equal to granted resource id)
validate that service_requests / forbidden_groups / diagnoses_group / patients are not filled
in case of error return - 422 (schema does not allow additional properties)
validate that resources max items = 1
in case of error return - 422 ($.resources.expected a maximum of 1 items but got 2)
Check if resource from granted_to = 'employee':
in case of error return - 422 ("$.resource. value is not allowed in enum")
Validate person authentication_method
if resource = care_plan & care_plans.terms_of_service = 'INPATIENT'&granted_to.employees.legal_entity_id = care_plans.managing_organization:
skip validation of person authentication_method
set approvals.urgent = null
In other cases: Check patient_id:
if belongs to person, then GET auth_method from MPI using {patient_id}
If it's OTP:
send SMS to the auth_phone via otp_verification service POST /verifications
save approval to DB
save authentication_method_current.type and number to DB
return authentication_method_current.type = OTP
If it is offline
save approval to DB
save authentication_method_current.type and number to DB
return authentication_method_current.type = offline
if it is null:
return error 409 (Person does not have active authentication method)
if belongs to preperson:
save approval to DB
set approval status = active
set approval urgent = null
...
block | granted_resources | context | access_level | access to | reason |
---|---|---|---|---|---|
resources | episode_of_care | read | Reading all the data of specified in approval episode | null | |
diagnostic_report | read | Reading all the data of specified in approval diagnostic report | null | ||
diagnostic_report | write | Canceling diagnostic report package | |||
care_plan | read | Reading all the data of specified in approval care plan | null | ||
care_plan | write | Creating activities for care plan, cancelling medication requests or recalling/cancelling service requests based on care plan | |||
encounter | write | Canceling encounter data package | null | ||
procedure | write | Canceling procedure | null | ||
child_resources | diagnostic_report | episode_of_care | read | Reading all the data of specified in context for diagnostic_report | null |
encounter | episode_of_care | Reading all the data of specified in context for encounter | null | ||
condition | episode_of_care | Reading all the data of specified in context for condition | null | ||
observation | episode_of_care diagnostic_report | Reading all the data of specified in context for observation | null | ||
activity | care_plan | Reading all the data of specified in context for activity | null | ||
clinical_impression | episode_of_care | Reading all the data of specified in context for clinical_impression | null | ||
allergy_intolerance | episode_of_care | Reading all the data of specified in context for allergy_intolerance | null | ||
immunization | episode_of_care | Reading all the data of specified in context for immunization | null | ||
device | episode_of_care | Reading all the data of specified in context for device | null | ||
risk_assessment | episode_of_care | Reading all the data of specified in context for risk_assessment | null | ||
procedure | episode_of_care | Reading all the data of specified in context for procedure | null | ||
service_request | episode_of_care | read | Reading data from granted_resources in approval service request | service_request | |
diagnostic_report | read | ||||
forbidden_group | forbidden_group | read | Reading all the medical events with items (codes/services/service_groups) of specified in approval forbidden groups | null | |
diagnoses_group | episode_of_care array | read | Reading all data of episodes with current_diagnoses.codes that specified in approval diagnoses group | null | |
services_group | diagnostic_reports and procedures array | read | Reading all data of diagnostic reports and procedures with code.identifier.value that specified in approval service group | null | |
patient_id | patient_id | read | Reading all the data of specified patient | null |
...
All the approvals in status "new" should be deleted 12 hours after creation - env. configuration parameter
All approvals with service_group has its own expires_at config parameter - env. configuration parameter
All approvals with diagnoses_group has its own expires_at config parameter - env. configuration parameter
All approvals with forbidden_group has its own expires_at config parameter - env. configuration parameter
All approvals with care_plan has its own expires_at config parameter - env. configuration parameter
All approvals with patient has its own expires_at config parameter - env. configuration parameter
Approvals with child_resources will be created ON entity which is context of this child_resources
For approvals on child_resource with resource and on service_request:
set child resource to block reason
set service_request to block reason
If resource from granted_to = employee:
Check if for granted_resource and\or for reason there are forbidden groups:if there are items from forbidden group
check type of authentication_method for patient
If type = 'OTP' send SMS (Код <code> для доступу до даних про ВІЛ/РПП https://bit.ly/nszu1677f )
if there NO forbidden group items and diagnoses_group block is presented in request
if diagnoses_group type is ICD10:
check type of authentication_method for patient
If type = 'OTP' send SMS (Код <code>: доступ на групу діагнозів {diagnoses_group_code} http://bit.ly/nszu1677b )
if diagnoses_group type is ICPC2:
check type of authentication_method for patient
If type = 'OTP' send SMS (Код <code> доступ на групу діагнозів {diagnoses_group_code} http://bit.ly/nszu1677e )
if there NO forbidden group items and service_group block is presented in request
check type of authentication_method for patient
If type = 'OTP' send SMS (Код ****: доступ на групу сервісів {service_group_code} eHealth )
else if there NO forbidden group items
check type of authentication_method for patient
If type = 'OTP' send SMS (Код авторизації дій в системі eHealth: <code>')
If resource from granted_to = legal_entity:
check type of authentication_method for patient
If type = 'OTP' send SMS (Код <code>: згода на обробку персональних даних eZdorovya )
...