Example #1
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)
Example #2
0
    def user_add(
        self,
        role_name,
        uuid,
        email=None,
        user_id=None,
    ):
        """User add.

        :param role_name: The role name that should be used for the user in groups
        :param uuid: The group id
        :param email: email
        :param user_id: user_id
        """
        request_data = {
            'email': email,
            'role_name': role_name,
            'user_id': user_id,
            'uuid': uuid,
        }

        errors_mapping = {}
        errors_mapping[(
            'ALREADY_EXISTS',
            None)] = AlreadyExists('The user is in the contact list already')
        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 site can not be found')
        errors_mapping[('NOT_PERMITTED', None)] = NotPermitted(
            'You are not permitted to add users to the site')
        errors_mapping[('USER_NOT_FOUND',
                        None)] = UserNotFound('The user was not found')
        query_data = {
            'api': self._api,
            'url': '/site/user/add',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return AsyncQueryO(**query_data)
Example #3
0
    def invite_accept(
        self,
        uuid,
    ):
        """Invite accept.
        :param uuid: Id of the invitation
        """
        request_data = {
           'uuid': uuid,
        }
	
        errors_mapping = {}
        errors_mapping['ACCEPTED'] = Accepted('The invitation was already accepted')
        errors_mapping['ALREADY_EXISTS'] = AlreadyExists('They are already in this account')
        errors_mapping['NOT_FOUND'] = NotFound('The invitation was not found')
        query_data = {
            'api': self._api,
            'url': '/user/invite/accept',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Example #4
0
    def set(
        self,
        birth_date,
        mrn,
        sex,
        uuid,
        alt_email=None,
        alt_mobile_phone=None,
        customfield_param=None,
        email=None,
        event_new_report=None,
        event_share=None,
        first=None,
        last=None,
        mobile_phone=None,
        name=None,
        setting_param=None,
        settings=None,
    ):
        """Set.

        :param birth_date: Birth date
        :param mrn: MRN
        :param sex: Gender
        :param uuid: The patient uuid
        :param alt_email: Alternate email address (optional)
        :param alt_mobile_phone: Alternate mobile phone number (optional)
        :param customfield_param: Expected values are CUSTOMFIELD_UUID. Custom field(s) (optional)
        :param email: Email address (optional)
        :param event_new_report: Notify the patient if a report is attached on the patient portal (optional)
        :param event_share: Notify the patient if a new study is available on the patient portal (optional)
        :param first: first
        :param last: last
        :param mobile_phone: Mobile phone number (optional)
        :param name: name
        :param setting_param: Expected values are SETTING_NAME. 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 patient settings, see Notes. (optional)
        """
        request_data = {
            'alt_email': alt_email,
            'alt_mobile_phone': alt_mobile_phone,
            'birth_date': birth_date,
            'email': email,
            'event_new_report': event_new_report,
            'event_share': event_share,
            'first': first,
            'last': last,
            'mobile_phone': mobile_phone,
            'mrn': mrn,
            'name': name,
            'settings': settings,
            'sex': sex,
            'uuid': uuid,
        }
        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[(
            'ALREADY_EXISTS',
            None)] = AlreadyExists('The MRN is in use by another patient')
        errors_mapping[('ALREADY_USED', None)] = AlreadyUsed(
            'The email or phone number is already used by another patient. The error_subtype holds the field that 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_EMAIL',
                        None)] = InvalidEmail('The email is invalid')
        errors_mapping[('INVALID_PHONE',
                        None)] = InvalidPhone('The phone number is invalid')
        errors_mapping[('INVALID_SETTING', None)] = InvalidSetting(
            'An invalid setting was passed. The error_subtype holds the name of the invalid setting'
        )
        errors_mapping[('INVALID_SETTING_VALUE', None)] = InvalidSettingValue(
            'An invalid setting value was passed. The error_subtype holds the name of the setting with the invalid value'
        )
        errors_mapping[('NOT_FOUND',
                        None)] = NotFound('The patient can not be found')
        errors_mapping[(
            'NOT_PERMITTED',
            None)] = NotPermitted('You are not permitted to edit the patient')
        errors_mapping[('NO_PATIENT_OVERRIDE', None)] = NoPatientOverride(
            'The setting does not allow a patient override')
        query_data = {
            'api': self._api,
            'url': '/patient/set',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return AsyncQueryO(**query_data)
Example #5
0
    def add(
        self,
        account_id,
        alt_email=None,
        alt_mobile_phone=None,
        birth_date=None,
        customfield_param=None,
        email=None,
        event_new_report=None,
        event_share=None,
        first=None,
        last=None,
        mobile_phone=None,
        mrn=None,
        name=None,
        sex=None,
        study_id=None,
    ):
        """Add.

        :param account_id: uuid of the account to add them to
        :param alt_email: Alternate email address (optional)
        :param alt_mobile_phone: Alternate mobile phone number (optional)
        :param birth_date: Birth date (optional)
        :param customfield_param: Expected values are CUSTOMFIELD_UUID. Custom field(s) (optional)
        :param email: Email address (optional)
        :param event_new_report: Notify the patient if a report is attached on the patient portal (optional)
        :param event_share: Notify the patient if a new study is available on the patient portal (optional)
        :param first: first
        :param last: last
        :param mobile_phone: Mobile phone number (optional)
        :param mrn: MRN (optional if study_id is used)
        :param name: name
        :param sex: Gender (optional)
        :param study_id: Id of the study to create a patient from (optional)
        """
        request_data = {
            'account_id': account_id,
            'alt_email': alt_email,
            'alt_mobile_phone': alt_mobile_phone,
            'birth_date': birth_date,
            'email': email,
            'event_new_report': event_new_report,
            'event_share': event_share,
            'first': first,
            'last': last,
            'mobile_phone': mobile_phone,
            'mrn': mrn,
            'name': name,
            'sex': sex,
            'study_id': study_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[(
            'ALREADY_EXISTS',
            None)] = AlreadyExists('The patient is already in the account')
        errors_mapping[('ALREADY_USED', None)] = AlreadyUsed(
            'The email or phone number is already used by another patient. The error_subtype holds the field that 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_EMAIL',
                        None)] = InvalidEmail('The email is invalid')
        errors_mapping[('INVALID_PHONE',
                        None)] = InvalidPhone('The phone number 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 or study was not found. The error_subtype holds the type of field not found'
        )
        errors_mapping[('NOT_PERMITTED', None)] = NotPermitted(
            'You are not permitted to add a patient to the account')
        query_data = {
            'api': self._api,
            'url': '/patient/add',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return AsyncQueryO(**query_data)
Example #6
0
    def user_add(
        self,
        uuid,
        account_alias=None,
        account_email=None,
        account_login=None,
        account_password=None,
        email=None,
        event_approve=None,
        event_case_assignment=None,
        event_harvest=None,
        event_join=None,
        event_link=None,
        event_link_mine=None,
        event_message=None,
        event_new_report=None,
        event_node=None,
        event_purge=None,
        event_share=None,
        event_status_change=None,
        event_study_comment=None,
        event_thin_study_fail=None,
        event_thin_study_success=None,
        event_upload=None,
        event_upload_fail=None,
        global_param=None,
        max_sessions=None,
        password_reset=None,
        role_id=None,
        session_expire=None,
        setting_param=None,
        settings=None,
        user_id=None,
    ):
        """User add.
        :param uuid: The account uuid
        :param account_alias: Users alias in the account. (optional).
        :param account_email: Users account_email. Only set this if it is different than the users login email (optional).
        :param account_login: Users login name in the account. (optional).
        :param account_password: Password for the account_password. (optional).
        :param email: email
        :param event_approve: Notify the user on a approval needed into the account namespace (optional)
        :param event_case_assignment: Notify the user when they are assigned a case as a medical or admin user (optional)
        :param event_harvest: Notify the user on a harvest into the account namespace (optional)
        :param event_join: Notify the user on a join request for the account (optional)
        :param event_link: Notify the user when an anonymous link is hit in the namespace (optional)
        :param event_link_mine: Notify the user when an anonymous link created by the user is hit in the namespace (optional)
        :param event_message: Notify the user when a message is sent to the account namespace (optional)
        :param event_new_report: Notify the user when a report is attached in the account namespace (optional)
        :param event_node: Notify the user when an account node sends an event (optional)
        :param event_purge: Notify the user the results of a purge job for the account (optional)
        :param event_share: Notify the user on a share into the account namespace (optional)
        :param event_status_change: Notify the user when the status of a study is changed (optional)
        :param event_study_comment: Notify the user when a comment is attached to a study in the namespace (optional)
        :param event_thin_study_fail: Notify the user when a thin study retrieval they initiated fails (optional)
        :param event_thin_study_success: Notify the user when a thin study retrieval they initiated succeeds (optional)
        :param event_upload: Notify the user on an upload into the account namespace (optional)
        :param event_upload_fail: Notify the user on a failed upload into the account namespace (optional)
        :param global_param: Flag if this is a global user. (optional).
        :param max_sessions: Over-ride value for the max number of simultaneous sessions the user can have. (optional).
        :param password_reset: Flag if the password needs to be reset. (optional).
        :param role_id: uuid of the users role in the account (optional).
        :param session_expire: Number of minutes before an idle session expires. (optional)
        :param setting_param: Set an individual setting. This is an alternative to the settings hash for easier use in the API tester (optional)
        :param settings: A hash of the account settings that the user can override (optional)
        :param user_id: user_id

        Notes:
        (email OR user_id) - The email address or uuid of the user to add
        """
        request_data = {
            'password_reset': password_reset,
            'event_status_change': event_status_change,
            'event_share': event_share,
            'account_password': account_password,
            'event_thin_study_success': event_thin_study_success,
            'event_link_mine': event_link_mine,
            'account_login': account_login,
            'event_study_comment': event_study_comment,
            'role_id': role_id,
            'event_purge': event_purge,
            'event_node': event_node,
            'global_param': global_param,
            'max_sessions': max_sessions,
            'event_message': event_message,
            'event_link': event_link,
            'settings': settings,
            'event_upload_fail': event_upload_fail,
            'email': email,
            'event_thin_study_fail': event_thin_study_fail,
            'event_new_report': event_new_report,
            'uuid': uuid,
            'event_approve': event_approve,
            'account_email': account_email,
            'event_join': event_join,
            'account_alias': account_alias,
            'session_expire': session_expire,
            'event_case_assignment': event_case_assignment,
            'user_id': user_id,
            'event_upload': event_upload,
            'event_harvest': event_harvest,
        }
        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['ALREADY_EXISTS'] = AlreadyExists(
            'The user is already a member of the account')
        errors_mapping['BAD_PASSWORD'] = BadPassword(
            'Password needs to be at least 8 characters long, contain at least two numbers, contain at least two characters and can't be one of your last three passwords'
        )
        errors_mapping['DUPLICATE_NAME'] = DuplicateName(
            'The account_login is already in use')
        errors_mapping['INVALID_CUSTOMFIELD'] = InvalidCustomfield(
            'Invalid custom field(s) name or value were passed. The error_subtype holds an array of the error details'
        )
        errors_mapping['INVALID_FLAG'] = InvalidFlag(
            'An invalid flag was passed. The error_subtype holds the name of the invalid flag'
        )
        errors_mapping['MISSING_FIELDS'] = MissingFields(
            'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields'
        )
        errors_mapping['NOT_FOUND'] = NotFound('The account can not be found')
        errors_mapping['NOT_PERMITTED'] = NotPermitted(
            'You are not permitted to add this user to the account')
        errors_mapping['USER_NOT_FOUND'] = UserNotFound(
            'The user can not be found')
        query_data = {
            'api': self._api,
            'url': '/account/user/add',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)
Example #7
0
    def set(
        self,
        birth_date,
        mrn,
        sex,
        uuid,
        alt_email=None,
        alt_mobile_phone=None,
        customfield_param=None,
        email=None,
        event_share=None,
        first=None,
        last=None,
        mobile_phone=None,
        name=None,
    ):
        """Set.
        :param birth_date: Birth date
        :param mrn: MRN
        :param sex: Gender
        :param uuid: The patient uuid
        :param alt_email: Alternate email address (optional)
        :param alt_mobile_phone: Alternate mobile phone number (optional)
        :param customfield_param: Custom field(s) (optional)
        :param email: Email address (optional)
        :param event_share: Notify the patient if a new study is available on the patient portal (optional)
        :param first: first
        :param last: last
        :param mobile_phone: Mobile phone number (optional)
        :param name: name

        Notes:
        (name OR first AND last) - Patient name as either full name or first and last
        """
        request_data = {
           'alt_email': alt_email,
           'mrn': mrn,
           'alt_mobile_phone': alt_mobile_phone,
           'uuid': uuid,
           'event_share': event_share,
           'name': name,
           'sex': sex,
           'email': email,
           'mobile_phone': mobile_phone,
           'birth_date': birth_date,
           'last': last,
           'first': first,
        }
        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['ALREADY_EXISTS'] = AlreadyExists('The MRN is in use by another patient')
        errors_mapping['ALREADY_USED'] = AlreadyUsed('The email or phone number is already used by another patient. The error_subtype holds the field that 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_EMAIL'] = InvalidEmail('The email is invalid')
        errors_mapping['INVALID_PHONE'] = InvalidPhone('The phone number is invalid')
        errors_mapping['NOT_FOUND'] = NotFound('The patient can not be found')
        errors_mapping['NOT_PERMITTED'] = NotPermitted('You are not permitted to edit the patient')
        query_data = {
            'api': self._api,
            'url': '/patient/set',
            'request_data': request_data,
            'errors_mapping': errors_mapping,
            'required_sid': True,
        }
        return QueryO(**query_data)