...
Only authenticated and authorized users with appropriate scope can invoke Create Device Dispense
Device Dispense is created in async way. Successful result of the job should return a link on the created Device Dispense (look at /wiki/spaces/CSI/pages/17467506869 ).
Device Dispense can be created only under active Device Request within valid dispense period
Several devices of different manufacturers with the same code can be dispensed at a time
Multiple dispenses to the same Device Request is not allowed (except for those which has no quantity)
It is allowed to create Device Dispense for not active or not verified persons (for the same reasons as in the medication reimbursement process)
...
Check device (device definition) to be dispensed ($.details.device)
Check code ($.details.device.identifier.type.coding.code) =
device_definition
in case of error - return 422 ('Only device definition value is not allowed for dispensein enum')
Get device definition by id ($.details.device.identifier.value)
device_definition.is_active = true
in case of error - return 422 ('Device definition not found')
Check that this device definition is compliant with prescribed device
If device_request.code is of type Reference
Check that
device_definition_id
in dispense is equal todevice_definition_id
in request
If device_request.code is of type CodeableConcept
Check that
device_definition.classification_type
is equal to prescribed device definition code in device request (device_request.code
)
in case of error - return 422 ('Dispensed device doesn’t match with prescribed device')
Check that packaging_unit matches with quantity.code of the Device Request
in case of error - return 422 (Dispensed packaging unit doesn’t match with prescribed packaging unit)
Check the remainder of the division ($.details.quantity.value/device_definition.packaging_count) is equal to 0
in case of error - return reject_reason = “The quantity must be divisible to packaging_count of prescribed Device Definition”
...
Check program device
Is applicable only if program was passed to request and program device passed to request
Check code ($.details.program_device.identifier.type.coding.code) =
program_device
in case of error - return 422 ('Invalid code. Expected 'program_device''value is not allowed in enum')
Check that program device is active
Check that program device has validity period (start_date and end_date) within current date
in case of error - return 422 ('Program device is not active')
Check that max daily count is not exceeded - max_daily_count is null or max_daily_count >= quantity.value/(occurence_period.end - occurence_period.start) of the Device Request
in case of error - return 422 ('max daily count exceeded')
Check that program device relates to the device definition in $.details.device
in case of error - return 422 ('Program device doesn’t match with device')
Check that program device relates to the program in $.program
in case of error - return 422 ('Program device doesn’t match with program')
if program was passed to request and no program device specified
find program device related to dispensed device definition and selected program with:
active status
validity period (start_date and end_date) within current date
max daily count is not exceeded: max_daily_count is null or max_daily_count >= quantity.value/(occurence_period.end - occurence_period.start) of the Device Request
in case not found - return 422 ('No appropriate participants found for this medical program')
in case found more then one - return 422 ('More than one program_device was found. Specify the required in the request')
Valdate quantity
Perform the validation if Device request has quantity
Validate quantity
Check that dispensed device quantity is equal to prescribed quantity in Device Request
sum($.details.quantity.value) = device_request.quantity
in case of error - return 422 ('Dispensed quantity must be equal to prescribed quantity in Device Request')
...