def entry_add( self, lookup, replace, uuid, regexp=None, ): """Entry add. :param lookup: The JSON array of the lookup values to add. Alternatively a regular expression if the regexp parameter is passed :param replace: The JSON array of the replacement field values :param uuid: The dictionary id :param regexp: An integer value that indicates that this entry is a regular expression (optional) """ request_data = { 'lookup': lookup, 'regexp': regexp, 'replace': replace, 'uuid': uuid, } errors_mapping = {} errors_mapping[('INVALID_INTEGER', None)] = InvalidInteger( 'Invalid integer. The error_subtype holds the invalid integer.') errors_mapping[('INVALID_LOOKUP', None)] = InvalidLookup( 'The lookup does not have the required number of fields') errors_mapping[('INVALID_REGEXP', None)] = InvalidRegexp( 'Invalid regular expression. The error_subtype holds the invalid regexp.' ) 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 dictionary 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': '/dictionary/entry/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def anonymize( self, uuid, prompt_for_anonymize=None, rules=None, ): """Anonymize. :param uuid: The uuid of the namespace :param prompt_for_anonymize: Flag to prompt if the anonymization rules should be applied. Only applicable to ingress anonymization. (optional) :param rules: Anonymization rules in JSON format. The format is a hash with the keys the names of the fields to anonymize and the values the regular expressions to apply. (optional) """ request_data = { 'prompt_for_anonymize': prompt_for_anonymize, 'uuid': uuid, 'rules': rules, } errors_mapping = {} errors_mapping['INVALID_FIELD_NAME'] = InvalidFieldName( 'The field name is n the rules hash is invalid. The error_subtype holds the invalid field name' ) 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_REGEXP'] = InvalidRegexp( 'Invalid regular expression. The error_subtype holds the invalid regexp.' ) 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_HASH'] = NotHash('The rules field is not a hash') errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to anonymize this namespace') query_data = { 'api': self._api, 'url': '/namespace/anonymize', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def add( self, account_id, event, name, url, auth=None, by_accession_number=None, by_uid=None, cron=None, delay=None, filter_field=None, filter_regexp=None, max_age=None, method=None, node_id=None, once=None, parameters=None, retry=None, sid_user_id=None, suspended=None, ): """Add. :param account_id: uuid of the account :param event: Event to call it on (See the notes for the available events) :param name: Name of the webhook :param url: URL to call :param auth: A JSON hash with the authentication details (optional) :param by_accession_number: Flag to expand the once search to include studies with the same accession_number (optional) :param by_uid: Flag to expand the once search to include studies with the same study_uid (optional) :param cron: Cron timing string for CRON events e.g 0 9 * * mon-fri(optional) :param delay: Number of seconds to delay running this webhook for after it is triggered (optional) :param filter_field: Name of the study field to filter on (optional) :param filter_regexp: Regular expression to match the value of the filter_field against (optional) :param max_age: Ignore studies that are more than this number of days old based on the study_date (optional) :param method: method :param node_id: uuid of the node to proxy the webhook through (optional) :param once: Flag that this webhook should only be run once for a specific study (optional) :param parameters: A JSON object of the parameter names and values (optional) :param retry: Retry the webhook if it fails (optional) :param sid_user_id: UUID of the user to generate a sid as (optional) :param suspended: This webhook is suspended and not triggered (optional) Notes: method - Method to call it with (POST OR GET OR POST_JSON OR PUT) """ request_data = { 'retry': retry, 'max_age': max_age, 'node_id': node_id, 'url': url, 'by_accession_number': by_accession_number, 'cron': cron, 'filter_field': filter_field, 'auth': auth, 'filter_regexp': filter_regexp, 'parameters': parameters, 'suspended': suspended, 'name': name, 'event': event, 'by_uid': by_uid, 'once': once, 'method': method, 'sid_user_id': sid_user_id, 'delay': delay, 'account_id': account_id, } errors_mapping = {} errors_mapping['ACCOUNT_NOT_FOUND'] = AccountNotFound( 'The account can not be found') errors_mapping['CUSTOM_NOT_HASH'] = CustomNotHash( 'The custom auth value is not a JSON hash') errors_mapping['INCOMPLETE_FILTER'] = IncompleteFilter( 'Both a field and regexp are required') errors_mapping['INVALID_CRON'] = InvalidCron( 'The cron value is invalid') errors_mapping['INVALID_EVENT'] = InvalidEvent( 'An invalid event was passed') errors_mapping['INVALID_FILTER_FIELD'] = InvalidFilterField( 'Invalid filter field name') errors_mapping['INVALID_JSON'] = InvalidJson( 'The parameters field is not in valid JSON format.') errors_mapping['INVALID_METHOD'] = InvalidMethod( 'An invalid method was passed') errors_mapping['INVALID_REGEXP'] = InvalidRegexp( 'Invalid regular expression') errors_mapping[ 'INVALID_TRANSFORM_CONDITION'] = InvalidTransformCondition( 'The transform condition is invalid') 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_HASH'] = NotHash( 'The parameter or auth field is not a hash.') errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to add a webhook to this account') errors_mapping['NOT_WITH_CRON'] = NotWithCron( 'The delay or retry option can not be used for cron events') errors_mapping['SFDC_MISSING_FIELDS'] = SfdcMissingFields( 'Fields are missing for the SFDC auth hash') errors_mapping['SFDC_NOT_HASH'] = SfdcNotHash( 'The SFDC auth value is not a JSON hash') errors_mapping['SID_USER_NOT_FOUND'] = SidUserNotFound( 'The sid user can not be found') errors_mapping['SID_USER_NOT_IN_ACCOUNT'] = SidUserNotInAccount( 'The sid user is not a member of this account') errors_mapping['USER_NOT_FOUND'] = UserNotFound( 'The basic authentication user can not be found') query_data = { 'api': self._api, 'url': '/webhook/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def add( self, prompt_for_anonymize, acceptance_required=None, account_id=None, action=None, anonymize=None, charge_amount=None, charge_currency=None, charge_description=None, email=None, filter=None, include_priors=None, max_hits=None, meeting_id=None, message=None, minutes_alive=None, mobile_phone=None, namespace_id=None, notify=None, parameters=None, password=None, password_is_dob=None, password_max_attempts=None, pin_auth=None, referer=None, share_code=None, share_on_view=None, skip_email_prompt=None, study_id=None, upload_match=None, use_share_code=None, ): """Add. :param prompt_for_anonymize: Flag to prompt if the anonymization rules should be applied on ingress :param acceptance_required: Flag that acceptance of TOS is required (optional) :param account_id: account_id :param action: action :param anonymize: Anonymization rules to the applied to any STUDY_UPLOAD done with this link. Rules are formatted as per the rules parameter in /namespace/anonymize (optional) :param charge_amount: Amount to charge in pennies before the link can be accessed (optional) :param charge_currency: Charge currency (optional) :param charge_description: Charge description (optional) :param email: Email the link to this address (optional) :param filter: filter :param include_priors: Include prior studies (optional) :param max_hits: The maximum number of times the link can be used (optional) :param meeting_id: UUID of the meeting to associate the link with (optional) :param message: Message to include in the email (optional) :param minutes_alive: The maximum number of minutes the link will be alive for (optional) :param mobile_phone: Send the link to this phone number (optional) :param namespace_id: namespace_id :param notify: Comma or space separated list of additional emails to notify of link usage (optional) :param parameters: JSON array of parameters to add to the redirect URL or return in /namespace/share_code if an upload (optional) :param password: Link password (optional) :param password_is_dob: Flag that the password is the patient_birth_date for the study (study_id is required) (optional) :param password_max_attempts: The maximum number of failed password attempt (optional) :param pin_auth: An account member email and PIN authentication is required (optional) :param referer: The link can only be accessed from the specified referer. The referer can be a regexp to match multiple referers (optional) :param share_code: share code for a STUDY_UPLOAD (optional) :param share_on_view: Flag to share the study with the email after it is viewed (optional) :param skip_email_prompt: Skip the prompt for email step (optional) :param study_id: study_id :param upload_match: A JSON hash of DICOM tags and regular expressions they must match uploaded against this link (optional) :param use_share_code: Flag to use the namespace share code settings for a STUDY_UPLOAD (optional) Notes: (study_id OR filter AND account_id OR namespace_id) - uuid of the study or a JSON hash of the study filter expression and the account_id or namespace_id if the action is STUDY_UPLOAD action - Link action (STUDY_LIST OR STUDY_VIEW OR STUDY_UPLOAD) """ request_data = { 'share_on_view': share_on_view, 'max_hits': max_hits, 'charge_description': charge_description, 'study_id': study_id, 'action': action, 'anonymize': anonymize, 'pin_auth': pin_auth, 'use_share_code': use_share_code, 'parameters': parameters, 'message': message, 'include_priors': include_priors, 'email': email, 'mobile_phone': mobile_phone, 'referer': referer, 'charge_amount': charge_amount, 'meeting_id': meeting_id, 'password': password, 'password_is_dob': password_is_dob, 'acceptance_required': acceptance_required, 'filter': filter, 'skip_email_prompt': skip_email_prompt, 'share_code': share_code, 'prompt_for_anonymize': prompt_for_anonymize, 'charge_currency': charge_currency, 'minutes_alive': minutes_alive, 'upload_match': upload_match, 'account_id': account_id, 'namespace_id': namespace_id, 'password_max_attempts': password_max_attempts, 'notify': notify, } errors_mapping = {} errors_mapping['INVALID_ACTION'] = InvalidAction( 'An invalid action was passed') errors_mapping['INVALID_CHARGE'] = InvalidCharge( 'The charge is invalid. The error_subtype holds the details on the error' ) errors_mapping['INVALID_EMAIL'] = InvalidEmail( 'An invalid email address was passed') errors_mapping['INVALID_FIELD_NAME'] = InvalidFieldName( 'The field name in the rules hash is invalid. The error_subtype holds the invalid field name' ) 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_PHI_FIELD'] = InvalidPhiField( 'The password_is_phi field is invalid or a study_id was not passed' ) errors_mapping['INVALID_PHONE'] = InvalidPhone( 'An invalid cellular phone number was passed') errors_mapping['INVALID_REGEXP'] = InvalidRegexp( 'Invalid regular expression. The error_subtype holds the invalid regexp.' ) errors_mapping['INVALID_UPLOAD_MATCH'] = InvalidUploadMatch( 'The upload_match is invalid. The error_subtype holds the details on the error' ) 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 patient or study could not be found. The error_subtype holds the uuid that can not be found' ) errors_mapping['NOT_HASH'] = NotHash('The rules field is not a hash') 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 create links') errors_mapping['VALIDATE'] = Validate( 'A validation error. The error_subtype holds the details on the error' ) query_data = { 'api': self._api, 'url': '/link/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)