...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Validate Diagnostic Report
Validate diagnostic reports ids as primary keys
Validate based_on as Reference
Validate that service_request, referenced as based_on, is
in status is
active
or program_processing_status=in_progress (any status is valid in case program_processing_status= in_progress)in case of error return 409 "Invalid service request status"
if program is defined than used_by_legal_entity==token.client_id OR null
in case of error return 409 "Service request is used by another legal_entity"
if program is defined than program_processing_status == new, in_queue or in_progress
check that service_request contains based_on parameter
in case based_on present in service_request
verify care_plan:
It should be in active status
Care plan's period end (if exist) should be greater than current date or equal.
verify activity:
It has activity.detail.kind=service_request; activity.detail.product_reference=service_id.
It has scheduled, in_progress status
in case based_on not present in request skip previous validations.
Check if service request quantity is not exhausted as described at related service request validation
category
Validate $.diagnostic_report[*].categories
is an array with only one item
in case of error return 422 "Expected a maximum of 1 items but got <number of elements>"
Validate that $.diagnostic_report[*].category.coding.code is
eHealth/diagnostic_report_categories
dictionary, requiredin case of error return 422 "value is not allowed in enum"
Validate that diagnostic reports category corresponds to service category, that is references as code in DR
$.diagnostic_report[*].category=PRM.services.category where PRM.services.id=$.diagnostic_report[*].code.identifier.value
in case of error return 422 "Diagnostic report category does not match with the service category"
Validate code
Validate code as Reference
If service_requests.code.identifier.value is service, validate $diagnostic_report.code.identifier.value = service_requests.code.identifier.value
in case error return 409, "Service in diagnostic_report differ from service in service request"
if service_requests.code.identifier.value is service_group, validate $diagnostic_report.code.identifier.value in (SELECT service_id from service_inclusions where service_group_id='service_requests.code.identifier.value')
in case error return 409, "Service in diagnostic_report differ from services in service request's service_group"
Validate diagnostic_report.service.is_active = true
in case error return 409, "Service should be active"
Validate effective_period and effective_date_time:
Check that only one of this parameters present
in case error return 422 "Only one of the parameters must be present"
Validate effective_period as a period
Validate that issued is within acceptable limits
$.diagnostic_reports[*].issued<= current date_time
in case of error 422 "Asserted date must be in past"
$.diagnostic_reports[*].issued>=current_date-diagnostic_report_max_days_passed
in case of error 422 "Issued must be greater than {{current_date-diagnostic_report_max_days_passed}}"
Validate conclusion_code:
$.diagnostic_reports[*].conclusion_code.coding[*].code validate that the code belongs to the dictionary system 'eHealth/ICD10_AM/condition_codes'
in case of error return "Value is not allowed in enum"
Check that there is only one code in conclusion_code.coding array
if more - return error "Only one code from one dictionary is allowed"
Validate recorded_by as Employee
Validate encounter
$.diagnostic_reports[*].encounter.identifier.value == $.encounter.id
in case of error 409 "Invalid reference"
Validate performer:
as Employee
according to logic Performer(asserter) validation
Validate managing_organization is a current legal_entity
$.managing_organization.identifier.value==token.client_id
in case of error 409 "Managing organization does not correspond to user's legal entity."
Validate result_interpreter.identifier as Employee
Validate result_interpreter.identifier is an employee with employee_type = DOCTOR or SPECIALIST
Validate only One of the fields is filled:
$.diagnostic_report[*].results_interpreter.reference OR $.diagnostic_report[*].results_interpreter.text
$.diagnostic_report[*].performer.reference OR $.diagnostic_report[*].performer.text
Validate primary_source
If primary_source==true, then
Managing organization MUST be filled
performer.reference MUST be filled
If primary_source==false, then
report_origin must be filled
performer.reference must NOT be filled
results_enterpreter.reference must NOT be filled
Validate patient verification status:
If diagnostic report has based_on with valid and active service request, then skip this validation.
Else check patient's verification_status is not equal to NOT_VERIFIED.
in case of error return 409, "Patient is not verified"
Validate specimens, if submitted:
Check field has array with elements of Reference type on specimen resource
in case of error return 422 “not allowed in enum”
For each specimen check:
Check it exists in DB or within current package, and belongs to the same patient:
in case of error return 422 "Specimen not found"
Check it is present in the only one diagnostic report within the package.
in case of error return 422 "Specimen is already used in another diagnostic report"
Check status:
is available if the specimen found in the DB
in case of error return 422 "Specimen created before the current package should be available"
is unavailable if the specimen not found in the DB, but in the package