def add( self, accession_number, account_id, patient_birth_date, patient_name, patient_sex, patientid, referring_physician, sending_facility, customfield_param=None, ): """Add. :param accession_number: Accession number :param account_id: uuid of the account to add them to :param patient_birth_date: DOB :param patient_name: Patient name :param patient_sex: Gender :param patientid: Patient MRN :param referring_physician: Referring physician :param sending_facility: Sending facility :param customfield_param: Custom field(s) (optional) """ request_data = { 'patient_birth_date': patient_birth_date, 'patientid': patientid, 'accession_number': accession_number, 'referring_physician': referring_physician, 'sending_facility': sending_facility, 'patient_name': patient_name, 'account_id': account_id, 'patient_sex': patient_sex, } 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_CUSTOMFIELD'] = InvalidCustomfield( 'Invalid custom field(s) name or value were passed. The error_subtype holds an array of the error details' ) 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 was not found. The error_subtype holds the type of field not found' ) errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to add a order to the account') query_data = { 'api': self._api, 'url': '/order/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def validate_customfields( self, share_code, customfield_param=None, ): """Validate customfields. :param share_code: The share code :param customfield_param: Custom field(s) """ request_data = { '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) errors_mapping = {} errors_mapping['INVALID_CUSTOMFIELD'] = InvalidCustomfield( 'Invalid custom field(s) name or value were passed. The error_subtype holds an array of the error details' ) query_data = { 'api': self._api, 'url': '/namespace/validate/customfields', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': False, } return QueryO(**query_data)
def add( self, account_id, end_time, patient_id, start_time, customfield_param=None, description=None, user_id=None, ): """Add. :param account_id: uuid of the account to add them to :param end_time: End date and time of the appointment :param patient_id: Id of the patient to create the appointment for :param start_time: Start date and time of the appointment :param customfield_param: Expected values are CUSTOMFIELD_UUID. Custom field(s) (optional) :param description: Description of the appointment (optional) :param user_id: Id of the user to create the appointment for (optional defaults to current user) """ request_data = { 'account_id': account_id, 'description': description, 'end_time': end_time, 'patient_id': patient_id, 'start_time': start_time, 'user_id': user_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_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_DATE_TIME', None)] = InvalidDateTime('The timestamp is invalid') errors_mapping[( 'INVALID_RANGE', None)] = InvalidRange('An invalid time range was specified') 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 type of object not found' ) errors_mapping[('NOT_PERMITTED', None)] = NotPermitted( 'You are not permitted to add a appointment to the account') query_data = { 'api': self._api, 'url': '/appointment/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def set( self, accession_number, patient_birth_date, patient_name, patient_sex, patientid, referring_physician, sending_facility, uuid, customfield_param=None, ): """Set. :param accession_number: Accession number :param patient_birth_date: DOB :param patient_name: Patient name :param patient_sex: Gender :param patientid: Patient MRN :param referring_physician: Referring physician :param sending_facility: Sending facility :param uuid: The order uuid :param customfield_param: Expected values are CUSTOMFIELD_UUID. Custom field(s) (optional) """ request_data = { 'accession_number': accession_number, 'patient_birth_date': patient_birth_date, 'patient_name': patient_name, 'patient_sex': patient_sex, 'patientid': patientid, 'referring_physician': referring_physician, 'sending_facility': sending_facility, '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) errors_mapping = {} 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[('NOT_FOUND', None)] = NotFound('The order can not be found') errors_mapping[( 'NOT_PERMITTED', None)] = NotPermitted('You are not permitted to edit the order') query_data = { 'api': self._api, 'url': '/order/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def set( self, uuid, assigned_admin_id=None, assigned_medical_id=None, case_status=None, closed=None, completed=None, customfield_param=None, name=None, submitted=None, ): """Set. :param uuid: The case uuid :param assigned_admin_id: Id of the admin user assigned to the case (optional) :param assigned_medical_id: Id of the medical user assigned to the case (optional) :param case_status: The case status (optional) :param closed: Flag if the case is closed (optional) :param completed: Flag if the case is completed (optional) :param customfield_param: Custom field(s) (optional) :param name: case name (optional) :param submitted: Flag if the case is submitted (optional) Notes: The rest of the fields can not be set by the case owner """ request_data = { 'case_status': case_status, 'uuid': uuid, 'name': name, 'submitted': submitted, 'closed': closed, 'assigned_admin_id': assigned_admin_id, 'completed': completed, 'assigned_medical_id': assigned_medical_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_CASE_STATUS'] = InvalidCaseStatus('Invalid case status') 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['LOCKED'] = Locked('The case is locked by another user') errors_mapping['NOT_FOUND'] = NotFound('The case or assigned user can not be found') errors_mapping['NOT_IN_ACCOUNT'] = NotInAccount('The assigned user is not in the account') errors_mapping['NOT_PERMITTED'] = NotPermitted('You are not permitted to edit the case') query_data = { 'api': self._api, 'url': '/case/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def set( self, customfields, description, end_time, start_time, user_id, uuid, status=None, ): """Set. :param customfields: An array of the custom fields associated with this appointment. Each object has the following fields (This is only returned if the group has custom fields) :param description: Description of the appointment :param end_time: End date and time of the appointment :param start_time: Start date and time of the appointment :param user_id: Id of the user :param uuid: The appointment uuid :param status: Status of the appointment (A|C|D) - Active, Cancelled, Discontinued (optional) """ request_data = { 'customfields': customfields, 'description': description, 'end_time': end_time, 'start_time': start_time, 'status': status, 'user_id': user_id, 'uuid': uuid, } errors_mapping = {} 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_DATE_TIME', None)] = InvalidDateTime('The timestamp is invalid') errors_mapping[( 'INVALID_RANGE', None)] = InvalidRange('An invalid time range was specified') errors_mapping[('NOT_FOUND', None)] = NotFound('The appointment can not be found') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted( 'You are not permitted to edit the appointment') query_data = { 'api': self._api, 'url': '/appointment/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def add( self, account_id, name, customfield_param=None, hl7_template=None, must_approve=None, must_approve_harvest=None, must_approve_move=None, must_approve_upload=None, no_share=None, role_id=None, search_threshold=None, share_code=None, share_description=None, share_settings=None, share_via_gateway=None, ): """Add. :param account_id: uuid of the account :param name: Name of the location :param customfield_param: Expected values are CUSTOMFIELD_UUID. Custom field(s) (optional) :param hl7_template: The HL7 reporting template for the location (optional) :param must_approve: Flag if shared studies must be approved for the location (optional) :param must_approve_harvest: Flag if harvested studies must be approved (optional) :param must_approve_move: Flag if moved studies must be approved (optional) :param must_approve_upload: Flag if uploaded studies must be approved (optional) :param no_share: Flag if studies can not be shared with this location (optional). Studies can still be shared with users in the location. :param role_id: Id for the default role for the location (optional) :param search_threshold: The number of studies record in the namespace to switch the UI from list to search mode (optional) :param share_code: The share code of the location (optional) :param share_description: The share description of the location (optional) :param share_settings: Share settings JSON structure of the share display settings (optional) :param share_via_gateway: Flag if a gateway share is allowed (optional) """ request_data = { 'account_id': account_id, 'hl7_template': hl7_template, 'must_approve': must_approve, 'must_approve_harvest': must_approve_harvest, 'must_approve_move': must_approve_move, 'must_approve_upload': must_approve_upload, 'name': name, 'no_share': no_share, 'role_id': role_id, 'search_threshold': search_threshold, 'share_code': share_code, 'share_description': share_description, 'share_settings': share_settings, 'share_via_gateway': share_via_gateway, } if customfield_param is not None: customfield_param_dict = { '{prefix}{k}'.format(prefix='customfield-', k=k): v for k, v in customfield_param.items() } request_data.update(customfield_param_dict) errors_mapping = {} errors_mapping[('ACCOUNT_NOT_FOUND', None)] = AccountNotFound('The account was not found') errors_mapping[('DUP_NAMESPACE_NAME', None)] = DupNamespaceName( 'namespace_names_globally_unique is enabled and there is another namespace with the same name' ) errors_mapping[('DUP_SHARE_CODE', None)] = DupShareCode('The share code is already used') errors_mapping[('INVALID_CUSTOMFIELD', None)] = InvalidCustomfield( 'Invalid custom field(s) name or value were passed. The error_subtype holds an array of the error details' ) errors_mapping[('INVALID_FLAG', None)] = InvalidFlag( 'An invalid flag was passed. The error_subtype holds the name of the invalid flag' ) errors_mapping[('INVALID_JSON', None)] = InvalidJson( 'The field is not in valid JSON format. The error_subtype holds the name of the field' ) errors_mapping[('MISSING_FIELDS', None)] = MissingFields( 'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields' ) errors_mapping[('NOT_FOUND', None)] = NotFound( 'The object was not found. The error_subtype holds the name of field that triggered the error' ) errors_mapping[('NOT_PERMITTED', None)] = NotPermitted( 'You are not permitted to add a location to the account') errors_mapping[( 'ROLE_NAMESPACE_MISMATCH', 'GLOBAL_USER_WITH_RESTRICTED_ROLE' )] = RoleNamespaceMismatch( 'You are adding the location to the account with a global user with restricted role, data contains role_id and user_id' ) errors_mapping[( 'ROLE_NAMESPACE_MISMATCH', 'INCOMPATIBLE_ROLE' )] = RoleNamespaceMismatch( 'The role cannot be used for a location, data contains role_id and namespace_id' ) query_data = { 'api': self._api, 'url': '/location/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def 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)
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)
def add( self, account_id, name, customfield_param=None, hl7_template=None, must_approve=None, must_approve_upload=None, no_share=None, role_id=None, search_threshold=None, share_code=None, share_description=None, share_settings=None, share_via_gateway=None, ): """Add. :param account_id: uuid of the account :param name: Name of the group :param customfield_param: Custom field(s) (optional) :param hl7_template: The HL7 reporting template for the group (optional) :param must_approve: Flag if shared studies must be approved for the group (optional) :param must_approve_upload: Flag if uploaded studies must be approved (optional) :param no_share: Flag if studies can not be shared with this group (optional). Studies can still be shared with users in the group. :param role_id: Id for the default role for the group (optional) :param search_threshold: The number of studies record in the namespace to switch the UI from list to search mode (optional) :param share_code: The share code of the group (optional) :param share_description: The share description of the group (optional) :param share_settings: Share settings JSON structure of the share display settings (optional) :param share_via_gateway: Flag if a gateway share is allowed (optional) """ request_data = { 'share_via_gateway': share_via_gateway, 'share_code': share_code, 'role_id': role_id, 'share_settings': share_settings, 'search_threshold': search_threshold, 'must_approve_upload': must_approve_upload, 'must_approve': must_approve, 'name': name, 'hl7_template': hl7_template, 'share_description': share_description, 'no_share': no_share, 'account_id': account_id, } if customfield_param is not None: customfield_param_dict = { '{prefix}{k}'.format(prefix='customfield-', k=k): v for k, v in customfield_param.items() } request_data.update(customfield_param_dict) errors_mapping = {} errors_mapping['ACCOUNT_NOT_FOUND'] = AccountNotFound( 'The account was not found') errors_mapping['DUP_SHARE_CODE'] = DupShareCode( 'The share code is already used') errors_mapping['INVALID_CUSTOMFIELD'] = InvalidCustomfield( 'Invalid custom field(s) name or value were passed. The error_subtype holds an array of the error details' ) errors_mapping['INVALID_FLAG'] = InvalidFlag( 'An invalid flag was passed. The error_subtype holds the name of the invalid flag' ) errors_mapping['INVALID_JSON'] = InvalidJson( 'The field is not in valid JSON format. The error_subtype holds the name of the field' ) errors_mapping['MISSING_FIELDS'] = MissingFields( 'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields' ) errors_mapping['NOT_FOUND'] = NotFound( 'The object was not found. The error_subtype holds the name of field that triggered the error' ) errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to add a group to that account') query_data = { 'api': self._api, 'url': '/group/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def set( self, can_request, uuid, css=None, customfield_param=None, hl7_template=None, must_approve=None, must_approve_upload=None, name=None, no_share=None, password_expire=None, role_id=None, search_threshold=None, session_expire=None, setting_param=None, settings=None, share_code=None, share_description=None, share_settings=None, share_via_gateway=None, vanity=None, vendor=None, ): """Set. :param can_request: Flag if user can request to join the account :param uuid: The account uuid :param css: Custom CSS for the account (optional) :param customfield_param: Custom field(s) (optional) :param hl7_template: The HL7 reporting template for the account (optional) :param must_approve: Flag if shared studies must be approved for the account namespace (optional) :param must_approve_upload: Flag if uploaded studies must be approved (optional) :param name: Name of the account (optional) :param no_share: Flag if studies can not be shared with this account (optional). Studies can still be shared with locations, groups and users in the account. :param password_expire: Number of days before account passwords expire. No expiration if zero. (optional) :param role_id: Id for the default role for the account (optional) :param search_threshold: The number of studies record in the namespace to switch the UI from list to search mode (optional) :param session_expire: Number of minutes before an idle session expires. (optional) :param setting_param: Set an individual setting. This is an alternative to the settings hash for easier use in the API tester (optional) :param settings: A hash of the account settings (optional) :param share_code: The share code of the account (optional) :param share_description: The share description of the account (optional) :param share_settings: Share settings JSON structure of the share display settings (optional) :param share_via_gateway: Flag if a gateway share is allowed (optional) :param vanity: Vanity host name for the account. Multiple host names can be specified in a comma separate list (optional) :param vendor: Vendor name (optional) """ request_data = { 'share_via_gateway': share_via_gateway, 'search_threshold': search_threshold, 'css': css, 'share_description': share_description, 'vendor': vendor, 'password_expire': password_expire, 'role_id': role_id, 'hl7_template': hl7_template, 'settings': settings, 'name': name, 'vanity': vanity, 'share_settings': share_settings, 'uuid': uuid, 'must_approve': must_approve, 'can_request': can_request, 'must_approve_upload': must_approve_upload, 'session_expire': session_expire, 'no_share': no_share, 'share_code': share_code, } if customfield_param is not None: customfield_param_dict = { '{prefix}{k}'.format(prefix='customfield-', k=k): v for k, v in customfield_param.items() } request_data.update(customfield_param_dict) if setting_param is not None: setting_param_dict = { '{prefix}{k}'.format(prefix='setting_', k=k): v for k, v in setting_param.items() } request_data.update(setting_param_dict) errors_mapping = {} errors_mapping['DUPLICATE_NAME'] = DuplicateName( 'The account name is already taken') errors_mapping['DUPLICATE_VANITY'] = DuplicateVanity( 'The vanity host name is already taken. The error_subtype holds the taken hostname' ) errors_mapping['DUP_SHARE_CODE'] = DupShareCode( 'The share code is already used') errors_mapping['INVALID_CUSTOMFIELD'] = InvalidCustomfield( 'Invalid custom field(s) name or value were passed. The error_subtype holds an array of the error details' ) errors_mapping['INVALID_FLAG'] = InvalidFlag( 'An invalid flag was passed. The error_subtype holds the name of the invalid flag' ) errors_mapping['INVALID_INTEGER'] = InvalidInteger( 'An invalid integer was passed. The error_subtype holds the name of the invalid integer' ) errors_mapping['INVALID_JSON'] = InvalidJson( 'The field is not in valid JSON format. The error_subtype holds the name of the field' ) errors_mapping['INVALID_VANITY'] = InvalidVanity( 'The vanity host name is invalid. The error_subtype holds the invalid hostname' ) errors_mapping['NOT_FOUND'] = NotFound( 'The object was not found. The error_subtype holds the name of field that triggered the error' ) errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to modify this record') query_data = { 'api': self._api, 'url': '/account/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def user_set( self, user_id, uuid, account_alias=None, account_email=None, account_login=None, account_password=None, customfield_param=None, event_approve=None, event_case_assignment=None, event_harvest=None, event_join=None, event_link=None, event_link_mine=None, event_message=None, event_new_report=None, event_node=None, event_purge=None, event_share=None, event_status_change=None, event_study_comment=None, event_thin_study_fail=None, event_thin_study_success=None, event_upload=None, event_upload_fail=None, global_param=None, max_sessions=None, password_reset=None, role_id=None, session_expire=None, setting_param=None, settings=None, ): """User set. :param user_id: The users uuid :param uuid: The account uuid :param account_alias: Users alias in the account. (optional). :param account_email: Users account_email. Only set this if it is different than the users login email (optional). :param account_login: Users login name in the account. (optional). :param account_password: Password for the account_password. (optional). :param customfield_param: Custom field(s) (optional) :param event_approve: Notify the user on a approval needed into the account namespace (optional) :param event_case_assignment: Notify the user when they are assigned a case as a medical or admin user (optional) :param event_harvest: Notify the user on a harvest into the account namespace (optional) :param event_join: Notify the user on a join request for the account (optional) :param event_link: Notify the user when an anonymous link is hit in the namespace (optional) :param event_link_mine: Notify the user when an anonymous link created by the user is hit in the namespace (optional) :param event_message: Notify the user when a message is sent to the account namespace (optional) :param event_new_report: Notify the user when a report is attached in the account namespace (optional) :param event_node: Notify the user when an account node sends an event (optional) :param event_purge: Notify the user the results of a purge job for the account (optional) :param event_share: Notify the user on a share into the account namespace (optional) :param event_status_change: Notify the user when the status of a study is changed (optional) :param event_study_comment: Notify the user when a comment is attached to a study in the namespace (optional) :param event_thin_study_fail: Notify the user when a thin study retrieval they initiated fails (optional) :param event_thin_study_success: Notify the user when a thin study retrieval they initiated succeeds (optional) :param event_upload: Notify the user on an upload into the account namespace (optional) :param event_upload_fail: Notify the user on a failed upload into the account namespace (optional) :param global_param: Flag if this is a global user. (optional). :param max_sessions: Over-ride value for the max number of simultaneous sessions the user can have. (optional). :param password_reset: Flag if the password needs to be reset. (optional). :param role_id: uuid of the users role in the account (optional). :param session_expire: Number of minutes before an idle session expires. (optional) :param setting_param: Set an individual setting. This is an alternative to the settings hash for easier use in the API tester (optional) :param settings: A hash of the account settings that the user can override (optional) """ request_data = { 'password_reset': password_reset, 'event_status_change': event_status_change, 'event_share': event_share, 'account_password': account_password, 'event_thin_study_success': event_thin_study_success, 'event_link_mine': event_link_mine, 'account_login': account_login, 'event_study_comment': event_study_comment, 'role_id': role_id, 'event_purge': event_purge, 'event_node': event_node, 'global_param': global_param, 'max_sessions': max_sessions, 'event_message': event_message, 'event_link': event_link, 'settings': settings, 'event_upload_fail': event_upload_fail, 'event_thin_study_fail': event_thin_study_fail, 'event_new_report': event_new_report, 'uuid': uuid, 'event_approve': event_approve, 'account_email': account_email, 'account_alias': account_alias, 'session_expire': session_expire, 'event_case_assignment': event_case_assignment, 'user_id': user_id, 'event_upload': event_upload, 'event_join': event_join, 'event_harvest': event_harvest, } if customfield_param is not None: customfield_param_dict = { '{prefix}{k}'.format(prefix='customfield-', k=k): v for k, v in customfield_param.items() } request_data.update(customfield_param_dict) if setting_param is not None: setting_param_dict = { '{prefix}{k}'.format(prefix='setting_', k=k): v for k, v in setting_param.items() } request_data.update(setting_param_dict) errors_mapping = {} errors_mapping['BAD_PASSWORD'] = BadPassword( 'Password needs to be at least 8 characters long, contain at least two numbers, contain at least two characters and can't be one of your last three passwords' ) errors_mapping['CAN_NOT_PROMOTE'] = CanNotPromote( 'A user can not switch themselves to an admin role if they are currently not in an admin role' ) errors_mapping['DUPLICATE_NAME'] = DuplicateName( 'The account_login is already in use') errors_mapping['INVALID_CUSTOMFIELD'] = InvalidCustomfield( 'Invalid custom field(s) name or value were passed. The error_subtype holds an array of the error details' ) errors_mapping['INVALID_FLAG'] = InvalidFlag( 'An invalid flag was passed. The error_subtype holds the name of the invalid flag' ) errors_mapping['MISSING_FIELDS'] = MissingFields( 'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields' ) errors_mapping['NOT_FOUND'] = NotFound('The account can not be found') errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to edit this user') errors_mapping['NO_USER_OVERRIDE'] = NoUserOverride( 'The setting does not allow a user override') errors_mapping['ROLE_NOT_FOUND'] = RoleNotFound( 'The role was not found or is not an account role') errors_mapping['USER_NOT_FOUND'] = UserNotFound( 'The user can not be found or is not a member of this account') query_data = { 'api': self._api, 'url': '/account/user/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def set( self, 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)