Exemple #1
0
    def entry_delete(
        self,
        lookup,
        uuid,
    ):
        """Entry delete.
        :param lookup: The JSON array of the lookup values or the regular expression to delete
        :param uuid: The dictionary id
        """
        request_data = {
            'lookup': lookup,
            'uuid': uuid,
        }

        errors_mapping = {}
        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 dictionary or entry  can not be found')
        errors_mapping['NOT_LIST'] = NotList(
            'The field is not a JSON array. The error_subtype holds the name of the field'
        )
        errors_mapping['NOT_PERMITTED'] = NotPermitted(
            'You are not permitted to do this')
        query_data = {
            'api': self._api,
            'url': '/dictionary/entry/delete',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Exemple #2
0
    def entries(
        self,
        uuid,
        lookup=None,
    ):
        """Entries.
        :param uuid: The dictionary id
        :param lookup: Only return the entry for the optional lookup entry (optional)
        """
        request_data = {
            'lookup': lookup,
            'uuid': uuid,
        }

        errors_mapping = {}
        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 dictionary can not be found')
        errors_mapping['NOT_LIST'] = NotList(
            'The field is not a JSON array. The error_subtype holds the name of the field'
        )
        errors_mapping['NOT_PERMITTED'] = NotPermitted(
            'You are not permitted to do this')
        query_data = {
            'api': self._api,
            'url': '/dictionary/entries',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Exemple #3
0
    def add(
        self,
        account_id,
        case_sensitive,
        lookup,
        name,
        replace,
        object=None,
    ):
        """Add.
        :param account_id: The account id
        :param case_sensitive: Flag if the dictionary lookup is case sensitive or not
        :param lookup: A JSON array of field names that will be concatenated and MD5 hashed for the dictionary lookup value
        :param name: The dictionary name
        :param replace: A JSON array of the field names that will be replaced for a successful lookup
        :param object: object

        Notes:
        object - Object this is applied against (Study OR Order OR User_account OR Case)
        """
        request_data = {
            'replace': replace,
            'name': name,
            'object': object,
            'lookup': lookup,
            'case_sensitive': case_sensitive,
            'account_id': account_id,
        }

        errors_mapping = {}
        errors_mapping['INVALID_FIELD'] = InvalidField(
            'An invalid field name was passed. The error_subtype holds the name of the invalid field'
        )
        errors_mapping['INVALID_FLAG'] = InvalidFlag(
            'An invalid flag was passed. The error_subtype holds the name of the invalid flag'
        )
        errors_mapping['INVALID_OBJECT'] = InvalidObject(
            'An invalid object was passed')
        errors_mapping['MISSING_FIELDS'] = MissingFields(
            'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields'
        )
        errors_mapping['NOT_FOUND'] = NotFound('The account can not be found')
        errors_mapping['NOT_LIST'] = NotList(
            'The field is not a JSON array. The error_subtype holds the name of the field'
        )
        errors_mapping['NOT_PERMITTED'] = NotPermitted(
            'You are not permitted to do this')
        query_data = {
            'api': self._api,
            'url': '/dictionary/add',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Exemple #4
0
    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)
Exemple #5
0
    def transform_set(
        self,
        conditions,
        name,
        order_by,
        replacements,
        uuid,
    ):
        """Transform set.

        :param conditions: A JSON array of the transform conditions
        :param name: Name of the transform
        :param order_by: A numeric ordering value. Transformations are run in this order from lowest to highest
        :param replacements: A JSON array of the transform replacements
        :param uuid: The transform id
        """
        request_data = {
           'conditions': conditions,
           'name': name,
           'order_by': order_by,
           'replacements': replacements,
           'uuid': uuid,
        }
	
        errors_mapping = {}
        errors_mapping[('DUPLICATE_ORDER_BY', None)] = DuplicateOrderBy('The order_by value is used by another transform')
        errors_mapping[('INVALID_CONDITION', None)] = InvalidCondition('An invalid condition was passed. The error_subtype holds the details on why it is invalid')
        errors_mapping[('INVALID_REPLACEMENT', None)] = InvalidReplacement('An invalid replacement was passed. The error_subtype holds the details on why it is invalid')
        errors_mapping[('MISSING_FIELDS', None)] = MissingFields('A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields')
        errors_mapping[('NOT_FOUND', None)] = NotFound('The account can not be found')
        errors_mapping[('NOT_LIST', None)] = NotList('The field is not a JSON array. The error_subtype holds the name of the field')
        errors_mapping[('NOT_PERMITTED', None)] = NotPermitted('You are not permitted to do this')
        query_data = {
            'api': self._api,
            'url': '/hl7/transform/set',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Exemple #6
0
    def add(
        self,
        account_id,
        days_old,
        days_old_how,
        name,
        adults=None,
        archive=None,
        global_param=None,
        max_deletes=None,
        minors=None,
        modalities=None,
        namespaces=None,
        owned_phr=None,
        shared_from_phr=None,
        skinny=None,
        study_status_tags=None,
        suspended=None,
        thin=None,
    ):
        """Add.
        :param account_id: uuid of the account the rule is for
        :param days_old: Studies greater than or equal to these days old will be purged
        :param days_old_how: How should the days old value be calculated using the 'U'pdated or 'C'reated date
        :param name: Name of the purge rule
        :param adults: Apply this rule to adults - flag (optional)
        :param archive: Archive the studies rather than deleting them - flag (optional)
        :param global_param: Flag to make this a global purge rule (optional)
        :param max_deletes: Maximum number of purges per run of the rule (optional)
        :param minors: Apply this rule to minors - flag (optional)
        :param modalities: A JSON array of modalities to limit the rule to (optional)
        :param namespaces: A JSON array of namespace uuid to limit the rule to (optional)
        :param owned_phr: Apply this rule to owned PHR namespaces - flag (optional)
        :param shared_from_phr: If a study was shared from a PHR namespace delete the copy in the PHR namespace as well - flag (optional)
        :param skinny: Make the studies skinny rather than deleting - flag (optional)
        :param study_status_tags: A comma separated list of study status tags to purge (optional)
        :param suspended: This rule is suspended and not applied - flag (optional)
        :param thin: Make the studies thin rather than deleting - flag (optional)
        """
        request_data = {
            'shared_from_phr': shared_from_phr,
            'archive': archive,
            'max_deletes': max_deletes,
            'study_status_tags': study_status_tags,
            'skinny': skinny,
            'namespaces': namespaces,
            'minors': minors,
            'name': name,
            'modalities': modalities,
            'owned_phr': owned_phr,
            'days_old_how': days_old_how,
            'global_param': global_param,
            'adults': adults,
            'account_id': account_id,
            'suspended': suspended,
            'thin': thin,
            'days_old': days_old,
        }

        errors_mapping = {}
        errors_mapping['GT_ZERO'] = GtZero(
            'The parameter must be great than zero. The error_subtype holds the name of the parameter'
        )
        errors_mapping['INVALID_FLAG'] = InvalidFlag(
            'An invalid flag was passed. The error_subtype holds the name of the invalid flag'
        )
        errors_mapping['MISSING_FIELDS'] = MissingFields(
            'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields'
        )
        errors_mapping['NOT_A_NUMBER'] = NotANumber(
            'The parameter must be a valid number. The error_subtype holds the name of the parameter'
        )
        errors_mapping['NOT_FOUND'] = NotFound(
            'The account or namespace was not found. The error_subtype holds the uuid of the not found item'
        )
        errors_mapping['NOT_LIST'] = NotList(
            'The field is not a JSON array. The error_subtype holds the name of the field'
        )
        errors_mapping['NOT_PERMITTED'] = NotPermitted(
            'You are not permitted to add a purge to that account')
        errors_mapping['ONLY_ONE_FLAG'] = OnlyOneFlag(
            'You can set either the skinny, thin or archive flag, not multiple'
        )
        errors_mapping['VALIDATION_FAILED'] = ValidationFailed(
            'A field failed validation. The error_subtype holds the name of the invalid field'
        )
        query_data = {
            'api': self._api,
            'url': '/purge/add',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Exemple #7
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)