def transform_list( self, account_id, ): """Transform list. :param account_id: The account uuid """ request_data = { 'account_id': account_id, } errors_mapping = {} errors_mapping[('FILTER_NOT_FOUND', None)] = FilterNotFound('The filter can not be found. The error_subtype will hold the filter UUID') errors_mapping[('INVALID_CONDITION', None)] = InvalidCondition('The condition is not support. The error_subtype will hold the filter expression this applies to') errors_mapping[('INVALID_FIELD', None)] = InvalidField('The field is not valid for this object. The error_subtype will hold the filter expression this applies to') errors_mapping[('INVALID_SORT_FIELD', None)] = InvalidSortField('The field is not valid for this object. The error_subtype will hold the field name this applies to') errors_mapping[('INVALID_SORT_ORDER', None)] = InvalidSortOrder('The sort order for the field is invalid. The error_subtype will hold the field name this applies to') 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 account can not be found') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted('You are not permitted to view this list') query_data = { 'api': self._api, 'url': '/hl7/transform/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'transforms' return AsyncQueryOPSF(**query_data)
def template_list( self, account_id, active=None, type=None, ): """Template list. :param account_id: uuid of the account :param active: Limit to active templates (optional) :param type: Limit to this type (optional) """ request_data = { 'active': active, 'account_id': account_id, 'type': type, } errors_mapping = {} errors_mapping['FILTER_NOT_FOUND'] = FilterNotFound('The filter can not be found. The error_subtype will hold the filter UUID') errors_mapping['INVALID_CONDITION'] = InvalidCondition('The condition is not support. The error_subtype will hold the filter expression this applies to') errors_mapping['INVALID_FIELD'] = InvalidField('The field is not valid for this object. The error_subtype will hold the filter expression this applies to') errors_mapping['INVALID_SORT_FIELD'] = InvalidSortField('The field is not valid for this object. The error_subtype will hold the field name this applies to') errors_mapping['INVALID_SORT_ORDER'] = InvalidSortOrder('The sort order for the field is invalid. The error_subtype will hold the field name this applies to') errors_mapping['MISSING_FIELDS'] = 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_PERMITTED'] = NotPermitted('You are not permitted to perform this operation') query_data = { 'api': self._api, 'url': '/radreport/template/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'templates' return QueryOPSF(**query_data)
def public( self, account_id, ): """Public. :param account_id: The account the user is in """ request_data = { 'account_id': account_id, } errors_mapping = {} errors_mapping['FILTER_NOT_FOUND'] = FilterNotFound('The filter can not be found. The error_subtype will hold the filter UUID') errors_mapping['INVALID_CONDITION'] = InvalidCondition('The condition is not support. The error_subtype will hold the filter expression this applies to') errors_mapping['INVALID_FIELD'] = InvalidField('The field is not valid for this object. The error_subtype will hold the filter expression this applies to') errors_mapping['INVALID_FILTER'] = InvalidFilter('Invalid filter field') errors_mapping['INVALID_SORT_FIELD'] = InvalidSortField('The field is not valid for this object. The error_subtype will hold the field name this applies to') errors_mapping['INVALID_SORT_ORDER'] = InvalidSortOrder('The sort order for the field is invalid. The error_subtype will hold the field name this applies to') errors_mapping['MISSING_FIELDS'] = 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'] = NotFound('The node or account can not be found') errors_mapping['NOT_PERMITTED'] = NotPermitted('You are not permitted to do this') query_data = { 'api': self._api, 'url': '/node/public', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'nodes' return QueryOPSF(**query_data)
def progress_list( self, destination_id=None, node_id=None, ): """Progress list. :param destination_id: destination_id :param node_id: node_id Notes: (node_id OR destination_id) - The node or destination id """ request_data = { 'destination_id': destination_id, 'node_id': node_id, } errors_mapping = {} errors_mapping['FILTER_NOT_FOUND'] = FilterNotFound('The filter can not be found. The error_subtype will hold the filter UUID') errors_mapping['INVALID_CONDITION'] = InvalidCondition('The condition is not support. The error_subtype will hold the filter expression this applies to') errors_mapping['INVALID_FIELD'] = InvalidField('The field is not valid for this object. The error_subtype will hold the filter expression this applies to') errors_mapping['INVALID_SORT_FIELD'] = InvalidSortField('The field is not valid for this object. The error_subtype will hold the field name this applies to') errors_mapping['INVALID_SORT_ORDER'] = InvalidSortOrder('The sort order for the field is invalid. The error_subtype will hold the field name this applies to') errors_mapping['MISSING_FIELDS'] = 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'] = NotFound('The node can not be found') errors_mapping['NOT_PERMITTED'] = NotPermitted('You are not permitted to do this') query_data = { 'api': self._api, 'url': '/node/progress/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'progresses' return QueryOPSF(**query_data)
def account( self, account_id, download=None, reverse=None, ): """Account. :param account_id: The id of the account :param download: Flag to create a zipped CSV file. A report_id will be returned and the file can be accessed via /report/status and /report/zip (optional) :param reverse: Flag to reverse the default sort order (optional) """ request_data = { 'reverse': reverse, 'download': download, 'account_id': account_id, } errors_mapping = {} errors_mapping['FILTER_NOT_FOUND'] = FilterNotFound('The filter can not be found. The error_subtype will hold the filter UUID') errors_mapping['INVALID_CONDITION'] = InvalidCondition('The condition is not support. The error_subtype will hold the filter expression this applies to') errors_mapping['INVALID_FIELD'] = InvalidField('The field is not valid for this object. The error_subtype will hold the filter expression this applies to') errors_mapping['MISSING_FIELDS'] = 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'] = NotFound('The account was not found') errors_mapping['NOT_PERMITTED'] = NotPermitted('You are not permitted to access this information') query_data = { 'api': self._api, 'url': '/audit/account', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'events' return QueryOPF(**query_data)
def list( self, account_id, type, ): """List. :param account_id: Limit to global filters and filters within the account namespaces :param type: The type of filter to list """ request_data = { 'account_id': account_id, 'type': type, } errors_mapping = {} errors_mapping['FILTER_NOT_FOUND'] = FilterNotFound('The filter can not be found. The error_subtype will hold the filter UUID') errors_mapping['INVALID_CONDITION'] = InvalidCondition('The condition is not support. The error_subtype will hold the filter expression this applies to') errors_mapping['INVALID_FIELD'] = InvalidField('The field is not valid for this object. The error_subtype will hold the filter expression this applies to') errors_mapping['INVALID_SORT_FIELD'] = InvalidSortField('The field is not valid for this object. The error_subtype will hold the field name this applies to') errors_mapping['INVALID_SORT_ORDER'] = InvalidSortOrder('The sort order for the field is invalid. The error_subtype will hold the field name this applies to') query_data = { 'api': self._api, 'url': '/filter/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'filters' return QueryOPSF(**query_data)
def list(self, ): """List. """ request_data = {} errors_mapping = {} errors_mapping[('FILTER_NOT_FOUND', None)] = FilterNotFound( 'The filter can not be found. The error_subtype will hold the filter UUID' ) errors_mapping[('INVALID_CONDITION', None)] = InvalidCondition( 'The condition is not support. The error_subtype will hold the filter expression this applies to' ) errors_mapping[('INVALID_FIELD', None)] = InvalidField( 'The field is not valid for this object. The error_subtype will hold the filter expression this applies to' ) errors_mapping[('INVALID_SORT_FIELD', None)] = InvalidSortField( 'The field is not valid for this object. The error_subtype will hold the field name this applies to' ) errors_mapping[('INVALID_SORT_ORDER', None)] = InvalidSortOrder( 'The sort order for the field is invalid. The error_subtype will hold the field name this applies to' ) query_data = { 'api': self._api, 'url': '/query/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'queries' return AsyncQueryOPSF(**query_data)
def namespace_list( self, account_id=None, plus_phr=None, ): """Namespace list. :param account_id: Only return the namespaces for this account (optional) :param plus_phr: Flag to include the PHR account as well if account_id was specified (optional) """ request_data = { 'plus_phr': plus_phr, 'account_id': account_id, } errors_mapping = {} errors_mapping['FILTER_NOT_FOUND'] = FilterNotFound('The filter can not be found. The error_subtype will hold the filter UUID') errors_mapping['INVALID_CONDITION'] = InvalidCondition('The condition is not support. The error_subtype will hold the filter expression this applies to') errors_mapping['INVALID_FIELD'] = InvalidField('The field is not valid for this object. The error_subtype will hold the filter expression this applies to') query_data = { 'api': self._api, 'url': '/user/namespace/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryOF(**query_data)
def list( self, object=None, ): """List. :param object: object Notes: object - Object class (Study OR User_account OR Group OR Location OR Account OR Patient OR Case OR Order OR Message) """ request_data = { 'object': object, } errors_mapping = {} errors_mapping['FILTER_NOT_FOUND'] = FilterNotFound('The filter can not be found. The error_subtype will hold the filter UUID') errors_mapping['INVALID_CONDITION'] = InvalidCondition('The condition is not support. The error_subtype will hold the filter expression this applies to') errors_mapping['INVALID_FIELD'] = InvalidField('The field is not valid for this object. The error_subtype will hold the filter expression this applies to') errors_mapping['INVALID_SORT_FIELD'] = InvalidSortField('The field is not valid for this object. The error_subtype will hold the field name this applies to') errors_mapping['INVALID_SORT_ORDER'] = InvalidSortOrder('The sort order for the field is invalid. The error_subtype will hold the field name this applies to') query_data = { 'api': self._api, 'url': '/tag/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'tags' return QueryOPSF(**query_data)
def set( self, conditions, name, uuid, ): """Set. :param conditions: The validation conditions :param name: The validation rule name :param uuid: The validation id """ request_data = { 'uuid': uuid, 'name': name, 'conditions': conditions, } errors_mapping = {} errors_mapping['INVALID_CONDITION'] = InvalidCondition('A condition is invalid. The error_subtype holds more detail') errors_mapping['MISSING_FIELDS'] = 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'] = NotFound('The validation rule was not found') errors_mapping['NOT_PERMITTED'] = NotPermitted('You are not permitted to add validation rules') query_data = { 'api': self._api, 'url': '/validate/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def list_count( self, account_id, ): """List count. :param account_id: Limit to activities in this account and the personal activities """ request_data = { 'account_id': account_id, } errors_mapping = {} errors_mapping['FILTER_NOT_FOUND'] = FilterNotFound( 'The filter can not be found. The error_subtype will hold the filter UUID' ) errors_mapping['INVALID_CONDITION'] = InvalidCondition( 'The condition is not support. The error_subtype will hold the filter expression this applies to' ) errors_mapping['INVALID_FIELD'] = InvalidField( 'The field is not valid for this object. The error_subtype will hold the filter expression this applies to' ) errors_mapping['MISSING_FIELDS'] = 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['RUNNING'] = Running( 'This call is currently runnning for the user') query_data = { 'api': self._api, 'url': '/activity/list/count', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryOF(**query_data)
def list(self, ): """List. """ request_data = {} errors_mapping = {} errors_mapping['FILTER_NOT_FOUND'] = FilterNotFound( 'The filter can not be found. The error_subtype will hold the filter UUID' ) errors_mapping['INVALID_CONDITION'] = InvalidCondition( 'The condition is not support. The error_subtype will hold the filter expression this applies to' ) errors_mapping['INVALID_FIELD'] = InvalidField( 'The field is not valid for this object. The error_subtype will hold the filter expression this applies to' ) errors_mapping['INVALID_SORT_FIELD'] = InvalidSortField( 'The field is not valid for this object. The error_subtype will hold the field name this applies to' ) errors_mapping['INVALID_SORT_ORDER'] = InvalidSortOrder( 'The sort order for the field is invalid. The error_subtype will hold the field name this applies to' ) errors_mapping['MISSING_FIELDS'] = MissingFields( 'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields' ) query_data = { 'api': self._api, 'url': '/message/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'messages' return QueryOPSF(**query_data)
def deploy_list( self, customcode_id=None, namespace_id=None, ): """Deploy list. :param customcode_id: customcode_id :param namespace_id: namespace_id Notes: (namespace_id OR customcode_id) - uuid of either the namespace or customcode to show the deployments for """ request_data = { 'customcode_id': customcode_id, 'namespace_id': namespace_id, } errors_mapping = {} errors_mapping['FILTER_NOT_FOUND'] = FilterNotFound( 'The filter can not be found. The error_subtype will hold the filter UUID' ) errors_mapping['INVALID_CONDITION'] = InvalidCondition( 'The condition is not support. The error_subtype will hold the filter expression this applies to' ) errors_mapping['INVALID_FIELD'] = InvalidField( 'The field is not valid for this object. The error_subtype will hold the filter expression this applies to' ) errors_mapping['INVALID_SORT_FIELD'] = InvalidSortField( 'The field is not valid for this object. The error_subtype will hold the field name this applies to' ) errors_mapping['INVALID_SORT_ORDER'] = InvalidSortOrder( 'The sort order for the field is invalid. The error_subtype will hold the field name this applies to' ) errors_mapping['MISSING_FIELDS'] = 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'] = NotFound( 'The namespace or customcode can not be found') errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to do this') query_data = { 'api': self._api, 'url': '/customcode/deploy/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'deployments' return QueryOPSF(**query_data)
def list( self, account_id, strict_account_filter=None, study_extra=None, ): """List. :param account_id: Limit to activities in this account and the personal activities :param strict_account_filter: Flag to apply the account_id to personal activites as well (optional) :param study_extra: Flag to return extra study fields (optional) """ request_data = { 'account_id': account_id, 'strict_account_filter': strict_account_filter, 'study_extra': study_extra, } errors_mapping = {} errors_mapping[('FILTER_NOT_FOUND', None)] = FilterNotFound( 'The filter can not be found. The error_subtype will hold the filter UUID' ) errors_mapping[('INVALID_CONDITION', None)] = InvalidCondition( 'The condition is not support. The error_subtype will hold the filter expression this applies to' ) errors_mapping[('INVALID_FIELD', None)] = InvalidField( 'The field is not valid for this object. The error_subtype will hold the filter expression this applies to' ) errors_mapping[('INVALID_SORT_FIELD', None)] = InvalidSortField( 'The field is not valid for this object. The error_subtype will hold the field name this applies to' ) errors_mapping[('INVALID_SORT_ORDER', None)] = InvalidSortOrder( 'The sort order for the field is invalid. The error_subtype will hold the field name this applies to' ) 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' ) query_data = { 'api': self._api, 'url': '/activity/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'activities' return QueryOPSF(**query_data)
def list( self, dicom_tags=None, namespace_id=None, study_id=None, ): """List. :param dicom_tags: A JSON list of the DICOM tags to return (optional) :param namespace_id: namespace_id :param study_id: study_id Notes: (study_id OR namespace_id) - uuid of the study or namespace to search """ request_data = { 'study_id': study_id, 'dicom_tags': dicom_tags, 'namespace_id': namespace_id, } errors_mapping = {} errors_mapping['FILTER_NOT_FOUND'] = FilterNotFound( 'The filter can not be found. The error_subtype will hold the filter UUID' ) errors_mapping['INVALID_CONDITION'] = InvalidCondition( 'The condition is not support. The error_subtype will hold the filter expression this applies to' ) errors_mapping['INVALID_FIELD'] = InvalidField( 'The field is not valid for this object. The error_subtype will hold the filter expression this applies to' ) errors_mapping['MISSING_FIELDS'] = 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_PERMITTED'] = NotPermitted( 'You are not permitted to view the DICOM data') query_data = { 'api': self._api, 'url': '/dicomdata/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'dicomdatas' return QueryOPF(**query_data)
def sps_find( self, account_id, node_id=None, serial_no=None, ): """Sps find. :param account_id: The account uuid if sid authentication is used :param node_id: node_id :param serial_no: serial_no Notes: (sid OR node_id AND serial_no) - Either the sid or the node uuid and serial number """ request_data = { 'serial_no': serial_no, 'node_id': node_id, 'account_id': account_id, } errors_mapping = {} errors_mapping['FILTER_NOT_FOUND'] = FilterNotFound( 'The filter can not be found. The error_subtype will hold the filter UUID' ) errors_mapping['INVALID_CONDITION'] = InvalidCondition( 'The condition is not support. The error_subtype will hold the filter expression this applies to' ) errors_mapping['INVALID_FIELD'] = InvalidField( 'The field is not valid for this object. The error_subtype will hold the filter expression this applies to' ) errors_mapping['MISSING_FIELDS'] = 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'] = NotFound('The node can not be found') errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to view orders in this account') query_data = { 'api': self._api, 'url': '/order/sps/find', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryOF(**query_data)
def user_list( self, user_id, ): """User list. :param user_id: The user id """ request_data = { 'user_id': user_id, } errors_mapping = {} errors_mapping[('FILTER_NOT_FOUND', None)] = FilterNotFound( 'The filter can not be found. The error_subtype will hold the filter UUID' ) errors_mapping[('INVALID_CONDITION', None)] = InvalidCondition( 'The condition is not support. The error_subtype will hold the filter expression this applies to' ) errors_mapping[('INVALID_FIELD', None)] = InvalidField( 'The field is not valid for this object. The error_subtype will hold the filter expression this applies to' ) errors_mapping[('INVALID_SORT_FIELD', None)] = InvalidSortField( 'The field is not valid for this object. The error_subtype will hold the field name this applies to' ) errors_mapping[('INVALID_SORT_ORDER', None)] = InvalidSortOrder( 'The sort order for the field is invalid. The error_subtype will hold the field name this applies to' ) 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 user was not found.') query_data = { 'api': self._api, 'url': '/radreport/user/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'radreports' return AsyncQueryOPSF(**query_data)
def transform_set( self, conditions, name, order_by, replacements, uuid, ): """Transform set. :param conditions: A JSON array of the transform conditions :param name: Name of the transform :param order_by: A numeric ordering value. Transformations are run in this order from lowest to highest :param replacements: A JSON array of the transform replacements :param uuid: The transform id """ request_data = { 'conditions': conditions, 'name': name, 'order_by': order_by, 'replacements': replacements, 'uuid': uuid, } errors_mapping = {} errors_mapping[('DUPLICATE_ORDER_BY', None)] = DuplicateOrderBy('The order_by value is used by another transform') errors_mapping[('INVALID_CONDITION', None)] = InvalidCondition('An invalid condition was passed. The error_subtype holds the details on why it is invalid') errors_mapping[('INVALID_REPLACEMENT', None)] = InvalidReplacement('An invalid replacement was passed. The error_subtype holds the details on why it is invalid') 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 account can not be found') errors_mapping[('NOT_LIST', None)] = NotList('The field is not a JSON array. The error_subtype holds the name of the field') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted('You are not permitted to do this') query_data = { 'api': self._api, 'url': '/hl7/transform/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def add( self, account_id, conditions, name, ): """Add. :param account_id: The account id :param conditions: The validation conditions :param name: The validation rule name """ request_data = { 'account_id': account_id, 'conditions': conditions, 'name': name, } errors_mapping = {} errors_mapping[('INVALID_CONDITION', None)] = InvalidCondition( 'A condition is invalid. The error_subtype holds more detail') 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 object was not found. The error_subtype holds the type of the object' ) errors_mapping[('NOT_PERMITTED', None)] = NotPermitted( 'You are not permitted to add validation rules') query_data = { 'api': self._api, 'url': '/validate/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def list( self, permissions=None, ): """List. :param permissions: Flag to return the users role and permissions in the accounts (optional) """ request_data = { 'permissions': permissions, } errors_mapping = {} errors_mapping['FILTER_NOT_FOUND'] = FilterNotFound( 'The filter can not be found. The error_subtype will hold the filter UUID' ) errors_mapping['INVALID_CONDITION'] = InvalidCondition( 'The condition is not support. The error_subtype will hold the filter expression this applies to' ) errors_mapping['INVALID_FIELD'] = InvalidField( 'The field is not valid for this object. The error_subtype will hold the filter expression this applies to' ) errors_mapping['INVALID_SORT_FIELD'] = InvalidSortField( 'The field is not valid for this object. The error_subtype will hold the field name this applies to' ) errors_mapping['INVALID_SORT_ORDER'] = InvalidSortOrder( 'The sort order for the field is invalid. The error_subtype will hold the field name this applies to' ) query_data = { 'api': self._api, 'url': '/account/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'accounts' return QueryOPSF(**query_data)
def set( self, uuid, actions=None, conditions=None, delay=None, delay_from_study_field=None, delay_from_study_seconds=None, delay_seconds=None, delay_till_schedule=None, manual_roles=None, name=None, no_re_run=None, on_harvest=None, on_manual_route=None, on_share=None, on_thin=None, on_upload=None, only_re_run=None, options=None, other_namespaces=None, schedule=None, suspended=None, ): """Set. :param uuid: The route uuid :param actions: Route actions in JSON format (optional) :param conditions: Route conditions in JSON format (optional) :param delay: Number of minutes to delay running this rule for after it is triggered (optional) :param delay_from_study_field: Delay running this rule, start counting from this study's datetime field (optional) :param delay_from_study_seconds: Number of seconds to delay running this rule for after a timepoint defined by delay_from_study_field (optional) :param delay_seconds: Number of seconds to delay running this rule for after it is triggered (optional) :param delay_till_schedule: Delay running this rule after it is triggered until the next scheduled time - flag (optional) :param manual_roles: A comma separated list of the uuid of roles that can run the rule manually (optional) :param name: Name of the route (optional) :param no_re_run: Do not run this rule on a re-notification from storage - flag (optional) :param on_harvest: Apply the rule to studies harvested into the namespace (optional) :param on_manual_route: Apply this rule for a manually routed study- flag (optional) :param on_share: Apply the rule to studies shared into the namespace (optional) :param on_thin: Apply this rule to thin studies when they are created - flag (optional) :param on_upload: Apply the rule to studies uploaded into the namespace - flag (optional) :param only_re_run: Only run this rule on a re-notification from storage - flag (optional) :param options: Route options in JSON format (optional) :param other_namespaces: A comma separated list of the uuid of other namespaces to apply this rule to (optional) :param schedule: Route schedule in JSON format (optional) :param suspended: This rule is suspended and not applied - flag (optional) """ request_data = { 'actions': actions, 'conditions': conditions, 'delay': delay, 'delay_from_study_field': delay_from_study_field, 'delay_from_study_seconds': delay_from_study_seconds, 'delay_seconds': delay_seconds, 'delay_till_schedule': delay_till_schedule, 'manual_roles': manual_roles, 'name': name, 'no_re_run': no_re_run, 'on_harvest': on_harvest, 'on_manual_route': on_manual_route, 'on_share': on_share, 'on_thin': on_thin, 'on_upload': on_upload, 'only_re_run': only_re_run, 'options': options, 'other_namespaces': other_namespaces, 'schedule': schedule, 'suspended': suspended, 'uuid': uuid, } errors_mapping = {} errors_mapping[('INVALID_ACTION', None)] = InvalidAction('An action is invalid. The error_subtype holds the error detail') errors_mapping[('INVALID_CONDITION', None)] = InvalidCondition('A condition is invalid. The error_subtype holds the condition') errors_mapping[('INVALID_FLAG', None)] = InvalidFlag('An invalid flag was passed. The error_subtype holds the name of the invalid flag') 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[('INVALID_MANUAL_ROLES', None)] = InvalidManualRoles('The manual_roles is invalid. The error_subtype holds the error detail') errors_mapping[('INVALID_OPTION', None)] = InvalidOption('An option is invalid. The error_subtype holds the error detail') errors_mapping[('INVALID_OTHER_NAMESPACES', None)] = InvalidOtherNamespaces('The other_namespaces is invalid. The error_subtype holds the error detail') errors_mapping[('INVALID_SCHEDULE', None)] = InvalidSchedule('The schedule is invalid. The error_subtype holds the error detail') 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 route can not be found') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted('You are not permitted to edit the route') query_data = { 'api': self._api, 'url': '/route/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def add( self, actions, conditions, name, on_harvest, on_share, account_id=None, delay=None, delay_till_schedule=None, group_id=None, location_id=None, manual_roles=None, namespace_id=None, no_re_run=None, on_manual_route=None, on_thin=None, on_upload=None, options=None, other_namespaces=None, schedule=None, suspended=None, ): """Add. :param actions: Route actions in JSON format :param conditions: Route conditions in JSON format :param name: Name of the route :param on_harvest: Apply the rule to studies harvested into the namespace :param on_share: Apply the rule to studies shared into the namespace :param account_id: account_id :param delay: Number of minutes to delay running this rule for after it is triggered (optional) :param delay_till_schedule: Delay running this rule after it is triggered until the next scheduled time - flag (optional) :param group_id: group_id :param location_id: location_id :param manual_roles: A comma separated list of the uuid of roles that can run the rule manually (optional) :param namespace_id: namespace_id :param no_re_run: Do not run this rule on a re-notification from storage - flag (optional) :param on_manual_route: Apply this rule for a manually routed study - flag (optional) :param on_thin: Apply this rule to thin studies when they are created - flag (optional) :param on_upload: Apply the rule to studies uploaded into the namespace - flag (optional) :param options: Route options in JSON format (optional) :param other_namespaces: A comma separated list of the uuid of other namespaces to apply this rule to (optional) :param schedule: Route schedule in JSON format (optional) :param suspended: This rule is suspended and not applied - flag (optional) Notes: (account_id OR group_id OR location_id OR namespace_id) - uuid of the account, group or location or namespace the route is linked with """ request_data = { 'namespace_id': namespace_id, 'on_manual_route': on_manual_route, 'group_id': group_id, 'manual_roles': manual_roles, 'on_upload': on_upload, 'on_harvest': on_harvest, 'delay_till_schedule': delay_till_schedule, 'actions': actions, 'suspended': suspended, 'name': name, 'options': options, 'conditions': conditions, 'delay': delay, 'schedule': schedule, 'other_namespaces': other_namespaces, 'on_share': on_share, 'location_id': location_id, 'account_id': account_id, 'no_re_run': no_re_run, 'on_thin': on_thin, } errors_mapping = {} errors_mapping['ACCOUNT_NOT_FOUND'] = AccountNotFound('The account was not found') errors_mapping['INVALID_ACTION'] = InvalidAction('An action is invalid. The error_subtype holds the error detail') errors_mapping['INVALID_CONDITION'] = InvalidCondition('A condition is invalid. The error_subtype holds the condition') errors_mapping['INVALID_FLAG'] = InvalidFlag('An invalid flag was passed. The error_subtype holds the name of the invalid flag') errors_mapping['INVALID_JSON'] = InvalidJson('The field is not in valid JSON format. The error_subtype holds the name of the field') errors_mapping['INVALID_LINKAGE'] = InvalidLinkage('The linkage is invalid') errors_mapping['INVALID_MANUAL_ROLES'] = InvalidManualRoles('The manual_roles is invalid. The error_subtype holds the error detail') errors_mapping['INVALID_OPTION'] = InvalidOption('An option is invalid. The error_subtype holds the error detail') errors_mapping['INVALID_OTHER_NAMESPACES'] = InvalidOtherNamespaces('The other_namespaces is invalid. The error_subtype holds the error detail') errors_mapping['INVALID_SCHEDULE'] = InvalidSchedule('The schedule is invalid. The error_subtype holds the error detail') errors_mapping['MISSING_FIELDS'] = 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_PERMITTED'] = NotPermitted('You are not permitted to add a route to that account') query_data = { 'api': self._api, 'url': '/route/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)