Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel3

Purpose

...

API paragraph not found

Specification

...

Page Properties

Link

https://medicaleventsmisapi.docs.apiary.io/#reference/medical-events/diagnostic-report-data-package/submit-diagnostic-report-package

Resource

/api/patients/{{id}}/diagnostic_report_package

Scope

diagnostic_report:write

Components

Diagnostic Report Data Package

Microservices

API paragraph not found

Protocol type

REST

Request type

POST

Sync/Async

Async

Public/Private/Internal

Public

Logic

...

API paragraph not found

Request structure

...

See on Apiary

Example:

Expand
titleRequest example
Code Block
{
  "signed_data": "'ew0KICAicGVyaW9kIjogew0KIC...'"
}

Authorize

...

  1. Verify the validity of access token

    1. in case of error return 401 ('Access denied')

  2. Check user scope diagnostic diagnostic_report:write write in order to perform this action

    1. in case of error generate 403 response ('Invalid scopes')

Request to process the request using a token in the headers

Headers

...

Наприклад:

  • Content-Type:application/json

  • Authorization:Bearer mF_9.B5f-4.1JqM

Request data validation

...

Request validation

DS validation

...

  1. Validate observations ids as  primary keys (Primarykeyvalidation)

  2. Validate that diagnostic_report of ALL observation is a current DR

    1. $.observations[*].diagnostic_report.identifier.value==$.diagnostic_report.id

      1. in case of error return "Submitted diagnostic report is not allowed for the observation"

  3. $.observations[*].effective_period validate as Period PeriodValidation

  4. Validate that the date is within acceptable limits

    1. $.observations[*].issued <= current_time

      1. in case of error return "Issued date must be in past"

    2. $.observations[*].issued>=current_date-observation_max_days_passed

      1. in case of error "Issued must be greater than  {{current_date-observation_max_days_passed}}"

  5. Validate performer  as Employeevalidation

  6. Validate $.observations[*].value_period as a Period

  7. Validate component

    1. $.observations[*].components[*].value_period as a Period

  8. Related care plan validation

    1. in 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 quantity

      1. calculate 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 zero

        1. in case of error return 409 "The total amount of the prescribed service quantity exceeds quantity in care plan activity"

  9. Validate $.observations.code

    1. if observations.code.coding[*].code value is included in chart variables 'OBSERVATION_CODES_WITH_<VALUE_TYPE>_REQUIRED', <value_type> field is mandatory

      1.  in case of error return 422 “This field is required for code = <code>“

Processing

...

API paragraph not found

Response structure

...

See on Apiary

Example:

Expand
titleResponse example
Code Block
{
  "data": {
    "status": "pending",
    "eta": "2018-08-02T10:45:16.000Z",
    "links": [
      {
        "entity": "job",
        "href": "/Jobs/NBXk9EyErUZv1RhXgyvgg"
      }
    ]
  },
  "meta": {
    "code": 202,
    "url": "http://example.com/resource",
    "type": "object",
    "request_id": "req-adasdoijasdojsda"
  }
}

Expand
titleResponse example
Code Block
{
  "meta": {
    "code": 404,
    "url": "http://example.com/resource",
    "type": "object",
    "request_id": "req-adasdoijasdojsda"
  },
  "error": {
    "type": "NOT_FOUND",
    "message": "Patient not found"
  }
}

Post-processing processes

...

Set managing_organization for submitted observations

  1. ME.conditions{cond_id}.managing_organization=token.client_id.

  2. 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

  3. Update $ .activity.status to in_progress if previous activity status was scheduled

  4. Update the $ .activity.remaining_quantity parameter by subtracting the quantity of artifacts that have a reference on service request that contains an $.based_on.[]activity

HTTP status codes

...

Page Properties

HTTP status code

Message

What caused the error

 202

 

 

 404

 

 

...