Versions Compared

Key

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

...

eHealth/activity_remaining_quantity_types

eHealth/activity_kinds

Request structure

See on Apiary

...

  1. Verify the validity of access token

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

  2. Verify that token is not expired

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

  3. 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)

  4. If BLOCK_UNVERIFIED_PARTY_USERS is true, then check party's data match following condition: verification_status != NOT_VERIFIED or (verification_status = NOT_VERIFIED and updated_at <= current_date - UNVERIFIED_PARTY_PERIOD_DAYS_ALLOWED):

    • in case not match - return 403 ("Access denied. Party is not verified")

Headers

Наприклад:

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

...

Validate value in the field $.detail.kind, required

  1. Check value in enum: medication_request, service_request, device_requestthe dictionaryeHealth/activity_kinds

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

...

  1. If $detail.kind=medication_request:

    1. Check $.detail.product_reference field is submitted and has Reference type

      • in case it isn’t submitted - return 422 ('can't be blank')

      • in case of wrong type - return 422 ('type mismatch')

    2. Check the value is valid reference on medication resource.

      1. Return 422 ('Cannot refer to <resource>for kind = medication_request')

    3. Check medication:

      1. is active

        1. in case of error - return 422 ('Medication should be active')

    4. type is INNM_DOSAGE

      1. in case of error - return 422 ('Medication does not exist')

  2. If $.detail.kind=service_request:

    1. Check $.detail.product_reference field is submitted and has Reference type

      • in case it isn’t submitted - return 422 ('can't be blank')

      • in case of wrong type - return 422 ('type mismatch')

    2. Check that value is a reference on service or service_group

      1. Return 422 ('Cannot refer to <resource> for kind = service_request')

    3. Check service or service_group is active

      1. Return 422 ('<Service/Service group> should be active')

  3. If $.detail.kind=device_request:

    • Validate product_reference:

      • Check there value is valid Reference on device_definition resource

        • Return 422 ('Cannot refer to <resource> for kind = device_request')

      • Check the device_definition is active

        • Return 422 ('Device definition is not active')

      • Validate classification types of the device_definition:

        • Check at least one classification type is allowed by dictionary configuration “prescribable_device_codes”

          • in case of error - return 422 ('Value is not allowed by {{dictionary_configuration_name}} dictionary configuration”

        • If one of the classification types has also included in dictionary configuration “assistive_devices”, then check speciality of the author (speciality_officio=true) in the ASSISTIVE_DEVICES_SPECIALITIES_ALLOWED chart parameter

          • in case not found in the chart parameter - return 422 ('Speciality is not allowed for {{dictionary_configuration_name}} dictionary configuration”

    • Validate product_codeable_concept:

      • Check that value matches with active values in device_definition_classification_type dictionary.

        • Return 422 ('value is not allowed in enum')

      • Check that product_codeable_concept.coding[] array contains only 1 element

        • in case of error - return 422 ('Exceeded max count of elements in the array')

      • Check that product_codeable_concept.coding[].code is an active value from the dictionary specified in product_codeable_concept.coding[].system

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

      • Check that value is allowed by dictionary configuration “prescribable_device_codes”

        • in case of error - return 422 ('Value is not allowed by {{dictionary_configuration_name}} dictionary configuration”

      • If value also included in dictionary configuration “assistive_devices”, then check speciality of the author (speciality_officio=true) in the ASSISTIVE_DEVICES_SPECIALITIES_ALLOWED chart parameter

        • in case not found in the chart parameter - return 422 ('Speciality is not allowed for {{dictionary_configuration_name}} dictionary configuration”

    Check there is no another activities (status=scheduled, in_progress) in the Care plan with the same product_reference or product_codeable_concept, and program = $.detail.program (including the equality of program absence/null value)

    • Return 422 (“Another activity with status ‘scheduled' or ‘in_progress' already exists in the current Care plan within current program value“)

...

  1. Сheck program exists and active

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

  2. Validate product is program participant:

    1. If product is medication - validate:

      1. that medication has brand that is an active member of the program (program_medications table) or medication itself is an active member of the program

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

      2. that care_plan_activity_allowed for program medication == true

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

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

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

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

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

    4. If product is code from device_definition_classification_type dictionary (product_codeable_concept was set) or product is device_definition (product_reference was set):

      • Find all program devices with:

        • is_active=true

        • care_plan_activity_allowed = true

        • period (start_date and end_date) that includes current date

        • max_daily_count >= $.quantity.value/($.detail.scheduled_period.end - $.detail.scheduled_period.start + 1). Count scheduled_period length in days, without taking into account time

        • related to the Device Definitions that has successfully passed Quantity and Product validations before

          • in case not found return 422 ('No appropriate participants found for this medical program')

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

    1. if there is a parameter SPECIALITY_TYPES_ALLOWED:

      1. Check author’s speciality is present in SPECIALITY_TYPES_ALLOWED

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

    2. if there is a parameter CONDITIONS_ICD10_AM_ALLOWED or/and CONDITIONS_ICPC2_ALLOWED:

      1. 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)

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

    3. If there is a parameter PROVIDING_CONDITIONS_ALLOWED:

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

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

    4. if there is a parameter patient_categories_allowed:

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

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

    5. if there is parameter device_request_allowed_code_types and activity kind=device_request, then check values in the array of values:

      • if it includes CLASSIFICATION_TYPE - it is allowed to set $.detail.product_codeable_concept in the activity

      • if it includes DEVICE_DEFINITION - it is allowed to set $.detail.product_reference in the activity

        • in case of a mismatch between the filled field and the config values - return 422 ("<Device definition/Device classification type> is not allowed to set 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. add unit (and its value) field into quantity, daily_amount, objects based on system, code out of MEDICATION_UNITor SERVICE_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:

    1. Set care plan status = active

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

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

  5. Set $.details.remaining_quantity_type:

    1. If $.details.kind = medication_request or device_request, then check $.details.quantity:

      1. if $.details.quantity = null then set $.details.remaining_quantity_type = null

      2. if $.details.quantity is not null then:

        1. set $.details.remaining_quantity_type = for_request

    2. If $.details.kind = service_request check $.details.quantity:

      1. if $.details.quantity = null then set $.details.remaining_quantity_type = null

      2. if $.details.quantity is not null then check $.details.quantity.code:

        1. if $.details.quantity.code is not null then set $.details.remaining_quantity_type = for_request

        2. if $.details.quantity.code = null then set $.details.remaining_quantity_type = for_use

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

  • 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