def template_activate( self, uuid, ): """Template activate. :param uuid: uuid of the template """ request_data = { 'uuid': uuid, } errors_mapping = {} 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 radreport template can not be found') errors_mapping[('NOT_SYSADMIN_OR_SUPPORT', None)] = NotSysadminOrSupport( 'The user is not a sysadmin or support user') query_data = { 'api': self._api, 'url': '/radreport/template/activate', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def add( self, message, serial_no, uuid, accession_number=None, ): """Add. :param message: The HL7 message :param serial_no: The serial number of the node :param uuid: The node id :param accession_number: Use this accession number instead of the accession number in the HL7 message (optional) """ request_data = { 'accession_number': accession_number, 'message': message, 'serial_no': serial_no, 'uuid': uuid, } errors_mapping = {} errors_mapping[('INVALID_MESSAGE', None)] = InvalidMessage('The message could not parsed as a HL7 message') 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 node can not be found') query_data = { 'api': self._api, 'url': '/hl7/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': False, } return AsyncQueryO(**query_data)
def template_set( self, body, name, uuid, ): """Template set. :param body: The HL7 message with replacement expressions :param name: Name of the template :param uuid: The template id """ request_data = { 'body': body, 'name': name, 'uuid': uuid, } errors_mapping = {} errors_mapping[('INVALID_HL7', None)] = InvalidHl7('The body is not a valid HL7 message') 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 template can not be found') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted('You are not permitted to do this') query_data = { 'api': self._api, 'url': '/hl7/template/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def i18next( self, lng, account_id=None, vanity=None, ): """I18next. :param lng: The language code :param account_id: account_id :param vanity: vanity """ request_data = { 'account_id': account_id, 'lng': lng, 'vanity': vanity, } errors_mapping = {} 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') query_data = { 'api': self._api, 'url': '/terminology/i18next', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': False, } return AsyncQueryO(**query_data)
def get( self, key, ): """Get. :param key: The help key """ request_data = { 'key': key, } errors_mapping = {} 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 help was not found') query_data = { 'api': self._api, 'url': '/help/get', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def list( self, phi_namespace=None, storage_namespace=None, study_id=None, study_uid=None, ): """List. :param phi_namespace: phi_namespace :param storage_namespace: storage_namespace :param study_id: study_id :param study_uid: study_uid """ request_data = { 'phi_namespace': phi_namespace, 'storage_namespace': storage_namespace, 'study_id': study_id, 'study_uid': study_uid, } errors_mapping = {} 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 view the study or key images for the study') query_data = { 'api': self._api, 'url': '/keyimage/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def account_overrides( self, account_id=None, phi_namespace=None, storage_namespace=None, study_uid=None, vanity=None, ): """Account overrides. :param account_id: account_id :param phi_namespace: phi_namespace :param storage_namespace: storage_namespace :param study_uid: study_uid :param vanity: vanity """ request_data = { 'account_id': account_id, 'phi_namespace': phi_namespace, 'storage_namespace': storage_namespace, 'study_uid': study_uid, 'vanity': vanity, } errors_mapping = {} 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 vanity was not found') query_data = { 'api': self._api, 'url': '/terminology/account/overrides', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def add( self, account_id, name, ): """Add. :param account_id: uuid of the account to add them to :param name: Name of the rule set """ request_data = { 'account_id': account_id, 'name': name, } errors_mapping = {} 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 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 rule set to the account') query_data = { 'api': self._api, 'url': '/rule_set/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def set( self, uuid, name=None, ): """Set. :param uuid: The rule set uuid :param name: Name of the rule set (optional) """ request_data = { 'name': name, 'uuid': uuid, } errors_mapping = {} 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 rule set can not be found') errors_mapping[( 'NOT_PERMITTED', None)] = NotPermitted('You are not permitted to edit the rule set') query_data = { 'api': self._api, 'url': '/rule_set/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def unlock( self, uuid, ): """Unlock. :param uuid: Id of the radreport """ request_data = { 'uuid': uuid, } errors_mapping = {} errors_mapping[('ALREADY', None)] = Already('This report is not locked') errors_mapping[('LOCKED', None)] = Locked( 'This radreport is locked at the moment by another user. 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 radreport was not found.') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted( 'You are not permitted to lock the radreport') query_data = { 'api': self._api, 'url': '/radreport/unlock', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def delete( self, uuid, ): """Delete. :param uuid: uuid of the macro """ request_data = { 'uuid': uuid, } errors_mapping = {} 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_PERMITTED', None)] = NotPermitted( 'You are not permitted to perform this operation') query_data = { 'api': self._api, 'url': '/radreportmacro/delete', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def description( self, uuid, ): """Description. :param uuid: Id of the radreport """ request_data = { 'uuid': uuid, } errors_mapping = {} 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 radreport was not found.') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted( 'You are not permitted to view the radreport') query_data = { 'api': self._api, 'url': '/radreport/description', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def delete( self, uuid, ): """Delete. :param uuid: Id of the radreport """ request_data = { 'uuid': uuid, } errors_mapping = {} errors_mapping[('LOCKED', None)] = Locked( 'Only if account.settings.enable_radreport_lock_reading is set. This radreport is locked at the moment, should be unlocked before. 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 radreport was not found.') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted( 'You are not permitted to delete the radreport') query_data = { 'api': self._api, 'url': '/radreport/delete', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def audit( self, action, detail, uuid, ): """Audit. :param action: The audit action (SIGNED|MEDICAL_EDIT|ADMIN_EDIT|REPORT_GENERATED) :param detail: Additional information :param uuid: The id of the radreport """ request_data = { 'action': action, 'detail': detail, 'uuid': uuid, } errors_mapping = {} errors_mapping[('INVALID_ACTION', None)] = InvalidAction('An invalid action was passed') 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 radreport can not be found') query_data = { 'api': self._api, 'url': '/radreport/audit', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def delete( self, uuid, ): """Delete. :param uuid: Id of the validation rule """ request_data = { 'uuid': uuid, } errors_mapping = {} errors_mapping[( 'IN_USE', None)] = InUse('The validation rule is used in a routing rule') 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 validation rule was not found.') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted( 'You are not permitted to delete the validation rule') query_data = { 'api': self._api, 'url': '/validate/delete', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def delete( self, uuid, ): """Delete. :param uuid: The anonymization profile uuid """ request_data = { 'uuid': uuid, } errors_mapping = {} errors_mapping[('IN_USE', None)] = InUse( 'The anonymization profile is connected to an account and cannot be removed' ) 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 anonymization profile can not be found') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted( 'You are not permitted to delete the anonymization profile') query_data = { 'api': self._api, 'url': '/anonymization/delete', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def status( self, report_id, ): """Status. :param report_id: The report id """ request_data = { 'report_id': report_id, } errors_mapping = {} 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 report can not be found') errors_mapping[('REPORT_FAILED', None)] = ReportFailed('The report failed') query_data = { 'api': self._api, 'url': '/report/status', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def study_list( self, uuid, viewable_only, ): """Study list. :param uuid: The patient id :param viewable_only: Flag if they only want the studies the user can view """ request_data = { 'uuid': uuid, 'viewable_only': viewable_only, } errors_mapping = {} 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 patient can not be found') errors_mapping[( 'NOT_PERMITTED', None)] = NotPermitted('You are not permitted to view this patient') query_data = { 'api': self._api, 'url': '/patient/study/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def get( self, uuid, ): """Get. :param uuid: The QC Task uuid """ request_data = { 'uuid': uuid, } errors_mapping = {} 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 QC Task can not be found') errors_mapping[( 'NOT_PERMITTED', None)] = NotPermitted('You are not permitted to view the QC Task') query_data = { 'api': self._api, 'url': '/qctask/get', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def portal_login( self, patient_id, pin, ): """Portal login. :param patient_id: The patient id :param pin: The PIN """ request_data = { 'patient_id': patient_id, 'pin': pin, } errors_mapping = {} errors_mapping[('INVALID_PIN', None)] = InvalidPin('The PIN is invalid or expired') errors_mapping[('LOCKOUT', None)] = Lockout('Too many failed attempts') 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 patient can not be found') errors_mapping[( 'NOT_PERMITTED', None)] = NotPermitted('You are not permitted to do this') query_data = { 'api': self._api, 'url': '/patient/portal/login', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': False, } return AsyncQueryO(**query_data)
def list( self, language, tags, account_id=None, vanity=None, ): """List. :param language: The ISO 639-1 language code :param tags: A comma separated list of the terminology tags to look up :param account_id: account_id :param vanity: vanity """ request_data = { 'account_id': account_id, 'language': language, 'tags': tags, 'vanity': vanity, } errors_mapping = {} 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') query_data = { 'api': self._api, 'url': '/terminology/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': False, } return AsyncQueryO(**query_data)
def log( self, bucket, rest_params=None, ): """Log. :param bucket: Name of the bucket to log to :param rest_params: Parameters are logged to a message in the bucket """ request_data = { 'bucket': bucket, } if rest_params is not None: rest_params_dict = { '{prefix}{k}'.format(prefix='', k=k): v for k, v in rest_params.items() } request_data.update(rest_params_dict) errors_mapping = {} errors_mapping[('INVALID_BUCKET', None)] = InvalidBucket( 'The bucket name can only contain A-z characters and must be between 4 and 16 characters long' ) 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' ) query_data = { 'api': self._api, 'url': '/audit/log', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def set( self, key, text, ): """Set. :param key: The help key :param text: The help text """ request_data = { 'key': key, 'text': text, } errors_mapping = {} 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_SYSADMIN_OR_SUPPORT', None)] = NotSysadminOrSupport( 'The user is not a sysadmin or support user') query_data = { 'api': self._api, 'url': '/help/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def get( self, key, user_id=None, ): """Get. :param key: The key to get :param user_id: A sysadmin user can get the value for a specific user (optional) """ request_data = { 'key': key, 'user_id': user_id, } errors_mapping = {} 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' ) query_data = { 'api': self._api, 'url': '/setting/get', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def parse_fields( self, message, fields=None, ): """Parse fields. :param message: HL7 message to parse :param fields: Comma delimited list of the field to return. Use the notation specified in /hl7/transform/add (optional) """ request_data = { 'fields': fields, 'message': message, } errors_mapping = {} errors_mapping[('INVALID_MESSAGE', None)] = InvalidMessage('The message could not parsed as a HL7 message') 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') query_data = { 'api': self._api, 'url': '/hl7/parse/fields', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': False, } return AsyncQueryO(**query_data)
def set( self, key, value, user_id=None, ): """Set. :param key: The key to store the value under. If the key name begins with temp_ it is only available for the session. :param value: The value to store :param user_id: A sysadmin user can set the value for a specific user (optional) """ request_data = { 'key': key, 'user_id': user_id, 'value': value, } errors_mapping = {} 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' ) query_data = { 'api': self._api, 'url': '/setting/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def extract_report( self, uuid, ): """Extract report. :param uuid: The HL7 uuid """ request_data = { 'uuid': uuid, } errors_mapping = {} 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_CONFIGURED', None)] = NotConfigured('The node setting report_from_hl7 is not configured') errors_mapping[('NOT_FOUND', None)] = NotFound('The HL7 can not be found') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted('You are not permitted to access this HL7 message') query_data = { 'api': self._api, 'url': '/hl7/extract/report', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def delete( self, object, object_id, tag, ): """Delete. :param object: Object class to apply it to (Study|User_account|Group|Location|Account|Patient|Case|Order) :param object_id: UUID of the object :param tag: Value of the tag """ request_data = { 'object': object, 'object_id': object_id, 'tag': tag, } errors_mapping = {} errors_mapping[('INVALID_OBJECT', None)] = InvalidObject('The object type 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 object was not found') query_data = { 'api': self._api, 'url': '/tag/delete', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def user_delete( self, user_id, uuid, ): """User delete. :param user_id: The user id :param uuid: The location id """ request_data = { 'user_id': user_id, 'uuid': uuid, } errors_mapping = {} 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 location can not be found') errors_mapping[( 'NOT_PERMITTED', None)] = NotPermitted('You are not permitted to edit the location') query_data = { 'api': self._api, 'url': '/location/user/delete', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def template_get_type( self, account_id, type, ): """Template get type. :param account_id: uuid of the account :param type: Type of the template """ request_data = { 'account_id': account_id, 'type': type, } errors_mapping = {} 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 radreport template can not be found') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted( 'You are not permitted to perform this operation') query_data = { 'api': self._api, 'url': '/radreport/template/get/type', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)