def add( self, account_id, case_sensitive, lookup, name, replace, object=None, ): """Add. :param account_id: The account id :param case_sensitive: Flag if the dictionary lookup is case sensitive or not :param lookup: A JSON array of field names that will be concatenated and MD5 hashed for the dictionary lookup value :param name: The dictionary name :param replace: A JSON array of the field names that will be replaced for a successful lookup :param object: object Notes: object - Object this is applied against (Study OR Order OR User_account OR Case) """ request_data = { 'replace': replace, 'name': name, 'object': object, 'lookup': lookup, 'case_sensitive': case_sensitive, 'account_id': account_id, } errors_mapping = {} errors_mapping['INVALID_FIELD'] = InvalidField( 'An invalid field name was passed. The error_subtype holds the name of the invalid field' ) errors_mapping['INVALID_FLAG'] = InvalidFlag( 'An invalid flag was passed. The error_subtype holds the name of the invalid flag' ) errors_mapping['INVALID_OBJECT'] = InvalidObject( 'An invalid object was passed') 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 can not be found') errors_mapping['NOT_LIST'] = NotList( 'The field is not a JSON array. The error_subtype holds the name of the field' ) errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to do this') query_data = { 'api': self._api, 'url': '/dictionary/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def user_add( self, event_upload_fail, user_id, uuid, event_approve=None, event_case_assignment=None, event_harvest=None, event_incoming_study_request=None, event_link=None, event_link_mine=None, event_message=None, event_new_report=None, event_node=None, event_query_add=None, event_query_edit=None, event_query_reply=None, event_report_remove=None, event_share=None, event_site_qualified=None, event_status_change=None, event_study_comment=None, event_thin_study_fail=None, event_thin_study_success=None, event_upload=None, no_physician_alias_share=None, role_id=None, ): """User add. :param event_upload_fail: Notify the user on a failed upload into the location namespace :param user_id: Id of the user :param uuid: The location id :param event_approve: Notify the user on a approval needed into the location namespace (optional) :param event_case_assignment: Notify the user when they are assigned a case as a medical or admin user (optional) :param event_harvest: Notify the user on a harvest into the location namespace (optional) :param event_incoming_study_request: Notify the user when they get an incoming study request (optional) :param event_link: Notify the user when an anonymous link is hit in the namespace (optional) :param event_link_mine: Notify the user when an anonymous link created by the user is hit in the namespace (optional) :param event_message: Notify the user when a message is sent to the location namespace (optional) :param event_new_report: Notify the user when a report is attached in the location namespace (optional) :param event_node: Notify the user when a location node sends an event (optional) :param event_query_add: Notify the user when a new query is issued (optional) :param event_query_edit: Notify the user when a query is edites (optional) :param event_query_reply: Notify the user when they leave a new reply in a query (optional) :param event_report_remove: Notify the user when a report is removed in the location namespace (optional) :param event_share: Notify the user on a share into the location namespace (optional) :param event_site_qualified: Notify the user when a trial site is qualified for the clinical trial account (optional) :param event_status_change: Notify the user when the status of a study is changed (optional) :param event_study_comment: Notify the user when a comment is attached to a study in the namespace (optional) :param event_thin_study_fail: Notify the user when a thin study retrieval they initiated fails (optional) :param event_thin_study_success: Notify the user when a thin study retrieval they initiated succeeds (optional) :param event_upload: Notify the user on an upload into the location namespace (optional) :param no_physician_alias_share: Flag to exclude this location from a physician alias share (optional) :param role_id: Id of the users role within the location (optional). If not passed the default location role will be assigned """ request_data = { 'event_approve': event_approve, 'event_case_assignment': event_case_assignment, 'event_harvest': event_harvest, 'event_incoming_study_request': event_incoming_study_request, 'event_link': event_link, 'event_link_mine': event_link_mine, 'event_message': event_message, 'event_new_report': event_new_report, 'event_node': event_node, 'event_query_add': event_query_add, 'event_query_edit': event_query_edit, 'event_query_reply': event_query_reply, 'event_report_remove': event_report_remove, 'event_share': event_share, 'event_site_qualified': event_site_qualified, 'event_status_change': event_status_change, 'event_study_comment': event_study_comment, 'event_thin_study_fail': event_thin_study_fail, 'event_thin_study_success': event_thin_study_success, 'event_upload': event_upload, 'event_upload_fail': event_upload_fail, 'no_physician_alias_share': no_physician_alias_share, 'role_id': role_id, 'user_id': user_id, 'uuid': uuid, } errors_mapping = {} errors_mapping[('CAN_NOT_PROMOTE', None)] = CanNotPromote( 'A user can not switch themselves to an admin role if they are currently not in an admin role' ) errors_mapping[('INVALID_FLAG', None)] = InvalidFlag( 'An invalid flag was passed. The error_subtype holds the name of the invalid flag' ) 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 location can not be found') errors_mapping[( 'NOT_PERMITTED', None)] = NotPermitted('You are not permitted to edit the location') errors_mapping[( 'ROLE_NAMESPACE_MISMATCH', 'INCOMPATIBLE_ROLE' )] = RoleNamespaceMismatch( 'The role cannot be used for locations, data contains role_id and namespace_id' ) errors_mapping[('ROLE_NOT_FOUND', None)] = RoleNotFound( 'The role was not found or is not in the account') errors_mapping[('USER_NOT_FOUND', None)] = UserNotFound( 'The user was not found or is not in the account') query_data = { 'api': self._api, 'url': '/location/user/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def add( self, account_id, name, customfield_param=None, hl7_template=None, must_approve=None, must_approve_harvest=None, must_approve_move=None, must_approve_upload=None, no_share=None, role_id=None, search_threshold=None, share_code=None, share_description=None, share_settings=None, share_via_gateway=None, ): """Add. :param account_id: uuid of the account :param name: Name of the location :param customfield_param: Expected values are CUSTOMFIELD_UUID. Custom field(s) (optional) :param hl7_template: The HL7 reporting template for the location (optional) :param must_approve: Flag if shared studies must be approved for the location (optional) :param must_approve_harvest: Flag if harvested studies must be approved (optional) :param must_approve_move: Flag if moved studies must be approved (optional) :param must_approve_upload: Flag if uploaded studies must be approved (optional) :param no_share: Flag if studies can not be shared with this location (optional). Studies can still be shared with users in the location. :param role_id: Id for the default role for the location (optional) :param search_threshold: The number of studies record in the namespace to switch the UI from list to search mode (optional) :param share_code: The share code of the location (optional) :param share_description: The share description of the location (optional) :param share_settings: Share settings JSON structure of the share display settings (optional) :param share_via_gateway: Flag if a gateway share is allowed (optional) """ request_data = { 'account_id': account_id, 'hl7_template': hl7_template, 'must_approve': must_approve, 'must_approve_harvest': must_approve_harvest, 'must_approve_move': must_approve_move, 'must_approve_upload': must_approve_upload, 'name': name, 'no_share': no_share, 'role_id': role_id, 'search_threshold': search_threshold, 'share_code': share_code, 'share_description': share_description, 'share_settings': share_settings, 'share_via_gateway': share_via_gateway, } 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[('ACCOUNT_NOT_FOUND', None)] = AccountNotFound('The account was not found') errors_mapping[('DUP_NAMESPACE_NAME', None)] = DupNamespaceName( 'namespace_names_globally_unique is enabled and there is another namespace with the same name' ) errors_mapping[('DUP_SHARE_CODE', None)] = DupShareCode('The share code is already used') errors_mapping[('INVALID_CUSTOMFIELD', None)] = InvalidCustomfield( 'Invalid custom field(s) name or value were passed. The error_subtype holds an array of the error details' ) 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[('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 name of field that triggered the error' ) errors_mapping[('NOT_PERMITTED', None)] = NotPermitted( 'You are not permitted to add a location to the account') errors_mapping[( 'ROLE_NAMESPACE_MISMATCH', 'GLOBAL_USER_WITH_RESTRICTED_ROLE' )] = RoleNamespaceMismatch( 'You are adding the location to the account with a global user with restricted role, data contains role_id and user_id' ) errors_mapping[( 'ROLE_NAMESPACE_MISMATCH', 'INCOMPATIBLE_ROLE' )] = RoleNamespaceMismatch( 'The role cannot be used for a location, data contains role_id and namespace_id' ) query_data = { 'api': self._api, 'url': '/location/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def add( self, account_id, address, aetitle, name, node_id, path, port, c_echo_interval=None, c_echo_schedule=None, can_mwl_search=None, can_query_retrieve=None, can_retrieve_thin=None, can_search=None, cd_burn_info=None, cd_burn_name=None, cd_burn_priority=None, default_query_retrieve_level=None, fire_webhooks=None, gateway_settings=None, hl7_address=None, hl7_fetch_filter=None, hl7_port=None, push_related_studies=None, sort_order=None, sqlch_psh_if_img_unchg=None, sqlch_psh_if_route_hl7=None, type=None, ): """Add. :param account_id: uuid of the account :param address: Address of the destination (required if DICOM type) :param aetitle: Aetitle of the destination (required if DICOM type) :param name: Name of the destination :param node_id: uuid of the node that handles the destination :param path: Path of the folder for a FOLDER type of destination (required if FOLDER type) :param port: Port of the destination (required if DICOM type) :param c_echo_interval: Interval in seconds to C echo the destination (optional) :param c_echo_schedule: C echo schedule (optional) :param can_mwl_search: Can this destination support searching a modality work list (optional) :param can_query_retrieve: Can this destination support query retrieve from HL7 messages (optional) :param can_retrieve_thin: Can this destination support retrieving thin studies (optional) :param can_search: Can this destination support searching (optional) :param cd_burn_info: A JSON hash with the CD burning information (optional) :param cd_burn_name: Name for the CD burner software (optional) :param cd_burn_priority: Integer value for the burner priority (optional) :param default_query_retrieve_level: default_query_retrieve_level :param fire_webhooks: Fire webhooks for events associated with this destination (optional) :param gateway_settings: Gateway settings (optional) :param hl7_address: Address of an attached HL7 destination (optional except for VIRTUAL destinations) :param hl7_fetch_filter: A transform condition expression (see /transform/add for format) to match against the HL7 message. Only fire a query retrieve if the message matches the condition (optional) :param hl7_port: Port of an attached HL7 destination (optional except for VIRTUAL destinations) :param push_related_studies: Push all the related studies (same MRN/patientid) in the namespace when a study is pushed (optional) :param sort_order: Integer value for sorting (optional) :param sqlch_psh_if_img_unchg: Squelch pushes to the destination if the image count has not changed and the push is by a routing rule (optional) :param sqlch_psh_if_route_hl7: Squelch pushes to the destination if the push was generated by HL7 triggered routing (optional) :param type: Type of the destination either DICOM, FOLDER, ACCELERATOR,VIRTUAL, BURNER or UPLOADER. Defaults to DICOM (optional) Notes: default_query_retrieve_level - Default query retrieve level this can be either (study OR series OR image) and defaults to study if not specified (optional) """ request_data = { 'node_id': node_id, 'cd_burn_info': cd_burn_info, 'sort_order': sort_order, 'can_retrieve_thin': can_retrieve_thin, 'hl7_address': hl7_address, 'can_mwl_search': can_mwl_search, 'c_echo_interval': c_echo_interval, 'name': name, 'type': type, 'aetitle': aetitle, 'c_echo_schedule': c_echo_schedule, 'push_related_studies': push_related_studies, 'cd_burn_name': cd_burn_name, 'can_query_retrieve': can_query_retrieve, 'gateway_settings': gateway_settings, 'path': path, 'fire_webhooks': fire_webhooks, 'hl7_port': hl7_port, 'sqlch_psh_if_route_hl7': sqlch_psh_if_route_hl7, 'port': port, 'hl7_fetch_filter': hl7_fetch_filter, 'address': address, 'cd_burn_priority': cd_burn_priority, 'sqlch_psh_if_img_unchg': sqlch_psh_if_img_unchg, 'default_query_retrieve_level': default_query_retrieve_level, 'account_id': account_id, 'can_search': can_search, } errors_mapping = {} errors_mapping['DUP_AETITLE'] = DupAetitle( 'Duplicate aetitle. All destinations for the same node must have a unique aetitle' ) errors_mapping['INVALID_CD_BURN_INFO'] = InvalidCdBurnInfo( 'Invalid cd_burn_info. The error_subtype holds more detail') errors_mapping['INVALID_FLAG'] = InvalidFlag( 'An invalid flag was passed. The error_subtype holds the name of the invalid flag' ) errors_mapping['INVALID_GATEWAY_TYPE'] = InvalidGatewayType( 'The type is wrong for the gateway it is getting attached to') errors_mapping['INVALID_INTEGER'] = InvalidInteger( 'An invalid integer was passed. The error_subtype holds the name of the invalid integer' ) errors_mapping['INVALID_NODE_TYPE'] = InvalidNodeType( 'The node is not a harvester') errors_mapping['INVALID_NODE_TYPE'] = InvalidNodeType( 'The node type is invalid for this type of destination') errors_mapping['INVALID_SCHEDULE'] = InvalidSchedule( 'The schedule is invalid. The error_subtype holds the error detail' ) errors_mapping['INVALID_TYPE'] = InvalidType( 'An invalid type was passed') errors_mapping['INVALID_VALUE'] = InvalidValue( 'An invalid value was passed. The error_subtype holds the value') 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['NODE_NOT_FOUND'] = NodeNotFound( 'The node can not be found') errors_mapping['NOT_FOUND'] = NotFound('The account can not be found') errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to add a destination to this account') query_data = { 'api': self._api, 'url': '/destination/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def event_set( self, namespace_id, event_approve=None, event_case_assignment=None, event_harvest=None, event_link=None, event_link_mine=None, event_message=None, event_new_report=None, event_share=None, event_status_change=None, event_study_comment=None, event_thin_study_fail=None, event_thin_study_success=None, event_upload=None, event_upload_fail=None, ): """Event set. :param namespace_id: Id of the namespace to set the flags on :param event_approve: Notify the user on a approval needed into the namespace (optional) :param event_case_assignment: Notify the user when they are assigned a case as a medical or admin user (optional) :param event_harvest: Notify the user on a harvest into the namespace (optional) :param event_link: Notify the user when an anonymous link is hit in the namespace (optional) :param event_link_mine: Notify the user when an anonymous link created by the user is hit in the namespace (optional) :param event_message: Notify the user when a message is sent to the namespace (optional) :param event_new_report: Notify the user when a report is attached in the namespace (optional) :param event_share: Notify the user on a share into the namespace (optional) :param event_status_change: Notify the user when the status of a study is changed (optional) :param event_study_comment: Notify the user when a comment is attached to a study in the namespace (optional) :param event_thin_study_fail: Notify the user when a thin study retrieval they initiated fails (optional) :param event_thin_study_success: Notify the user when a thin study retrieval they initiated succeeds (optional) :param event_upload: Notify the user on an upload into the namespace (optional) :param event_upload_fail: Notify the user on a failed upload into the namespace (optional) """ request_data = { 'event_study_comment': event_study_comment, 'event_thin_study_fail': event_thin_study_fail, 'event_new_report': event_new_report, 'event_status_change': event_status_change, 'event_share': event_share, 'event_message': event_message, 'event_link': event_link, 'event_thin_study_success': event_thin_study_success, 'event_approve': event_approve, 'event_upload_fail': event_upload_fail, 'event_link_mine': event_link_mine, 'event_case_assignment': event_case_assignment, 'event_upload': event_upload, 'namespace_id': namespace_id, 'event_harvest': event_harvest, } errors_mapping = {} errors_mapping['INVALID_FLAG'] = InvalidFlag('An invalid flag was passed. The error_subtype holds the name of the invalid flag') errors_mapping['NOT_FOUND'] = NotFound('The namespace can not be found') errors_mapping['NOT_MEMBER'] = NotMember('You are not a member of this namespace') query_data = { 'api': self._api, 'url': '/user/event/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**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)
def add( self, account_id, name, customfield_param=None, hl7_template=None, must_approve=None, must_approve_upload=None, no_share=None, role_id=None, search_threshold=None, share_code=None, share_description=None, share_settings=None, share_via_gateway=None, ): """Add. :param account_id: uuid of the account :param name: Name of the group :param customfield_param: Custom field(s) (optional) :param hl7_template: The HL7 reporting template for the group (optional) :param must_approve: Flag if shared studies must be approved for the group (optional) :param must_approve_upload: Flag if uploaded studies must be approved (optional) :param no_share: Flag if studies can not be shared with this group (optional). Studies can still be shared with users in the group. :param role_id: Id for the default role for the group (optional) :param search_threshold: The number of studies record in the namespace to switch the UI from list to search mode (optional) :param share_code: The share code of the group (optional) :param share_description: The share description of the group (optional) :param share_settings: Share settings JSON structure of the share display settings (optional) :param share_via_gateway: Flag if a gateway share is allowed (optional) """ request_data = { 'share_via_gateway': share_via_gateway, 'share_code': share_code, 'role_id': role_id, 'share_settings': share_settings, 'search_threshold': search_threshold, 'must_approve_upload': must_approve_upload, 'must_approve': must_approve, 'name': name, 'hl7_template': hl7_template, 'share_description': share_description, 'no_share': no_share, 'account_id': account_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['ACCOUNT_NOT_FOUND'] = AccountNotFound( 'The account was not found') errors_mapping['DUP_SHARE_CODE'] = DupShareCode( 'The share code is already used') 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['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['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 object was not found. The error_subtype holds the name of field that triggered the error' ) errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to add a group to that account') query_data = { 'api': self._api, 'url': '/group/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def user_add( self, user_id, uuid, event_approve=None, event_case_assignment=None, event_harvest=None, event_link=None, event_link_mine=None, event_message=None, event_new_report=None, event_node=None, event_share=None, event_status_change=None, event_study_comment=None, event_thin_study_fail=None, event_thin_study_success=None, event_upload=None, event_upload_fail=None, no_physician_alias_share=None, role_id=None, ): """User add. :param user_id: Id of the user :param uuid: The group id :param event_approve: Notify the user on a approval needed into the group namespace (optional) :param event_case_assignment: Notify the user when they are assigned a case as a medical or admin user (optional) :param event_harvest: Notify the user on a harvest into the group namespace (optional) :param event_link: Notify the user when an anonymous link is hit in the namespace (optional) :param event_link_mine: Notify the user when an anonymous link created by the user is hit in the namespace (optional) :param event_message: Notify the user when a message is sent to the group namespace (optional) :param event_new_report: Notify the user when a report is attached in the group namespace (optional) :param event_node: Notify the user when a group node sends an event (optional) :param event_share: Notify the user on a share into the group namespace (optional) :param event_status_change: Notify the user when the status of a study is changed (optional) :param event_study_comment: Notify the user when a comment is attached to a study in the namespace (optional) :param event_thin_study_fail: Notify the user when a thin study retrieval they initiated fails (optional) :param event_thin_study_success: Notify the user when a thin study retrieval they initiated succeeds (optional) :param event_upload: Notify the user on an upload into the group namespace (optional) :param event_upload_fail: Notify the user on a failed upload into the group namespace (optional) :param no_physician_alias_share: Flag to exclude this group from a physician alias share (optional) :param role_id: Id of the users role within the group (optional). If not passed the default group role will be assigned """ request_data = { 'event_status_change': event_status_change, 'event_share': event_share, 'event_thin_study_success': event_thin_study_success, 'event_link_mine': event_link_mine, 'no_physician_alias_share': no_physician_alias_share, 'event_study_comment': event_study_comment, 'role_id': role_id, 'event_node': event_node, 'event_harvest': event_harvest, 'event_message': event_message, 'event_upload_fail': event_upload_fail, 'event_thin_study_fail': event_thin_study_fail, 'event_new_report': event_new_report, 'uuid': uuid, 'event_approve': event_approve, 'event_case_assignment': event_case_assignment, 'user_id': user_id, 'event_upload': event_upload, 'event_link': event_link, } errors_mapping = {} errors_mapping['INVALID_FLAG'] = InvalidFlag( 'An invalid flag was passed. The error_subtype holds the name of the invalid flag' ) 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 group can not be found') errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to edit the group') errors_mapping['ROLE_NOT_FOUND'] = RoleNotFound( 'The role was not found or is not in the account') errors_mapping['USER_NOT_FOUND'] = UserNotFound( 'The user was not found or is not in the account') query_data = { 'api': self._api, 'url': '/group/user/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def set( self, can_request, uuid, css=None, customfield_param=None, hl7_template=None, must_approve=None, must_approve_upload=None, name=None, no_share=None, password_expire=None, role_id=None, search_threshold=None, session_expire=None, setting_param=None, settings=None, share_code=None, share_description=None, share_settings=None, share_via_gateway=None, vanity=None, vendor=None, ): """Set. :param can_request: Flag if user can request to join the account :param uuid: The account uuid :param css: Custom CSS for the account (optional) :param customfield_param: Custom field(s) (optional) :param hl7_template: The HL7 reporting template for the account (optional) :param must_approve: Flag if shared studies must be approved for the account namespace (optional) :param must_approve_upload: Flag if uploaded studies must be approved (optional) :param name: Name of the account (optional) :param no_share: Flag if studies can not be shared with this account (optional). Studies can still be shared with locations, groups and users in the account. :param password_expire: Number of days before account passwords expire. No expiration if zero. (optional) :param role_id: Id for the default role for the account (optional) :param search_threshold: The number of studies record in the namespace to switch the UI from list to search mode (optional) :param session_expire: Number of minutes before an idle session expires. (optional) :param setting_param: Set an individual setting. This is an alternative to the settings hash for easier use in the API tester (optional) :param settings: A hash of the account settings (optional) :param share_code: The share code of the account (optional) :param share_description: The share description of the account (optional) :param share_settings: Share settings JSON structure of the share display settings (optional) :param share_via_gateway: Flag if a gateway share is allowed (optional) :param vanity: Vanity host name for the account. Multiple host names can be specified in a comma separate list (optional) :param vendor: Vendor name (optional) """ request_data = { 'share_via_gateway': share_via_gateway, 'search_threshold': search_threshold, 'css': css, 'share_description': share_description, 'vendor': vendor, 'password_expire': password_expire, 'role_id': role_id, 'hl7_template': hl7_template, 'settings': settings, 'name': name, 'vanity': vanity, 'share_settings': share_settings, 'uuid': uuid, 'must_approve': must_approve, 'can_request': can_request, 'must_approve_upload': must_approve_upload, 'session_expire': session_expire, 'no_share': no_share, 'share_code': share_code, } 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) if setting_param is not None: setting_param_dict = { '{prefix}{k}'.format(prefix='setting_', k=k): v for k, v in setting_param.items() } request_data.update(setting_param_dict) errors_mapping = {} errors_mapping['DUPLICATE_NAME'] = DuplicateName( 'The account name is already taken') errors_mapping['DUPLICATE_VANITY'] = DuplicateVanity( 'The vanity host name is already taken. The error_subtype holds the taken hostname' ) errors_mapping['DUP_SHARE_CODE'] = DupShareCode( 'The share code is already used') 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['INVALID_FLAG'] = InvalidFlag( 'An invalid flag was passed. The error_subtype holds the name of the invalid flag' ) errors_mapping['INVALID_INTEGER'] = InvalidInteger( 'An invalid integer was passed. The error_subtype holds the name of the invalid integer' ) 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_VANITY'] = InvalidVanity( 'The vanity host name is invalid. The error_subtype holds the invalid hostname' ) errors_mapping['NOT_FOUND'] = NotFound( 'The object was not found. The error_subtype holds the name of field that triggered the error' ) errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to modify this record') query_data = { 'api': self._api, 'url': '/account/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def user_set( self, user_id, uuid, account_alias=None, account_email=None, account_login=None, account_password=None, customfield_param=None, event_approve=None, event_case_assignment=None, event_harvest=None, event_join=None, event_link=None, event_link_mine=None, event_message=None, event_new_report=None, event_node=None, event_purge=None, event_share=None, event_status_change=None, event_study_comment=None, event_thin_study_fail=None, event_thin_study_success=None, event_upload=None, event_upload_fail=None, global_param=None, max_sessions=None, password_reset=None, role_id=None, session_expire=None, setting_param=None, settings=None, ): """User set. :param user_id: The users uuid :param uuid: The account uuid :param account_alias: Users alias in the account. (optional). :param account_email: Users account_email. Only set this if it is different than the users login email (optional). :param account_login: Users login name in the account. (optional). :param account_password: Password for the account_password. (optional). :param customfield_param: Custom field(s) (optional) :param event_approve: Notify the user on a approval needed into the account namespace (optional) :param event_case_assignment: Notify the user when they are assigned a case as a medical or admin user (optional) :param event_harvest: Notify the user on a harvest into the account namespace (optional) :param event_join: Notify the user on a join request for the account (optional) :param event_link: Notify the user when an anonymous link is hit in the namespace (optional) :param event_link_mine: Notify the user when an anonymous link created by the user is hit in the namespace (optional) :param event_message: Notify the user when a message is sent to the account namespace (optional) :param event_new_report: Notify the user when a report is attached in the account namespace (optional) :param event_node: Notify the user when an account node sends an event (optional) :param event_purge: Notify the user the results of a purge job for the account (optional) :param event_share: Notify the user on a share into the account namespace (optional) :param event_status_change: Notify the user when the status of a study is changed (optional) :param event_study_comment: Notify the user when a comment is attached to a study in the namespace (optional) :param event_thin_study_fail: Notify the user when a thin study retrieval they initiated fails (optional) :param event_thin_study_success: Notify the user when a thin study retrieval they initiated succeeds (optional) :param event_upload: Notify the user on an upload into the account namespace (optional) :param event_upload_fail: Notify the user on a failed upload into the account namespace (optional) :param global_param: Flag if this is a global user. (optional). :param max_sessions: Over-ride value for the max number of simultaneous sessions the user can have. (optional). :param password_reset: Flag if the password needs to be reset. (optional). :param role_id: uuid of the users role in the account (optional). :param session_expire: Number of minutes before an idle session expires. (optional) :param setting_param: Set an individual setting. This is an alternative to the settings hash for easier use in the API tester (optional) :param settings: A hash of the account settings that the user can override (optional) """ request_data = { 'password_reset': password_reset, 'event_status_change': event_status_change, 'event_share': event_share, 'account_password': account_password, 'event_thin_study_success': event_thin_study_success, 'event_link_mine': event_link_mine, 'account_login': account_login, 'event_study_comment': event_study_comment, 'role_id': role_id, 'event_purge': event_purge, 'event_node': event_node, 'global_param': global_param, 'max_sessions': max_sessions, 'event_message': event_message, 'event_link': event_link, 'settings': settings, 'event_upload_fail': event_upload_fail, 'event_thin_study_fail': event_thin_study_fail, 'event_new_report': event_new_report, 'uuid': uuid, 'event_approve': event_approve, 'account_email': account_email, 'account_alias': account_alias, 'session_expire': session_expire, 'event_case_assignment': event_case_assignment, 'user_id': user_id, 'event_upload': event_upload, 'event_join': event_join, 'event_harvest': event_harvest, } 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) if setting_param is not None: setting_param_dict = { '{prefix}{k}'.format(prefix='setting_', k=k): v for k, v in setting_param.items() } request_data.update(setting_param_dict) errors_mapping = {} errors_mapping['BAD_PASSWORD'] = BadPassword( 'Password needs to be at least 8 characters long, contain at least two numbers, contain at least two characters and can't be one of your last three passwords' ) errors_mapping['CAN_NOT_PROMOTE'] = CanNotPromote( 'A user can not switch themselves to an admin role if they are currently not in an admin role' ) errors_mapping['DUPLICATE_NAME'] = DuplicateName( 'The account_login is already in use') 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['INVALID_FLAG'] = InvalidFlag( 'An invalid flag was passed. The error_subtype holds the name of the invalid flag' ) 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 can not be found') errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to edit this user') errors_mapping['NO_USER_OVERRIDE'] = NoUserOverride( 'The setting does not allow a user override') errors_mapping['ROLE_NOT_FOUND'] = RoleNotFound( 'The role was not found or is not an account role') errors_mapping['USER_NOT_FOUND'] = UserNotFound( 'The user can not be found or is not a member of this account') query_data = { 'api': self._api, 'url': '/account/user/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**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 set( self, uuid, address1=None, address2=None, city=None, country=None, inactive=None, name=None, site_id=None, state=None, zip=None, ): """Set. :param uuid: The site uuid :param address1: Address line 1 of the site (optional) :param address2: Address line 2 of the site (optional) :param city: The city the site is located in (optional) :param country: The country of the site (optional) :param inactive: Flag if the site is actively used. Might be used to filter out inactive sites (optional) :param name: The sites name (optional) :param site_id: The site to attach them to as a satellite site (optional) :param state: The state code of the site (optional) :param zip: The zip code of the site (optional) """ request_data = { 'address1': address1, 'address2': address2, 'city': city, 'country': country, 'inactive': inactive, 'name': name, 'site_id': site_id, 'state': state, 'uuid': uuid, 'zip': zip, } errors_mapping = {} errors_mapping[('DIFFERENT_ACCOUNTS', None)] = DifferentAccounts( 'The site and satellite sites are from different accounts') errors_mapping[('INVALID_FLAG', None)] = InvalidFlag( 'An invalid flag was passed. The error_subtype holds the name of the invalid flag' ) 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[('NESTED_SATELLITE_SITE', None)] = NestedSatelliteSite( 'The satellite site has its satellite sites') errors_mapping[('NOT_FOUND', None)] = NotFound('The site can not be found') errors_mapping[( 'NOT_PERMITTED', None)] = NotPermitted('You are not permitted to edit the site') query_data = { 'api': self._api, 'url': '/site/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def add( self, account_id, days_old, days_old_how, name, adults=None, archive=None, global_param=None, max_deletes=None, minors=None, modalities=None, namespaces=None, owned_phr=None, shared_from_phr=None, skinny=None, study_status_tags=None, suspended=None, thin=None, ): """Add. :param account_id: uuid of the account the rule is for :param days_old: Studies greater than or equal to these days old will be purged :param days_old_how: How should the days old value be calculated using the 'U'pdated or 'C'reated date :param name: Name of the purge rule :param adults: Apply this rule to adults - flag (optional) :param archive: Archive the studies rather than deleting them - flag (optional) :param global_param: Flag to make this a global purge rule (optional) :param max_deletes: Maximum number of purges per run of the rule (optional) :param minors: Apply this rule to minors - flag (optional) :param modalities: A JSON array of modalities to limit the rule to (optional) :param namespaces: A JSON array of namespace uuid to limit the rule to (optional) :param owned_phr: Apply this rule to owned PHR namespaces - flag (optional) :param shared_from_phr: If a study was shared from a PHR namespace delete the copy in the PHR namespace as well - flag (optional) :param skinny: Make the studies skinny rather than deleting - flag (optional) :param study_status_tags: A comma separated list of study status tags to purge (optional) :param suspended: This rule is suspended and not applied - flag (optional) :param thin: Make the studies thin rather than deleting - flag (optional) """ request_data = { 'shared_from_phr': shared_from_phr, 'archive': archive, 'max_deletes': max_deletes, 'study_status_tags': study_status_tags, 'skinny': skinny, 'namespaces': namespaces, 'minors': minors, 'name': name, 'modalities': modalities, 'owned_phr': owned_phr, 'days_old_how': days_old_how, 'global_param': global_param, 'adults': adults, 'account_id': account_id, 'suspended': suspended, 'thin': thin, 'days_old': days_old, } errors_mapping = {} errors_mapping['GT_ZERO'] = GtZero( 'The parameter must be great than zero. The error_subtype holds the name of the parameter' ) errors_mapping['INVALID_FLAG'] = InvalidFlag( 'An invalid flag was passed. The error_subtype holds the name of the invalid flag' ) 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_A_NUMBER'] = NotANumber( 'The parameter must be a valid number. The error_subtype holds the name of the parameter' ) errors_mapping['NOT_FOUND'] = NotFound( 'The account or namespace was not found. The error_subtype holds the uuid of the not found item' ) errors_mapping['NOT_LIST'] = NotList( 'The field is not a JSON array. The error_subtype holds the name of the field' ) errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to add a purge to that account') errors_mapping['ONLY_ONE_FLAG'] = OnlyOneFlag( 'You can set either the skinny, thin or archive flag, not multiple' ) errors_mapping['VALIDATION_FAILED'] = ValidationFailed( 'A field failed validation. The error_subtype holds the name of the invalid field' ) query_data = { 'api': self._api, 'url': '/purge/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def event_defaults( self, uuid, event_approve=None, event_case_assignment=None, event_harvest=None, event_link=None, event_link_mine=None, event_message=None, event_new_report=None, event_node=None, event_share=None, event_status_change=None, event_study_comment=None, event_thin_study_fail=None, event_thin_study_success=None, event_upload=None, event_upload_fail=None, ): """Event defaults. :param uuid: The uuid of the namespace :param event_approve: Notify the user on a approval needed into the namespace (optional) :param event_case_assignment: Notify the user when they are assigned a case as a medical or admin user (optional) :param event_harvest: Notify the user on a harvest into the namespace (optional) :param event_link: Notify the user when an anonymous link is hit in the namespace (optional) :param event_link_mine: Notify the user when an anonymous link created by the user is hit in the namespace (optional) :param event_message: Notify the user when a message is sent to the namespace (optional) :param event_new_report: Notify the user when a report is attached in the namespace (optional) :param event_node: Notify the user when a namespace node sends an event (optional) :param event_share: Notify the user on a share into the namespace (optional) :param event_status_change: Notify the user when the status of a study is changed (optional) :param event_study_comment: Notify the user when a comment is attached to a study in the namespace (optional) :param event_thin_study_fail: Notify the user when a thin study retrieval they initiated fails (optional) :param event_thin_study_success: Notify the user when a thin study retrieval they initiated succeeds (optional) :param event_upload: Notify the user on an upload into the namespace (optional) :param event_upload_fail: Notify the user on a failed upload into the namespace (optional) """ request_data = { 'event_study_comment': event_study_comment, 'event_thin_study_fail': event_thin_study_fail, 'event_new_report': event_new_report, 'event_node': event_node, 'event_status_change': event_status_change, 'uuid': uuid, 'event_share': event_share, 'event_message': event_message, 'event_link': event_link, 'event_thin_study_success': event_thin_study_success, 'event_approve': event_approve, 'event_upload_fail': event_upload_fail, 'event_link_mine': event_link_mine, 'event_case_assignment': event_case_assignment, 'event_upload': event_upload, 'event_harvest': event_harvest, } errors_mapping = {} errors_mapping['INVALID_FLAG'] = InvalidFlag( 'An invalid flag was passed. The error_subtype holds the name of the invalid flag' ) 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 was not found') errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to apply defaults to this namespace') query_data = { 'api': self._api, 'url': '/namespace/event/defaults', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)