Table of Contents | ||||
---|---|---|---|---|
|
...
Specification
Page Properties | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
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}}
...
Extract user_id from token.
Check user has an active and approved employee from legal entity (token) that:
has an active Approval granted by the Patient on write the Care plan resource (care plan id from URL)
Return 403 ('Access denied') in case employee has no Approval on write
Check user's employee is from the same legal entity (token) as managing_organisation from the care_plan:
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
Activity should be validated. User fills following fields in the activity:
...
Check value in enum: medication_request, service_request
Return 422 ('value is not allowed in enum')
2. Product
Validate value in the field Check there is one of the required $.detail.product_reference, required[x] field is set: product_reference or product_codeable_concept.
Return 422 ('Only one of the parameters must be present') in case more then one submitted
Validate value in the field $.detail.product_reference, required
If $detail.kind=medication_request:
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')
Check the value is valid reference on medication resource.
Return 422 ('Cannot refer to service <resource> for kind = medication_request')
Check medication:
is active
in case of error - return 422 ('Medication should be active')
type is INNM_DOSAGE
in case of error - return 422 ('Medication does not exist')
Check there is no duplicated activities (status=scheduled, in_progress) with the same medication in the Care plan
Return 422 (“Another activity with status ‘scheduled' or ‘in_progress' already exists in the current Care plan”)
If $.detail.kind=service_request:
Check that value is a reference $.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')
Check that value is a reference on service or service_group
Return 422 ('Cannot refer to medication <resource> for kind = service_request')
Check service or service_group is active
Return 422 ('<Service/Service group> should be active')
Check there is no activities (status=scheduled, in_progress) with the same service or service_group in the Care plan
Return 422 (“Another activity with status ‘scheduled' or ‘in_progress' already exists in the current Care plan“)
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 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 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
Return 422 (“Another activity with status ‘scheduled' or ‘in_progress' already exists in the current Care plan within current program value“)
3. Reason code
Validate value in the field $.detail.reason_code, if submitted
...
Check that value is an array with references of condition, observation, diagnostic report, 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 rulein 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
...
Validate value in the field $.detail.quantity, if submitted
Check $.detail.quantity.value is not empty, is fractional, greater than zero
Return 422 schema validation error
...
If $.detail.kind=medication_request:
Check (by schemata) the $.detail.quantity.system field’s value is MEDICATION_UNIT.
Return 422 ('value is not allowed in enum')
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
Return 422 ('Code field of quantity object should be equal to denumerator_unit of one of medication’s innms')
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
Return 422 ('Code field of quantity object should be equal to denumerator_unit of one of medication’s innms')
If $.detail.kind=service_request:
Check that $.detail.quantity.system field’s value is SERVICE_UNIT, if submitted.
Return 422 ('value is not allowed in enum')
If care plan category is class_23, class_24 or class_25:
Check $.detail.quantity.system and $.detail.quantity.code are set, $.detail.quantity.code = MINUTE
Return 422 ('Code field of quantity object should be in MINUTE for care plan’s category <category code>')
...
Check the value is valid reference o employee resource
Check employee is active and approved
Return 422 ('Invalid employee status')
10. Daily amount
If submitted, check $.detail.daily_amount has the same code and system as quantity field.
Return 422 ('Units of daily_amount field should be equal to units of quantity field')
Validate value in the field $.detail.daily_amount, if submitted.Check activity kind is medication_requestReturn 422 ('Field is allowed for medication request activities only') in case kind is not medication_request
Validate $.detail.daily_amount.system, $.detail.daily_amount.code fields and their values in the object $.detail.daily_amountIf $.detail.kind=medication_request:Check (by schemata) the $.detail.daily_amount.system field’s value is MEDICATION_UNIT.Return 422 ('value is not allowed in enum')
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 = trueReturn 422 ('Code field ofdaily_amountobject should be equal to denumerator_unit of one of medication’s innms')
If $.detail.kind is other than medication_request:Check the $.detail.daily_amount.system field is not present.Return 422 ('System field ofdaily_amountobject is not allowed for kind other than medication_request')
Check the $.detail.daily_amount.code field is not present.Return 422 ('Code field ofdaily_amountobject is not allowed for kind other than medication_request')
11. Do not perform flag
Validate value in the field $.do_not_perform
...
Page Properties | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|