...
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 ('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 datemax 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')
...