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
...
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.CODING.CODE>_VALIDITY_PERIOD chart parameter: difference between now() and clinical_impression.inserted_at 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
...
Validate value in the field $.detail.quantity, if submitted
Check $.detail.quantity.value is not empty, is integer, greater than zero
Return 422 schema validation error
Validate $.detail.quantity.system, $.detail.quantity.code and their values in the object $.detail.quantity
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')
If $.detail.kind is other than medication_request:
Check the $.detail.quantity.system field is not present.
Return 422 ('System field of quantity object is not allowed for kind other than medication_request')
Check the $.detail.quantity.code field is not present.
Return 422 ('Code field of quantity object is not allowed for kind other than medication_request')
7. Scheduled
If submitted, validate there is one of the $.detail.scheduled_[x] field: scheduled_timing, scheduled_period or scheduled_string.
...
Check activity kind is medication_request
Return 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_amount
If $.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 = true
Return 422 ('Code field of daily_amount object 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 of daily_amount object is not allowed for kind other than medication_request')
Check the $.detail.daily_amount.code field is not present.
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
...
Сheck program exists and active
in case not found or is_active==false return 422 '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 200 with
status
= INVALID andrejection_reason
"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 200 with
status
= INVALID andrejection_reason
"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 200 with
status
= INVALID andrejection_reason
"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 200 with
status
= INVALID andrejection_reason
“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 200 with
status
= INVALID andrejection_reason
“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 parameterin case of error - return 200 with
status
= INVALID andrejection_reason
“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.[].codethat correspond to codes pointed in patient_categories_allowed
in case of error return 200 with
status
= INVALID withrejection_reason
("Clinical impression with patient category should be present in request for this medical program")
...