Table of Contents | ||||
---|---|---|---|---|
|
...
Request to process the request using a token in the headers
Headers
Наприклад:
Content-Type:application/json
Authorization:Bearer mF_9.B5f-4.1JqM
...
Validate diagnostic_report _id is unique for MongoDB.Diagnostic_reports
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 "None of the diagnostic report categories matches with the service category"
Validate that service, referenced as a code in DR, is active
Note. For diagnostic_report.code pass only "service", and the "service_group" does not passPRM.services.is_active = true where PRM.services.id=$.diagnostic_report.code.identifier.value
in case of errror return 422 "Service is not active"
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 referrals
As a referral it can be referenced electronic (registered in the system) OR paper service request
Validate ($.diagnostic_report.based_on OR $.diagnostic_report.paper_referral) or none in request
Validate based on as Reference
Validate paper referral as Object (paper_referral)
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"
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 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 Submit Encounter Data Package: Related service request validation
Validate effective_period as a period (PeriodValidation)
Validate that issued is within acceptable limits
$.diagnostic_reports[*].issued<= current date_time
in case of error 422 "Issued 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 recorded_by as Employee:
recorded_by employee_types allowed: DOCTOR, SPECIALIST, ASSISTANT, LABORANT
in case of error 422 "Invalid employee type"
Validate performer.identifier as Employee:
check that performer.identifier field is mandatory and employee_types allowed: DOCTOR, SPECIALIST, ASSISTANT, LABORANT
in case of error 422 "Invalid employee type"
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 results_interpreter.identifier as Employee:
if the category.coding.code is in (
imaging
,diagnostic_procedure
) check that results_interpreter.identifier is an employee with employee_type = DOCTOR or SPECIALISTin case of error 422 "Invalid employee type"
if the category.coding.code is in (
diagnostic_curative
,laboratory_procedure
) - results_interpreter field is optional and the results_interpreter.identifier validation skipped
Validate only One of the fields is filled:
$.diagnostic_report[*].results_interpreter.reference OR $.diagnostic_report[*].results_interpreter.text
Validate division
Validate division as Reference(Referencevalidation)
$division is an existing ID in PRM.divisions
in case return 422, "Division with such id is not found"
division.status=ACTIVE and is_active=true
in case error return 409, "Division is not active"
division.legal_entity_id = $client_id
in case error return 409, "Division is not in current legal_entity"
Patient must be active
check that patients.status == active
in case patients.status == inactive
check mpi.persons(or mpi.prepersons if patients.preperson == true).updated_at and validate that now() - updated_at<=SUBMIT_DIAGNOSTIC_REPORT_PACKAGE_ALLOWED_PERIOD_MINUTES configuration (in minutes)
in case of error return 409 (Person is not active more that the allowed time for data submitting)
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 patient
check that patients.status == active
in case of error return 409 (Person is not active)
...
Validate observations ids as primary keys (Primarykeyvalidation)
Validate that diagnostic_report of ALL observation is a current DR
$.observations[*].diagnostic_report.identifier.value==$.diagnostic_report.id
in case of error return "Submitted diagnostic report is not allowed for the observation"
$.observations[*].effective_period validate as PeriodValidation
Validate that the date is within acceptable limits
$.observations[*].issued <= current_time
in case of error return "Issued date must be in past"
$.observations[*].issued>=current_date-observation_max_days_passed
in case of error "Issued must be greater than {{current_date-observation_max_days_passed}}"
Validate performer as Employee:
performer employee_types allowed: DOCTOR, SPECIALIST, ASSISTANT, LABORANT
in case of error 422 "Invalid employee type"
Validate $.observations[*].value_period as a Period
Validate components
if $.observations[*].code.coding[*].system is "eHealth/ICF/classifiers":
Check number of component items with $.observations[*].components[*].code.coding[*].system = "eHealth/ICF/qualifiers":
if $.observations[*].code.coding[*].code starts from "b" letter, then components must contain exact 1 item with:
$.observations[*].components[*].code.coding[*].code = "extent_or_magnitude_of_impairment"
in case of missing qualifier - return 422 "Missing components with qualifiers <list of missing qualifiers>"
in case of incorrect number of qualifiers - return 422 "Required 1 component, but got <number of items>"
in case value is not active in dictionary - return 422 "Value is not active"
if $.observations[*].code.coding[*].code starts from "s" letter, then components must contain exact 3 items with:
$.observations[*].components[*].code.coding[*].code = "extent_or_magnitude_of_impairment"
$.observations[*].components[*].code.coding[*].code = "nature_of_change_in_body_structure"
$.observations[*].components[*].code.coding[*].code = "anatomical_localization"
in case of missing qualifier - return 422 "Missing components with qualifiers <list of missing qualifiers>"
in case of incorrect number of qualifiers - return 422 "Required 3 components, but got <number of items>"
in case value is not active in dictionary - return 422 "Value is not active"
if $.observations[*].code.coding[*].code starts from "d" letter, then components must contain exact 2 items with:
$.observations[*].components[*].code.coding[*].code = "performance"
$.observations[*].components[*].code.coding[*].code = "capacity"
in case of missing qualifier - return 422 "Missing components with qualifiers <list of missing qualifiers>"
in case of incorrect number of qualifiers - return 422 "Required 2 components, but got <number of items>"
in case value is not active in dictionary - return 422 "Value is not active"
if $.observations[*].code.coding[*].code starts from "e" letter, then components must contain exact 1 item with:
$.observations[*].components[*].code.coding[*].code = "barrier_or_facilitator"
in case of missing qualifier - return 422 "Missing components with qualifiers <list of missing qualifiers>"
in case of incorrect number of qualifiers - return 422 "Required 1 component, but got <number of items>"
in case value is not active in dictionary - return 422 "Value is not active"
Check $.observations[*].components[*].value_codeable_concept is present in each item with $.observations[*].components[*].code.coding[*].system = "eHealth/ICF/qualifiers" and $.observations[*].components[*].value_codeable_concept.coding[*].system corresponds to $.observations[*].components[*].code.coding[*].code
in case not present or doesn't correspond return 422 "Doesn't correspond to $.observations[i].components[i].code"
in case code value is not active in dictionary - return 422 "Value is not active"
$.observations[*].components[*].value_period as a Period
Related care plan validationin case service request has reference on care plan and diagnostic report has reference on service request check possibility to create diagnostic report depending on service_request[].activity remaining quantitycalculate the quantity of artifacts that are contained in the request and have a link to the service request. Compare remaining_quantity from activity with the quantity of artifacts. Check that difference is greater then or equal to zeroin case of error return 409 "The total amount of the prescribed service quantity exceeds quantity in care plan activity"
Validate $.observations.code
if observations.code.coding[*].code value is included in chart variables 'OBSERVATION_CODES_WITH_<VALUE_TYPE>_REQUIRED', <value_type> field is mandatory
in case of error return 422 “This field is required for code = <code>“
if observations[*].code.coding[*].system is "eHealth/ICF/classifiers", then:
Check observations[*].categories[*].coding[*].system should contain "eHealth/ICF/observation_categories"
in case of error return 422 “Code doesn't match observation category“
Check observations[*].components are presented
in case of error return 422 “Components required“
Validate $.observations[*].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>"
$.observations[*].categories[*].coding[*].system is "eHealth/observation_categories" or "eHealth/ICF/observation_categories"
in case of error return 422 "Value is not allowed in enum"
$.observations[*].categories[*].coding[*].code corresponds to the system
in case of error return 422 "Value is not allowed in enum"
If $.observations[*].categories[*].coding[*].system = "eHealth/ICF/observation_categories", then $.observations[*].code should be filled from "eHealth/ICF/classifiers" dictionary.
in case of error return 422 “Code doesn't match observation category“
Processing
API paragraph not found
...
ME.conditions{cond_id}.managing_organization=token.client_id.
in case service request has reference on care plan and diagnostic report.based_on was filled set $.diagnostic_report.id to related to $.service_request $.activity[].outcome_reference
Update $ .activity.status to in_progress if previous activity status was scheduled
Update the $ .activity.remaining_quantity parameter by subtracting the quantity of artifacts that have a reference on service request that contains an $.based_on.[]activityUpdate remaining_quantity in the service request with a value that was calculated in the Related service request validation
HTTP status codes
Page Properties | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...