Exemple #1
0
    def add(
        self,
        study_id,
        type,
        fields=None,
    ):
        """Add.
        :param study_id: Id of the study to add the radreport to
        :param type: The type of the radreport
        :param fields: A JSON hash of the fields in the report (optional)
        """
        request_data = {
           'study_id': study_id,
           'type': type,
           'fields': fields,
        }
	
        errors_mapping = {}
        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 study was not found.')
        errors_mapping['NOT_PERMITTED'] = NotPermitted('You are not permitted to add a radreport to the study')
        query_data = {
            'api': self._api,
            'url': '/radreport/add',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Exemple #2
0
    def set(
        self,
        uuid,
        attachment=None,
        fields=None,
    ):
        """Set.
        :param uuid: Id of the radreport
        :param attachment: A JSON hash of the storage attachment information (optional)
        :param fields: A JSON hash of the fields in the report (optional)
        """
        request_data = {
           'attachment': attachment,
           'uuid': uuid,
           'fields': fields,
        }
	
        errors_mapping = {}
        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 study was not found.')
        errors_mapping['NOT_PERMITTED'] = NotPermitted('You are not permitted to add a radreport to the study')
        query_data = {
            'api': self._api,
            'url': '/radreport/set',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Exemple #3
0
    def set(
        self,
        json,
        uuid,
    ):
        """Set.

        :param json: The JSON annotation data structure
        :param uuid: Id of the annotation
        """
        request_data = {
           'json': json,
           'uuid': uuid,
        }
	
        errors_mapping = {}
        errors_mapping[('INVALID_JSON', None)] = InvalidJson('The field is not in valid JSON format. The error_subtype holds the name of the field')
        errors_mapping[('MISSING_FIELDS', None)] = MissingFields('A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields')
        errors_mapping[('NOT_FOUND', None)] = NotFound('The study was not found.')
        errors_mapping[('NOT_PERMITTED', None)] = NotPermitted('You are not permitted to add annotations to the study')
        query_data = {
            'api': self._api,
            'url': '/annotation/set',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return AsyncQueryO(**query_data)
Exemple #4
0
    def add(
        self,
        frame_number,
        instance_uid,
        series_uid,
        json=None,
        phi_namespace=None,
        stamp=None,
        storage_namespace=None,
        study_id=None,
        study_uid=None,
    ):
        """Add.
        :param frame_number: The frame number
        :param instance_uid: The instance uid
        :param series_uid: The series uid
        :param json: json
        :param phi_namespace: phi_namespace
        :param stamp: stamp
        :param storage_namespace: storage_namespace
        :param study_id: study_id
        :param study_uid: study_uid

        Notes:
        (study_id OR study_uid AND storage_namespace AND phi_namespace) The uuid of the study or the storage triplet
        (json OR stamp) - The JSON annotation data structure or the stamp flag
        """
        request_data = {
            'study_id': study_id,
            'storage_namespace': storage_namespace,
            'frame_number': frame_number,
            'json': json,
            'stamp': stamp,
            'series_uid': series_uid,
            'study_uid': study_uid,
            'phi_namespace': phi_namespace,
            'instance_uid': instance_uid,
        }

        errors_mapping = {}
        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 study was not found.')
        errors_mapping['NOT_PERMITTED'] = NotPermitted(
            'You are not permitted to add annotations to the study')
        query_data = {
            'api': self._api,
            'url': '/annotation/add',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Exemple #5
0
    def share_pricing(
        self,
        uuid,
        charge_description=None,
        currency=None,
        pricing=None,
        second_opinion_config=None,
        second_opinion_share=None,
    ):
        """Share pricing.
        :param uuid: The uuid of the namespace
        :param charge_description: The description of the charge (optional)
        :param currency: currency
        :param pricing: Pricing table in JSON format (optional)
        :param second_opinion_config: JSON configuration for the second opinion workflow (optional)
        :param second_opinion_share: Flag to enable/disable the second opinion workflow for the share (optional)

        Notes:
        currency - 3-letter ISO code for currency to charge in (USD OR GBP) (optional)
        """
        request_data = {
            'pricing': pricing,
            'uuid': uuid,
            'second_opinion_config': second_opinion_config,
            'charge_description': charge_description,
            'currency': currency,
            'second_opinion_share': second_opinion_share,
        }

        errors_mapping = {}
        errors_mapping['INVALID_AMOUNT'] = InvalidAmount(
            'An invalid amount. The error_subtype holds the invalid amount')
        errors_mapping['INVALID_CURRENCY'] = InvalidCurrency(
            'Invalid currency')
        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['NEEDS_ANY_OR_ALL'] = NeedsAnyOrAll(
            'The hash needs an "ANY" or "ALL" key')
        errors_mapping['NOT_FOUND'] = NotFound('The namespace was not found')
        errors_mapping['NOT_HASH'] = NotHash('The pricing field is not a hash')
        errors_mapping['NOT_PERMITTED'] = NotPermitted(
            'You are not permitted to price this namespace')
        errors_mapping['ONLY_ALL'] = OnlyAll(
            'If the hash has an ALL value it can't have any other values')
        query_data = {
            'api': self._api,
            'url': '/namespace/share/pricing',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Exemple #6
0
    def set(
        self,
        uuid,
        description=None,
        name=None,
        permission_param=None,
        permissions=None,
    ):
        """Set.
        :param uuid: The role uuid
        :param description: Description of the role (optional)
        :param name: Name of the role (optional)
        :param permission_param: Set an individual permission. This is an alternative to the permissions hash for easier use in the API tester (optional)
        :param permissions: A hash of the role permissions (optional)
        """
        request_data = {
            'uuid': uuid,
            'description': description,
            'name': name,
            'permissions': permissions,
        }
        if permission_param is not None:
            permission_param_dict = {
                '{prefix}{k}'.format(prefix='permission_', k=k): v
                for k, v in permission_param.items()
            }
            request_data.update(permission_param_dict)

        errors_mapping = {}
        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_PERMISSION'] = InvalidPermission(
            'Invalid permission flag. The error_subtype holds the name of the permission flag.'
        )
        errors_mapping['INVALID_PERMISSION_VALUE'] = InvalidPermissionValue(
            'The permission flag has an invalid value. The error_subtype holds the name of the permission flag.'
        )
        errors_mapping['NOT_FOUND'] = NotFound('The role can not be found')
        errors_mapping['NOT_PERMITTED'] = NotPermitted(
            'You are not permitted to edit the role')
        errors_mapping['NO_OTHER_ROLE_EDIT'] = NoOtherRoleEdit(
            'No other role has role_edit permissions so you can not disable role_edit for this role'
        )
        query_data = {
            'api': self._api,
            'url': '/role/set',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Exemple #7
0
    def invite(
        self,
        account_id,
        email,
        link,
        groups=None,
        link_already=None,
        locations=None,
        role_id=None,
    ):
        """Invite.
        :param account_id: The account to invite the person too
        :param email: Email address of the person to invite
        :param link: URL to accept the invitation at. The invitation id will be appended to the link
        :param groups: A JSON hash with the keys the group uuids to add the user to and the values the role uuid for the group (optional)
        :param link_already: URL to accept the invitation at for an existing user on the system. The invitation id will be appended to the link (optional)
        :param locations: A JSON hash with the keys the location uuids to add the user to and the values the role uuid for the location (optional)
        :param role_id: The role to give the user (optional)
        """
        request_data = {
           'role_id': role_id,
           'link': link,
           'account_id': account_id,
           'groups': groups,
           'locations': locations,
           'email': email,
           'link_already': link_already,
        }
	
        errors_mapping = {}
        errors_mapping['ALREADY_EXISTS'] = AlreadyExists('They are already in this account')
        errors_mapping['INVALID_EMAIL'] = InvalidEmail('Enter a valid email address')
        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_LINK'] = InvalidLink('The link needs to be a https link within the site domain')
        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 or role can not be found. The error_subtype holds the uuid of the not found item')
        errors_mapping['NOT_HASH'] = NotHash('The field is not a JSON hash. The error_subtype holds the name of the field')
        errors_mapping['NOT_PERMITTED'] = NotPermitted('You are not permitted to invite users to this account')
        query_data = {
            'api': self._api,
            'url': '/user/invite',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Exemple #8
0
    def found(
        self,
        search_id,
        serial_no,
        studies,
        uuid,
    ):
        """Found.
        :param search_id: The id of the search request
        :param serial_no: The serial number of the node
        :param studies: A JSON array of the studies found. Each object has the following fields:
            study_uid - The study_uid
            study_date - The study date
            accession_number - The accession number
            referring_physician - The referring physician
            patient_name - Patient name
            patientid - Patient ID
            patient_sex - Gender
            patient_birth_date - Birth date
            study_description - Study description
            modality - Modality
            result_fields - A JSON structure with the answers for the requested result_fields in /destination/search (optional)
        :param uuid: The node id
        """
        request_data = {
           'serial_no': serial_no,
           'uuid': uuid,
           'studies': studies,
           'search_id': search_id,
        }
	
        errors_mapping = {}
        errors_mapping['ALREADY_DONE'] = AlreadyDone('The search has already had results returned against it')
        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 node or search can not be found')
        query_data = {
            'api': self._api,
            'url': '/node/found',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': False,
        }
        return QueryO(**query_data)
Exemple #9
0
    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)
Exemple #10
0
    def add(
        self,
        account_id,
        name,
        permissions=None,
    ):
        """Add.
        :param account_id: uuid of the account
        :param name: Name of the role
        :param permissions: A hash of the role permissions (optional)
        """
        request_data = {
            'name': name,
            'permissions': permissions,
            'account_id': account_id,
        }

        errors_mapping = {}
        errors_mapping['ACCOUNT_NOT_FOUND'] = AccountNotFound(
            'The account was not found')
        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_PERMISSION'] = InvalidPermission(
            'Invalid permission flag. The error_subtype holds the name of the permission flag.'
        )
        errors_mapping['INVALID_PERMISSION_VALUE'] = InvalidPermissionValue(
            'The permission flag has an invalid value. The error_subtype holds the name of the permission 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_PERMITTED'] = NotPermitted(
            'You are not permitted to add a role to that account')
        query_data = {
            'api': self._api,
            'url': '/role/add',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Exemple #11
0
    def found_mwl(
        self,
        orders,
        search_id,
        serial_no,
        uuid,
    ):
        """Found mwl.
        :param orders: A JSON array of the orders found. Each object has the following fields:
            patient_name - Patient name
            patientid - Patient id
            accession_number - Accession number
            patient_sex - Gender
            patient_birth_date - Birth date
            order_number - Order number
            order_date - Order date
        :param search_id: The id of the search request
        :param serial_no: The serial number of the node
        :param uuid: The node id
        """
        request_data = {
           'serial_no': serial_no,
           'uuid': uuid,
           'orders': orders,
           'search_id': search_id,
        }
	
        errors_mapping = {}
        errors_mapping['ALREADY_DONE'] = AlreadyDone('The search has already had results returned against it')
        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 node or search can not be found')
        query_data = {
            'api': self._api,
            'url': '/node/found/mwl',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': False,
        }
        return QueryO(**query_data)
Exemple #12
0
    def set(
        self,
        uuid,
        attachment=None,
        fields=None,
    ):
        """Set.

        :param uuid: Id of the radreport
        :param attachment: A JSON hash of the storage attachment information (optional)
        :param fields: A JSON hash of the fields in the report (optional)
        """
        request_data = {
            'attachment': attachment,
            'fields': fields,
            'uuid': uuid,
        }

        errors_mapping = {}
        errors_mapping[('INVALID_JSON', None)] = InvalidJson(
            'The field is not in valid JSON format. The error_subtype holds the name of the field'
        )
        errors_mapping[('LOCKED', None)] = Locked(
            'Only if account.settings.enable_radreport_lock_reading is set. This radreport is locked by another sid. error_subtype=RADREPORT_LOCKED. error_data={"locked_radreport_id":radreport_uuid,"locked_user_id":user_uuid}.'
        )
        errors_mapping[('MISSING_FIELDS', None)] = MissingFields(
            'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields'
        )
        errors_mapping[('NOT_FOUND',
                        None)] = NotFound('The study was not found.')
        errors_mapping[('NOT_PERMITTED', None)] = NotPermitted(
            'You are not permitted to add a radreport to the study')
        query_data = {
            'api': self._api,
            'url': '/radreport/set',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return AsyncQueryO(**query_data)
Exemple #13
0
    def add(
        self,
        study_id,
        type,
        fields=None,
    ):
        """Add.

        :param study_id: Id of the study to add the radreport to
        :param type: The type of the radreport
        :param fields: A JSON hash of the fields in the report (optional)
        """
        request_data = {
            'fields': fields,
            'study_id': study_id,
            'type': type,
        }

        errors_mapping = {}
        errors_mapping[('INVALID_JSON', None)] = InvalidJson(
            'The field is not in valid JSON format. The error_subtype holds the name of the field'
        )
        errors_mapping[('LOCKED', None)] = Locked(
            'Only if account.settings.enable_radreport_lock_reading is set. There is another locked radreport for the study. error_subtype=RADREPORT_LOCKED. error_data={"locked_radreport_id":radreport_uuid,"locked_user_id":user_uuid}.'
        )
        errors_mapping[('MISSING_FIELDS', None)] = MissingFields(
            'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields'
        )
        errors_mapping[('NOT_FOUND',
                        None)] = NotFound('The study was not found.')
        errors_mapping[('NOT_PERMITTED', None)] = NotPermitted(
            'You are not permitted to add a radreport to the study')
        query_data = {
            'api': self._api,
            'url': '/radreport/add',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Exemple #14
0
    def study_defaults(
        self,
        uuid,
        defaults=None,
    ):
        """Study defaults.
        :param uuid: The uuid of the namespace
        :param defaults: Default values in JSON format. The format is a hash with the keys the names of the fields and the values are the default value. The available field name are as listed in the returned field hash. (optional)
        """
        request_data = {
            'uuid': uuid,
            'defaults': defaults,
        }

        errors_mapping = {}
        errors_mapping['INVALID_FIELD_NAME'] = InvalidFieldName(
            'The field name in the default 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['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 apply defaults to this namespace')
        query_data = {
            'api': self._api,
            'url': '/namespace/study/defaults',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Exemple #15
0
    def set(
        self,
        uuid,
        category=None,
        configuration=None,
        ctc_bucket=None,
        facility_contact=None,
        facility_contact_title=None,
        facility_email=None,
        facility_name=None,
        facility_notes=None,
        facility_zip=None,
        is_public=None,
        monitor_email=None,
        monitor_node_last_send=None,
        monitor_node_last_send_threshold=None,
        monitor_node_ping=None,
        monitor_node_slow_push=None,
        monitor_node_slow_push_threshold=None,
        monitor_study_create=None,
        monitor_study_create_threshold=None,
        name=None,
        reload_configuration=None,
        serial_no=None,
        setting_param=None,
        settings=None,
        storage_namespace=None,
    ):
        """Set.
        :param uuid: The node id
        :param category: category
        :param configuration: The configuration as a JSON hash of key values pairs (optional)
        :param ctc_bucket: Name of the S3 bucket to use for a cloud to cloud gateway (optional)
        :param facility_contact: Name of the facility contact (optional)
        :param facility_contact_title: Title of the facility contact (optional)
        :param facility_email: Email of the facility contact (optional)
        :param facility_name: Name of the facility it is installed at (optional)
        :param facility_notes: Notes about the facility (optional)
        :param facility_zip: Zip code of the facility it is installed at (optional)
        :param is_public: Flag if the node is public (optional)
        :param monitor_email: Email address(es) to send monitor failure notices (optional)
        :param monitor_node_last_send: Check if the node has sent a study recently (optional)
        :param monitor_node_last_send_threshold: Threshold in minutes for triggering the monitor_node_last_send notification (optional)
        :param monitor_node_ping: Check if the node is pinging (optional)
        :param monitor_node_slow_push: Check if the node is pushing slowly (optional)
        :param monitor_node_slow_push_threshold: Threshold in minutes for triggering the monitor_node_slow_push notification (optional)
        :param monitor_study_create: Check if the node is sending studies normally (optional)
        :param monitor_study_create_threshold: Threshold in minutes for triggering the monitor_study_create notification (optional)
        :param name: Description of the node (optional)
        :param reload_configuration: If this flag is set the node will be instructed to reload it's configuration on the next ping (optional)
        :param serial_no: serial_no
        :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 node can override (optional)
        :param storage_namespace: Namespace uuid to attach the node to. This requires a sysadmin sid and must be within the same account (optional)

        Notes:
        category - Node category (ACTIVE OR INACTIVE OR MIGRATION OR TEST OR DUPLICATE OR INTEGRATED) (optional)
        (sid OR serial_no) - The session id or serial number of the node
        """
        request_data = {
           'facility_name': facility_name,
           'serial_no': serial_no,
           'monitor_email': monitor_email,
           'monitor_node_slow_push': monitor_node_slow_push,
           'facility_contact': facility_contact,
           'facility_email': facility_email,
           'monitor_study_create': monitor_study_create,
           'ctc_bucket': ctc_bucket,
           'settings': settings,
           'monitor_node_last_send_threshold': monitor_node_last_send_threshold,
           'facility_notes': facility_notes,
           'monitor_node_last_send': monitor_node_last_send,
           'name': name,
           'monitor_node_ping': monitor_node_ping,
           'is_public': is_public,
           'uuid': uuid,
           'reload_configuration': reload_configuration,
           'monitor_study_create_threshold': monitor_study_create_threshold,
           'facility_contact_title': facility_contact_title,
           'monitor_node_slow_push_threshold': monitor_node_slow_push_threshold,
           'storage_namespace': storage_namespace,
           'category': category,
           'configuration': configuration,
           'facility_zip': facility_zip,
        }
        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['INVALID_CONFIGURATION'] = InvalidConfiguration('An invalid combination of configuration options was set. The error_subtype will hold more detail')
        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 node can not be found')
        errors_mapping['NOT_PERMITTED'] = NotPermitted('You are not permitted to edit this node')
        errors_mapping['NO_NODE_OVERRIDE'] = NoNodeOverride('The setting does not allow a node override')
        query_data = {
            'api': self._api,
            'url': '/node/set',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Exemple #16
0
    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)
Exemple #17
0
    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)
Exemple #18
0
    def add(
        self,
        account_id,
        capture_on_share_code,
        customfield_param,
        display_order,
        name,
        required,
        wrapped_dicom_only,
        dicom_tag=None,
        dicom_tag_ignore_empty=None,
        hl7_component=None,
        hl7_field=None,
        hl7_segment=None,
        load_dicom_tag=None,
        load_from_sr=None,
        load_hl7=None,
        load_hl7_filter=None,
        options=None,
        other_dicom_tags=None,
        type=None,
    ):
        """Add.
        :param account_id: uuid of the account
        :param capture_on_share_code: Flag if the field should be captured during a share code exchange (only applicable to study fields)
        :param customfield_param: The object to associate the customfield with (Study|User_account|Group|Location|Account|Patient|Case|Order|Appointment|Dicomdata)
        :param display_order: Integer to order how the fields should be displayed
        :param name: Name of the customfield
        :param required: Flag if the field is required
        :param wrapped_dicom_only: Only capture for wrapped DICOM uploads during a share code exchange
        :param dicom_tag: DICOM tag to map this field to. Format should be of form (1234,1234). (only applicable to study fields) (optional)
        :param dicom_tag_ignore_empty: Flag to not map an empty custom field to the DICOM tag. (only applicable if a dicom_tag is specified) (optional)
        :param hl7_component: Component number to map  this field to in HL7 ORM messages. Valid values are 1 to 64. (only applicable to study fields) (optional)
        :param hl7_field: Segment field number to map  this field to in HL7 ORM messages. Valid values are 1 to 64. (only applicable to study fields) (optional)
        :param hl7_segment: hl7_segment
        :param load_dicom_tag: Flag to load the current value from the study into this field. (only applicable if a dicom_tag is specified) (optional)
        :param load_from_sr: Load the value from the structured reports in the study (only applicable to study fields) .(optional)
        :param load_hl7: If this is set to a HL7 message type the value of this field will be updated from the hl7_segment, hl7_field and hl7_component from incoming HL7 messages of the matching message type (only applicable to study fields) (optional)
        :param load_hl7_filter: Filter token for the load_hl7 option (only applicable to study fields) (optional)
        :param options: Additional options in JSON format (optional)
        :param other_dicom_tags: JSON array of other DICOM tags to map this field to. (only applicable to study fields) (optional)
        :param type: type

        Notes:
        object - The object to associate the customfield with (Study OR User_account OR Group OR Location OR Account OR Patient OR Case OR Order OR Appointment OR Dicomdata)
        type - Type of the custom field (text OR number OR date OR memo OR select OR multiselect OR radio OR checkbox OR search)
        hl7_segment - Segment to map this field to in HL7 ORM messages. Valid values are (NTE OR PID OR PID1 OR PV1 OR PV2 OR OBR OR DG1 OR OBX OR CTI OR BLG OR ORC) (only applicable to study fields) (optional)
        """
        request_data = {
            'load_from_sr': load_from_sr,
            'dicom_tag_ignore_empty': dicom_tag_ignore_empty,
            'wrapped_dicom_only': wrapped_dicom_only,
            'hl7_component': hl7_component,
            'capture_on_share_code': capture_on_share_code,
            'dicom_tag': dicom_tag,
            'type': type,
            'name': name,
            'options': options,
            'hl7_segment': hl7_segment,
            'required': required,
            'load_hl7': load_hl7,
            'load_dicom_tag': load_dicom_tag,
            'display_order': display_order,
            'hl7_field': hl7_field,
            'load_hl7_filter': load_hl7_filter,
            'other_dicom_tags': other_dicom_tags,
            '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['INVALID_DICOM_TAG'] = InvalidDicomTag(
            'The DICOM tag is invalid')
        errors_mapping['INVALID_DICOM_TAG_OBJECT'] = InvalidDicomTagObject(
            'DICOM tags can only be applied to study fields')
        errors_mapping['INVALID_HL7_OBJECT'] = InvalidHl7Object(
            'HL7 fields can only be applied to study fields')
        errors_mapping['INVALID_HL7_SEGMENT'] = InvalidHl7Segment(
            'Invalid segment 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_OBJECT'] = InvalidObject(
            'An invalid object was passed.')
        errors_mapping['INVALID_OPTIONS'] = InvalidOptions(
            'An option is invalid. The error_subtype holds the specific error message'
        )
        errors_mapping['INVALID_SEARCH_SOURCE'] = InvalidSearchSource(
            'An invalid search source was passed.')
        errors_mapping['INVALID_TYPE'] = InvalidType(
            'An invalid type 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_PERMITTED'] = NotPermitted(
            'You are not permitted to add a customfield to this account')
        errors_mapping['NO_DICOM_TAG_DEFINED'] = NoDicomTagDefined(
            'The load_dicom_tag flag is set but the dicom_tag field is not defined'
        )
        query_data = {
            'api': self._api,
            'url': '/customfield/add',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Exemple #19
0
    def set(
        self,
        uuid,
        capture_on_share_code=None,
        dicom_tag=None,
        dicom_tag_ignore_empty=None,
        display_order=None,
        hl7_component=None,
        hl7_field=None,
        hl7_segment=None,
        load_dicom_tag=None,
        load_from_sr=None,
        load_hl7=None,
        load_hl7_filter=None,
        name=None,
        options=None,
        other_dicom_tags=None,
        required=None,
        wrapped_dicom_only=None,
    ):
        """Set.
        :param uuid: uuid of the customfield
        :param capture_on_share_code: Flag if the study type field should be captured during a share code exchange (optional)
        :param dicom_tag: Dicom tag to map this field to. Format should be of form (1234,1234). (only applicable to study fields) (optional)
        :param dicom_tag_ignore_empty: Flag to not map an empty custom field to the DICOM tag. (only applicable if a dicom_tag is specified) (optional)
        :param display_order: Integer to order how the fields should be displayed (optional)
        :param hl7_component: Component number to map  this field to in HL7 ORM messages. Valid values are 1 to 64. (only applicable to study fields) (optional)
        :param hl7_field: Segment field number to map  this field to in HL7 ORM messages. Valid values are 1 to 64. (only applicable to study fields) (optional)
        :param hl7_segment: hl7_segment
        :param load_dicom_tag: Flag to load the current value from the study into this field. (only applicable if a dicom_tag is specified) (optional)
        :param load_from_sr: Load the value from the structured reports in the study. (only applicable to study fields) .(optional)
        :param load_hl7: If this is set to a HL7 message type the value of this field will be updated from the hl7_segment, hl7_field and hl7_component from incoming HL7 messages of the matching message type (only applicable to study fields) (optional)
        :param load_hl7_filter: Filter token for the load_hl7 option (only applicable to study fields) (optional)
        :param name: Name of the customfield (optional)
        :param options: Additional options in JSON format (optional)
        :param other_dicom_tags: JSON array of other DICOM tags to map this field to. (only applicable to study fields) (optional)
        :param required: Flag if the field is required (optional)
        :param wrapped_dicom_only: Only capture for wrapped DICOM uploads during a share code exchange (optional)

        Notes:
        hl7_segment - Segment to map this field to in HL7 ORM messages. Valid values are (NTE OR PID OR PID1 OR PV1 OR PV2 OR OBR OR DG1 OR OBX OR CTI OR BLG OR ORC) (only applicable to study fields) (optional)
        """
        request_data = {
            'load_from_sr': load_from_sr,
            'dicom_tag_ignore_empty': dicom_tag_ignore_empty,
            'wrapped_dicom_only': wrapped_dicom_only,
            'hl7_component': hl7_component,
            'capture_on_share_code': capture_on_share_code,
            'dicom_tag': dicom_tag,
            'name': name,
            'options': options,
            'hl7_segment': hl7_segment,
            'required': required,
            'load_hl7': load_hl7,
            'uuid': uuid,
            'load_dicom_tag': load_dicom_tag,
            'display_order': display_order,
            'hl7_field': hl7_field,
            'load_hl7_filter': load_hl7_filter,
            'other_dicom_tags': other_dicom_tags,
        }

        errors_mapping = {}
        errors_mapping['INVALID_DICOM_TAG'] = InvalidDicomTag(
            'The DICOM tag is invalid')
        errors_mapping['INVALID_DICOM_TAG_OBJECT'] = InvalidDicomTagObject(
            'DICOM tags can only be applied to study fields')
        errors_mapping['INVALID_HL7_FIELD'] = InvalidHl7Field(
            'Invalid field number')
        errors_mapping['INVALID_HL7_OBJECT'] = InvalidHl7Object(
            'HL7 fields can only be applied to study fields')
        errors_mapping['INVALID_HL7_SEGMENT'] = InvalidHl7Segment(
            'Invalid segment 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_OPTIONS'] = InvalidOptions(
            'An option is invalid. The error_subtype holds the specific error message'
        )
        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 customfield can not be found')
        errors_mapping['NOT_PERMITTED'] = NotPermitted(
            'You are not permitted to edit the customfield')
        errors_mapping['NO_DICOM_TAG_DEFINED'] = NoDicomTagDefined(
            'The load_dicom_tag flag is set but the dicom_tag field is not defined'
        )
        query_data = {
            'api': self._api,
            'url': '/customfield/set',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Exemple #20
0
    def set(
        self,
        uuid,
        adults=None,
        archive=None,
        days_old=None,
        days_old_how=None,
        global_param=None,
        max_deletes=None,
        minors=None,
        modalities=None,
        name=None,
        namespaces=None,
        owned_phr=None,
        shared_from_phr=None,
        skinny=None,
        study_status_tags=None,
        suspended=None,
        thin=None,
    ):
        """Set.
        :param uuid: Id 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 days_old: Studies greater than or equal to these days old will be purged (optional)
        :param days_old_how: How should the days old value be calculated using the 'U'pdated or 'C'reated date (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 name: Name of the purge rule (optional)
        :param namespaces: A JSON array of namespace uuid to limit the rule to (optional)
        :param owned_phr: Apply this rule 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,
            'uuid': uuid,
            'namespaces': namespaces,
            'minors': minors,
            'name': name,
            'modalities': modalities,
            'owned_phr': owned_phr,
            'days_old_how': days_old_how,
            'global_param': global_param,
            'adults': adults,
            '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['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_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_PERMITTED'] = NotPermitted(
            'You are not permitted to edit a purge rule')
        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/set',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Exemple #21
0
    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)
Exemple #22
0
    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)
Exemple #23
0
    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)
Exemple #24
0
    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)
Exemple #25
0
    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)