Table of Contents | ||||
---|---|---|---|---|
|
...
Page Properties | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Logic
...
Save signed content to media storage
...
Save data to care_plan_activities collection in DB according to Care plan data model
for kind = medication_request
add
unit
(and its value) field intoquantity
,daily_amount
, objects based onsystem
,code
out of MEDICATION_UNIT dictionary.add
system
,code
,unit
fields intoremaining_quantity
based onquantity
object
...
Save link from media storage to the $.signed_content_links field in care plan activities collection
...
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)
...
This method adds activity to an existing patient's Care Plan. Method receives signed message (pkcs7) that consists of signed content, digital signature and signer public key. All signature fields will be validated (including signer certificate authority). Service will store signed copy of Care Plan activity in Media Content Storage if all checks is passed.
It can be processed in both sync and async methods depends on Server decision.
Key points
One request can add only one activity to the Care plan
Activity can be added by the employee who has Approval granted by the patient on write Care plan resource
Activity adds in async way. The result of the activity addition job should be link on the created activity (look at Get Care plan activity by ID).
Activity should be signed with DS. Signed content stores in the media storage.
...
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 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.CODING.CODE>_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
...
Validate value in the field $.do_not_perform
...
_not_perform
Check it is
false
in case of error - return 422 ('not allowed in enum')
13. Status
Validate value in the field $.status
Check it has value = scheduled
in case of error - return 422 ('value is not allowed in enum')
13. Status
Validate value in the field $.status
Check it has value = scheduled
in case of error - return 422 ('value is not allowed in enum')
Processing
...
Processing
Save signed content to media storage
Save data to care_plan_activities collection in DB according to Care plan data model
for kind = medication_request
add
unit
(and its value) field intoquantity
,daily_amount
, objects based onsystem
,code
out of MEDICATION_UNIT dictionary.add
system
,code
,unit
fields intoremaining_quantity
based onquantity
object
Save link from media storage to the $.signed_content_links field in care plan activities collection
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)
Create job and return it’s id.
Response structure
See on Apiary
...
Page Properties | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...