def unlock( self, uuid, ): """Unlock. :param uuid: Id of the radreport """ request_data = { 'uuid': uuid, } errors_mapping = {} errors_mapping[('ALREADY', None)] = Already('This report is not locked') errors_mapping[('LOCKED', None)] = Locked( 'This radreport is locked at the moment by another user. error_subtype=RADREPORT_LOCKED. error_data={"locked_radreport_id":radreport_uuid,"locked_user_id":user_uuid}.' ) errors_mapping[('MISSING_FIELDS', None)] = MissingFields( 'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields' ) errors_mapping[('NOT_FOUND', None)] = NotFound('The radreport was not found.') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted( 'You are not permitted to lock the radreport') query_data = { 'api': self._api, 'url': '/radreport/unlock', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def delete( self, uuid, ): """Delete. :param uuid: Id of the radreport """ request_data = { 'uuid': uuid, } errors_mapping = {} errors_mapping[('LOCKED', None)] = Locked( 'Only if account.settings.enable_radreport_lock_reading is set. This radreport is locked at the moment, should be unlocked before. error_subtype=RADREPORT_LOCKED. error_data={"locked_radreport_id":radreport_uuid,"locked_user_id":user_uuid}.' ) errors_mapping[('MISSING_FIELDS', None)] = MissingFields( 'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields' ) errors_mapping[('NOT_FOUND', None)] = NotFound('The radreport was not found.') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted( 'You are not permitted to delete the radreport') query_data = { 'api': self._api, 'url': '/radreport/delete', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def set( self, uuid, assigned_admin_id=None, assigned_medical_id=None, case_status=None, closed=None, completed=None, customfield_param=None, name=None, submitted=None, ): """Set. :param uuid: The case uuid :param assigned_admin_id: Id of the admin user assigned to the case (optional) :param assigned_medical_id: Id of the medical user assigned to the case (optional) :param case_status: The case status (optional) :param closed: Flag if the case is closed (optional) :param completed: Flag if the case is completed (optional) :param customfield_param: Custom field(s) (optional) :param name: case name (optional) :param submitted: Flag if the case is submitted (optional) Notes: The rest of the fields can not be set by the case owner """ request_data = { 'case_status': case_status, 'uuid': uuid, 'name': name, 'submitted': submitted, 'closed': closed, 'assigned_admin_id': assigned_admin_id, 'completed': completed, 'assigned_medical_id': assigned_medical_id, } if customfield_param is not None: customfield_param_dict = {'{prefix}{k}'.format(prefix='customfield-', k=k): v for k,v in customfield_param.items()} request_data.update(customfield_param_dict) errors_mapping = {} errors_mapping['INVALID_CASE_STATUS'] = InvalidCaseStatus('Invalid case status') errors_mapping['INVALID_CUSTOMFIELD'] = InvalidCustomfield('Invalid custom field(s) name or value were passed. The error_subtype holds an array of the error details') errors_mapping['LOCKED'] = Locked('The case is locked by another user') errors_mapping['NOT_FOUND'] = NotFound('The case or assigned user can not be found') errors_mapping['NOT_IN_ACCOUNT'] = NotInAccount('The assigned user is not in the account') errors_mapping['NOT_PERMITTED'] = NotPermitted('You are not permitted to edit the case') query_data = { 'api': self._api, 'url': '/case/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def set( self, uuid, attachment=None, fields=None, ): """Set. :param uuid: Id of the radreport :param attachment: A JSON hash of the storage attachment information (optional) :param fields: A JSON hash of the fields in the report (optional) """ request_data = { 'attachment': attachment, 'fields': fields, 'uuid': uuid, } errors_mapping = {} errors_mapping[('INVALID_JSON', None)] = InvalidJson( 'The field is not in valid JSON format. The error_subtype holds the name of the field' ) errors_mapping[('LOCKED', None)] = Locked( 'Only if account.settings.enable_radreport_lock_reading is set. This radreport is locked by another sid. error_subtype=RADREPORT_LOCKED. error_data={"locked_radreport_id":radreport_uuid,"locked_user_id":user_uuid}.' ) errors_mapping[('MISSING_FIELDS', None)] = MissingFields( 'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields' ) errors_mapping[('NOT_FOUND', None)] = NotFound('The study was not found.') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted( 'You are not permitted to add a radreport to the study') query_data = { 'api': self._api, 'url': '/radreport/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def add( self, study_id, type, fields=None, ): """Add. :param study_id: Id of the study to add the radreport to :param type: The type of the radreport :param fields: A JSON hash of the fields in the report (optional) """ request_data = { 'fields': fields, 'study_id': study_id, 'type': type, } errors_mapping = {} errors_mapping[('INVALID_JSON', None)] = InvalidJson( 'The field is not in valid JSON format. The error_subtype holds the name of the field' ) errors_mapping[('LOCKED', None)] = Locked( 'Only if account.settings.enable_radreport_lock_reading is set. There is another locked radreport for the study. error_subtype=RADREPORT_LOCKED. error_data={"locked_radreport_id":radreport_uuid,"locked_user_id":user_uuid}.' ) errors_mapping[('MISSING_FIELDS', None)] = MissingFields( 'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields' ) errors_mapping[('NOT_FOUND', None)] = NotFound('The study was not found.') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted( 'You are not permitted to add a radreport to the study') query_data = { 'api': self._api, 'url': '/radreport/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)