Versions Compared

Key

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

...

  1. Verify the validity of access token

    1. Return (401, 'Invalid access token') in case of validation fails

  2. Verify that token is not expired

    1. in case of error - return (401, 'Invalid access token')

  3. Check user scopes in order to perform this action (scope = 'care_plan:write')

    1. Return (403, 'Your scope does not allow to access this resource. Missing allowances: care_plan:write') in case of invalid scope(s)

Headers

Наприклад:

Content-Type:application/json
Authorization:Bearer {{access_token}}
API-key:{{mis_client_secret}}

...

  1. Extract user_id from token.

  2. Check user has an active and approved employee from legal entity (token) that:

    1. has an active Approval granted by the Patient on write the Care plan resource (care plan id from URL)

      1. Return 403 ('Access denied') in case employee has no Approval on write

  3. Check user's employee is from the same legal entity (token) as managing_organisation from the care_plan:

    1. Return 422 ('User is not allowed to create care plan activity for this care plan') in case employee’s legal_entity do not match managing_organisation of related care_plan

Validate activity

  1. Activity should be validated. User fills following fields in the activity:

...

  1. Check that value is an array with references of condition, observation, diagnostic report, clinical impression types.

    1. in case of error - return 422 ('value is not allowed in enum')

  2. Check that each reference:

    1. is valid ME

    2. belongs to the patient ($.subject)

      1. in case of error - return 422 ('<medical event type> with such ID is not found')

  3. If $.detail.reason_reference=clinical_impression:

    1. Check that clinical impression is valid based on clinical_impression.code.coding.code and CLINICAL_IMPRESSION_PATIENT_CATEGORIES_<CODE.VALUE>_VALIDITY_PERIOD chart parameter: difference between now() and $.clinical_impression.effective_date_time OR $.clinical_impression.effective_period.end date must be less than a value in chart parameter (pointed in config for a corresponding care plan category) for clinical impression code

      1. in case of error - return 422 ("Clinical impression with patient category exceeds validity period")

    2. Check that clinical impression is based on active rule engine rule (exists record in rule_engine_rules collection with is_active=true, code.code=clinical_impression.code.coding.code, code.system=clinical_impression.code.coding.system)

      1. if true - check that clinical impression still corresponds to configured rule

        1. in case of error - return 422 (“Clinical impression with patient category does not correspond to rule engine rule“)

      2. if false - skip rule validation

5. Goal

Validate value in the field $.detail.goal, if submitted

...

Validate value in the field $.detail.quantity, if submitted

  1. Check $.detail.quantity.value is not empty, is fractional, greater than zero

    1. Return 422 schema validation error

...

  1. If $.detail.kind=medication_request:

    1. Check (by schemata) the $.detail.quantity.system field’s value is MEDICATION_UNIT.

      1. Return 422 ('value is not allowed in enum')

    2. Check the $.detail.quantity.code field’s value equals to dosage.denumerator_unit of one of INNMs of a INNM_DOSAGE where innms with is_primary = true

      1. Return 422 ('Code field of quantity object should be equal to denumerator_unit of one of medication’s innms')

  2. If $.detail.kind is other than medication_request:

    1. Check the $.detail.quantity.system field is not present.

      1. Return 422 ('System field of quantity object is not allowed for kind other than medication_request')

    2. Check the $.detail.quantity.code field is not present.

      1. Return 422 ('Code field of quantity object is not allowed for kind other than medication_request')

  3. If $.detail.kind=service_request:

    1. Check that $.detail.quantity.system field’s value is SERVICE_UNIT, if submitted.

      1. Return 422 ('value is not allowed in enum')

    2. If care plan category is class_23, class_24 or class_25:

      1. Check $.detail.quantity.system and $.detail.quantity.code are set, $.detail.quantity.code = MINUTE

        1. Return 422 ('Code field of quantity object should be in MINUTE for care plan’s category <category code>')

7. Scheduled

  1. If submitted, validate there is one of the $.detail.scheduled_[x] field: scheduled_timing, scheduled_period or scheduled_string.

    1. Return 422 ('Only one of the parameters must be present') in case more then one submitted

Validate value in scheduled_timing, if submitted:

...

  1. Check the value is valid reference o employee resource

  2. Check employee is active and approved

    1. Return 422 ('Invalid employee status')

10. Daily amount

  1. If submitted, check $.detail.daily_amount has the same code and system as quantity field.

    1. Return 422 ('Units of daily_amount field should be equal to units of quantity field')

  2. Validate value in the field $.detail.daily_amount, if submitted.

  3. Check activity kind is medication_request

    1. Return 422 ('Field is allowed for medication request activities only') in case kind is not medication_request

  4. Validate $.detail.daily_amount.system, $.detail.daily_amount.code fields and their values in the object $.detail.daily_amount

  5. If $.detail.kind=medication_request:

    1. Check (by schemata) the $.detail.daily_amount.system field’s value is MEDICATION_UNIT.

      1. Return 422 ('value is not allowed in enum')

    2. Check the $.detail.daily_amount.code field’s value equals to dosage.denumerator_unit of one of INNMs of a INNM_DOSAGE where innms with is_primary = true

      1. Return 422 ('Code field of daily_amount object should be equal to denumerator_unit of one of medication’s innms')

  6. If $.detail.kind is other than medication_request:

    1. Check the $.detail.daily_amount.system field is not present.

      1. Return 422 ('System field of daily_amount object is not allowed for kind other than medication_request')

    2. Check the $.detail.daily_amount.code field is not present.

      1. Return 422 ('Code field of daily_amount object is not allowed for kind other than medication_request')

11. Do not perform flag

Validate value in the field $.do_not_perform

...

Page Properties

HTTP status code

Message

What caused the error

200

  • Medication is not included in the program

  • Service is not included in the program

  • Service group is not included in the program

  • Author’s specialty doesn't allow to create activity with medical program from request

  • Care plan diagnosis is not allowed for the medical program

  • Care plan’s terms of service are not allowed for the medical program

  • Clinical impression with patient category should be present in request for this medical program

 Programs validation error

401

Invalid access token

  • validation fails

  • token is expired

403

  • Your scope does not allow to access this resource. Missing allowances: care_plan:write

  • Access denied

  • invalid scope(s)

409

  • client_id refers to legal entity that is not active

  • client_id refers to legal entity with type that is not allowed to create medical events transactions

  • Person is not active

  • Patient is not verified

  • Care Plan from url does not match to Care Plan ID specified in body

Validation error

422

  • Care plan with such id is not found

  • Invalid care plan status

  • Care Plan end date is expired

  • User is not allowed to create care plan activity for the employee

  • Value is not allowed in enum

  • Cannot refer to service for kind = medication_request

  • Medication should be active

  • Medication does not exist

  • Another activity with status ‘scheduled' or ‘in_progress' already exists in the current Care plan

  • Cannot refer to medication for kind = service_request

  • <Service/Service group> should be active

  • Another activity with status ‘scheduled' or ‘in_progress' already exists in the current Care plan

  • <medical event type> with such ID is not found

  • Clinical impression with patient category does not correspond to rule engine rule

  • Code field of quantity object should be equal to denumerator_unit of one of medication’s innms

  • System field of quantity object is not allowed for kind other than medication_request

  • Code field of quantity object is not allowed for kind other than medication_request

  • Only one of the parameters must be present

  • Event is not within care plan period range

  • Period end time must be within care plan period range, after period start date

  • Period start time must be within care plan period range

  • Bounds duration must be within care plan period range

  • Low must be within care plan period range, less than high, have the same code as high

  • High must be within care plan period range

  • String does not match pattern

  • Division is not active

  • Invalid employee status

  • Field is allowed for medication request activities only

  • Code field of daily_amount object should be equal to denumerator_unit of one of medication’s innms

  • System field of daily_amount object is not allowed for kind other than medication_request

  • Code field of daily_amount object is not allowed for kind other than medication_request

  • Program not found

  • Forbidden to create care plan activity for this medication!

  • Clinical impression with patient category exceeds validity period

  • User is not allowed to create care plan activity for this care plan

  • Code field of quantity object should be in MINUTE for care plan’s category <category code>

  • Units of daily_amount field should be equal to units of quantity field

Validation error