Versions Compared

Key

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

...

  • Verify the validity of access token

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

  • Verify that token is not expired

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

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

    • 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}}

...

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

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

  • Check that each reference:

    • is valid ME

    • belongs to the patient ($.subject)

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

  • If $.detail.reason_reference=clinical_impression:

    • 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

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

    • 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)

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

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

      • if false - skip rule validation

5. Goal

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

...

  • Сheck program exists and active

    • in case not found or is_active==false return 404 "Program not found"

  • Validate product is program participant:

    • If product is medication - validate:

      • that medication has brand that is an active member of the program (program_medications table)

        • in case not found or is_active==false return 422 "Medication is not included in the program"

      • that care_plan_activity_allowed for program medication == true

        • in case ==false return 422 "Forbidden to create care plan activity for this medication!"

    • If product is service - validate that service is an active member of the program

      • in case not found or is_active==false return 422 "Service is not included in the program"

    • if product is service_group - validate that service group is an active member of the program

      • in case not found or is_active==false return 422 "Service group is not included in the program"

  • Validate medical program settings (prm.medical_programs table):

    • if there is a parameter SPECIALITY_TYPES_ALLOWED:

      • Check author’s speciality is present in SPECIALITY_TYPES_ALLOWED

        • in case of error - return 422 “Author’s specialty doesn't allow to create activity with medical program from request”

    • if there is a parameter CONDITIONS_ICD10_AM_ALLOWED or/and CONDITIONS_ICPC2_ALLOWED:

      • Check related Care plan has condition codes in addresses field that correspond to codes pointed in CONDITIONS_ICD10_AM_ALLOWED or/and CONDITIONS_ICPC2_ALLOWED (depending on dictionary - eHealth/ICD10_AM/condition_codes or eHealth/ICPC2/condition_codes)

        • in case of error - return 422 “Care plan diagnosis is not allowed for the medical program“

    • If there is a parameter PROVIDING_CONDITIONS_ALLOWED:

      • Check related Care plan has a value in terms_of_service field that is included in the list of PROVIDING_CONDITIONS_ALLOWED parameter

        • in case of error - return 422 “Care plan’s terms of service are not allowed for the medical program“

    • if there is a parameter patient_categories_allowed:

      • check that patient_categories_allowed has codes in $.detail.reason_reference.[].clinical_impression.code.[].code that correspond to codes pointed in patient_categories_allowed

        • in case of error - return 422 "Clinical impression with patient category should be present in request for this medical program".

...

  1. Save signed content to media storage

  2. Save data to care_plan_activities collection in DB according to Care plan data model

    1. for kind = medication_request

      1. add unit (and its value) field into quantity, daily_amount, objects based on system, code out of MEDICATION_UNIT dictionary.

      2. add system, code, unit fields into remaining_quantity based on quantity object

  3. Save link from media storage to the $.signed_content_links field in care plan activities collection

  4. If Care plan has status = new:

    • Set care plan status = active

    • Check if patient has another active or/and new Care plans with such condition code in the addresses field and the same terms of service:

      • If such Care plans found - set these Care plans statuses to TERMINATED (related activities doesn`t change their status)

  5. Create job and return it’s id.

...

Page Properties

HTTP status code

Message

What caused the error

201

Response

 Sync. Use payload from response

202

Response

 Async: default method. use Get job details to get processing result. Response payload will be returned in the job details

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

  • Signer DRFO doesn't match with requester tax_id

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

422

  • document must be signed by 1 signer but contains 0 signatures

  • Medical program must be submitted for kind = medication_request

  • Activity with such id already exists

  • 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

  • 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

Validation error

...