def add( self, account_id, case_sensitive, lookup, name, object, replace, ): """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 object: Object this is applied against (Study|Order|User_account|Case|Patient) :param replace: A JSON array of the field names that will be replaced for a successful lookup """ request_data = { 'account_id': account_id, 'case_sensitive': case_sensitive, 'lookup': lookup, 'name': name, 'object': object, 'replace': replace, } errors_mapping = {} errors_mapping[('INVALID_FIELD', None)] = InvalidField( 'An invalid field name was passed. The error_subtype holds the name of the invalid field' ) errors_mapping[('INVALID_FLAG', None)] = InvalidFlag( 'An invalid flag was passed. The error_subtype holds the name of the invalid flag' ) errors_mapping[('INVALID_OBJECT', None)] = InvalidObject('An invalid object 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 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': '/dictionary/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def attach_set( self, uuid, add_if_no_match=None, approve_if_match=None, delay=None, global_counter=None, run_once=None, sequence=None, skip_if_lookup_unchanged=None, skip_if_replace_has_value=None, ): """Attach set. :param uuid: The dictionary attach id :param add_if_no_match: Flag to add the lookup and replace values to the dictionary if no match occurs (optional) :param approve_if_match: Approve the object if there was a match (optional) :param delay: An integer number of seconds to delay the dictionary application (optional) :param global_counter: A flag if you want the counter to run against the account namespace instead of the object namespace (optional) :param run_once: Flag to make dictionary apply only once per object (optional) :param sequence: An integer value. Attachments are processed from low number to high number (optional) :param skip_if_lookup_unchanged: Flag to skip the lookup if the lookup field(s) are un-changed (optional) :param skip_if_replace_has_value: Flag to skip the lookup if any of the replace fields already has a value (optional) """ request_data = { 'add_if_no_match': add_if_no_match, 'approve_if_match': approve_if_match, 'delay': delay, 'global_counter': global_counter, 'run_once': run_once, 'sequence': sequence, 'skip_if_lookup_unchanged': skip_if_lookup_unchanged, 'skip_if_replace_has_value': skip_if_replace_has_value, '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 dictionary attachment can not be found') errors_mapping[( 'NOT_PERMITTED', None)] = NotPermitted('You are not permitted to do this') query_data = { 'api': self._api, 'url': '/dictionary/attach/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def patient_portal( self, account_id, count, period, time_zone, end_date=None, patient_id=None, ): """Patient portal. :param account_id: The account id :param count: The number of periods to get :param period: The time period (day|week|month|year) :param time_zone: The report's time zone. Time zone selection order: current user's time zone, time_zone parameter, UTC by default. :param end_date: The end date, default is today if not passed (optional) :param patient_id: Patient filter (optional) """ request_data = { 'account_id': account_id, 'count': count, 'end_date': end_date, 'patient_id': patient_id, 'period': period, 'time_zone': time_zone, } errors_mapping = {} errors_mapping[( 'INVALID_COUNT', None)] = InvalidCount('Invalid or excessive count value') errors_mapping[('INVALID_END_DATE', None)] = InvalidEndDate('An invalid period') errors_mapping[('INVALID_PERIOD', None)] = InvalidPeriod('An invalid period') 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 patient can not be found') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted( 'You are not permitted to view analytics for this account or namespace' ) query_data = { 'api': self._api, 'url': '/analytics/patient/portal', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def study( self, count, account_id=None, end_date=None, namespace_id=None, period=None, ): """Study. :param count: The number of periods to get :param account_id: account_id :param end_date: The end date, default is today if not passed (optional) :param namespace_id: namespace_id :param period: period Notes: period - The time period (day OR week OR month OR year) (account_id OR namespace_id) - The account or namespace to get the analytics for """ request_data = { 'period': period, 'count': count, 'end_date': end_date, 'account_id': account_id, 'namespace_id': namespace_id, } errors_mapping = {} errors_mapping['INVALID_COUNT'] = InvalidCount( 'Invalid or excessive count value') errors_mapping['INVALID_END_DATE'] = InvalidEndDate( 'An invalid period') errors_mapping['INVALID_PARAMETERS'] = InvalidParameters( 'Only pass a account_id or namespace_id') errors_mapping['INVALID_PERIOD'] = InvalidPeriod('An invalid period') 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 namespace can not be found') errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to view analytics for this account or namespace' ) query_data = { 'api': self._api, 'url': '/analytics/study', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def attach( self, uuid, account_id=None, add_if_no_match=None, approve_if_match=None, namespace_id=None, sequence=None, skip_if_lookup_unchanged=None, skip_if_replace_has_value=None, ): """Attach. :param uuid: The dictionary id :param account_id: account_id :param add_if_no_match: Flag to add the lookup and replace values to the dictionary if no match occurs (optional) :param approve_if_match: Approve the object if there was a match (optional) :param namespace_id: namespace_id :param sequence: An integer value. Attachments are processed from low number to high number (optional) :param skip_if_lookup_unchanged: Flag to skip the lookup if the lookup field(s) are un-changed (optional) :param skip_if_replace_has_value: Flag to skip the lookup if the replace field already has a value (optional) Notes: (account_id OR namespace_id) - uuid of the account or namespace to the dictionary to """ request_data = { 'skip_if_replace_has_value': skip_if_replace_has_value, 'skip_if_lookup_unchanged': skip_if_lookup_unchanged, 'uuid': uuid, 'add_if_no_match': add_if_no_match, 'sequence': sequence, 'account_id': account_id, 'namespace_id': namespace_id, 'approve_if_match': approve_if_match, } 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_PERMITTED'] = NotPermitted( 'You are not permitted to do this') query_data = { 'api': self._api, 'url': '/dictionary/attach', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def permissions( self, namespace_id=None, oauth=None, phi_namespace=None, serial_no=None, storage_namespace=None, study_id=None, study_uid=None, uuid=None, ): """Permissions. :param namespace_id: namespace_id :param oauth: Flag to return the OAuth token information for the user (optional) :param phi_namespace: phi_namespace :param serial_no: serial_no :param storage_namespace: storage_namespace :param study_id: study_id :param study_uid: study_uid :param uuid: uuid Notes: (namespace_id OR study_id OR study_uid AND storage_namespace AND phi_namespace) The uuid of the namespace or study or the study_uid/storage_namespace/phi_namespace triplet (sid OR uuid AND serial_no) - Either the sid or the node id and serial number """ request_data = { 'study_id': study_id, 'namespace_id': namespace_id, 'storage_namespace': storage_namespace, 'serial_no': serial_no, 'uuid': uuid, 'study_uid': study_uid, 'phi_namespace': phi_namespace, 'oauth': oauth, } errors_mapping = {} errors_mapping['INVALID_CREDENTIALS'] = InvalidCredentials( 'The sid or node credentials are invalid') errors_mapping['MISSING_FIELDS'] = MissingFields( 'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields' ) errors_mapping['NOT_FOUND'] = NotFound('The object was not found') query_data = { 'api': self._api, 'url': '/namespace/permissions', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def user( self, account_id, user_id, download=None, reverse=None, study_fields=None, ): """User. :param account_id: The id of the account :param user_id: The id of the user to audit :param download: Flag to create a zipped CSV file. A report_id will be returned and the file can be accessed via /report/status and /report/zip (optional) :param reverse: Flag to reverse the default sort order (optional) :param study_fields: JSON list of study fields to include in the response (optional) """ request_data = { 'account_id': account_id, 'download': download, 'reverse': reverse, 'study_fields': study_fields, 'user_id': user_id, } errors_mapping = {} errors_mapping[('FILTER_NOT_FOUND', None)] = FilterNotFound( 'The filter can not be found. The error_subtype will hold the filter UUID' ) errors_mapping[('INVALID_CONDITION', None)] = InvalidCondition( 'The condition is not support. The error_subtype will hold the filter expression this applies to' ) errors_mapping[('INVALID_FIELD', None)] = InvalidField( 'The field is not valid for this object. The error_subtype will hold the filter expression this applies to' ) 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 user was not found') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted( 'You are not permitted to access this user record') query_data = { 'api': self._api, 'url': '/audit/user', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'events' return QueryOPF(**query_data)
def can_share_stop( self, account_id, by_id, with_id, by_type=None, with_type=None, ): """Can share stop. :param account_id: The account id :param by_id: The uuid of the object that can share :param with_id: The uuid of the object that they can share with :param by_type: by_type :param with_type: with_type Notes: with_type - The type of object that they can share with (user OR account OR group OR location) by_type - The type of object that can share. (user OR account OR group OR location) """ request_data = { 'by_type': by_type, 'with_type': with_type, 'with_id': with_id, 'by_id': by_id, 'account_id': account_id, } errors_mapping = {} errors_mapping['BY_NOT_FOUND'] = ByNotFound( 'The "by" object can not be found') errors_mapping['INVALID_TYPE'] = InvalidType( 'The type of object is invalidate. The error_subtype holds the type that is invalid' ) errors_mapping['MISSING_FIELDS'] = MissingFields( 'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields' ) errors_mapping['NOT_FOUND'] = NotFound('The account can not be found') errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to perform this action') errors_mapping['WITH_NOT_FOUND'] = WithNotFound( 'The "with" object can not be found') query_data = { 'api': self._api, 'url': '/account/can/share/stop', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def add( self, frame_number, instance_uid, series_uid, json=None, phi_namespace=None, stamp=None, storage_namespace=None, study_id=None, study_uid=None, ): """Add. :param frame_number: The frame number :param instance_uid: The instance uid :param series_uid: The series uid :param json: json :param phi_namespace: phi_namespace :param stamp: stamp :param storage_namespace: storage_namespace :param study_id: study_id :param study_uid: study_uid """ request_data = { 'frame_number': frame_number, 'instance_uid': instance_uid, 'json': json, 'phi_namespace': phi_namespace, 'series_uid': series_uid, 'stamp': stamp, 'storage_namespace': storage_namespace, 'study_id': study_id, 'study_uid': study_uid, } errors_mapping = {} errors_mapping[('INVALID_JSON', None)] = InvalidJson('The field is not in valid JSON format. The error_subtype holds the name of the field') errors_mapping[('MISSING_FIELDS', None)] = MissingFields('A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields') errors_mapping[('NOT_FOUND', None)] = NotFound('The study was not found.') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted('You are not permitted to add annotations to the study') query_data = { 'api': self._api, 'url': '/annotation/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def deploy_list( self, customcode_id=None, namespace_id=None, ): """Deploy list. :param customcode_id: customcode_id :param namespace_id: namespace_id Notes: (namespace_id OR customcode_id) - uuid of either the namespace or customcode to show the deployments for """ request_data = { 'customcode_id': customcode_id, 'namespace_id': namespace_id, } errors_mapping = {} errors_mapping['FILTER_NOT_FOUND'] = FilterNotFound( 'The filter can not be found. The error_subtype will hold the filter UUID' ) errors_mapping['INVALID_CONDITION'] = InvalidCondition( 'The condition is not support. The error_subtype will hold the filter expression this applies to' ) errors_mapping['INVALID_FIELD'] = InvalidField( 'The field is not valid for this object. The error_subtype will hold the filter expression this applies to' ) errors_mapping['INVALID_SORT_FIELD'] = InvalidSortField( 'The field is not valid for this object. The error_subtype will hold the field name this applies to' ) errors_mapping['INVALID_SORT_ORDER'] = InvalidSortOrder( 'The sort order for the field is invalid. The error_subtype will hold the field name this applies to' ) errors_mapping['MISSING_FIELDS'] = MissingFields( 'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields' ) errors_mapping['NOT_FOUND'] = NotFound( 'The namespace or customcode can not be found') errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to do this') query_data = { 'api': self._api, 'url': '/customcode/deploy/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'deployments' return QueryOPSF(**query_data)
def add( self, account_id, code, language, name, type, settings=None, zip=None, ): """Add. :param account_id: uuid of the account :param code: The code :param language: Language of code (PYTHON) :param name: The name of the code :param type: Type of code (AI_CUSTOM_VALIDATION_CODE) :param settings: JSON hash of settings (optional) :param zip: Base64 encoded ZIP file (optional) """ request_data = { 'account_id': account_id, 'code': code, 'language': language, 'name': name, 'settings': settings, 'type': type, 'zip': zip, } errors_mapping = {} errors_mapping[('INVALID_LANGUAGE', None)] = InvalidLanguage('Invalid language') errors_mapping[('INVALID_TYPE', None)] = InvalidType('Invalid type') 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_HASH', None)] = NotHash('The field is not a hash') errors_mapping[( 'NOT_PERMITTED', None)] = NotPermitted('You are not permitted to add code') query_data = { 'api': self._api, 'url': '/customcode/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
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)
def get( self, raw, uuid, node_id=None, phi_namespace=None, serial_no=None, storage_namespace=None, study_id=None, study_uid=None, ): """Get. :param raw: Flag to return the raw HL7 message as well :param uuid: The hl7 uuid :param node_id: node_id :param phi_namespace: phi_namespace :param serial_no: serial_no :param storage_namespace: storage_namespace :param study_id: study_id :param study_uid: study_uid Notes: (study_id OR study_uid AND storage_namespace AND phi_namespace) - The study uuid or the storage triplet (optional) (sid OR node_id AND serial_no) - Either the sid or the node uuid and serial number """ request_data = { 'study_id': study_id, 'storage_namespace': storage_namespace, 'raw': raw, 'serial_no': serial_no, 'uuid': uuid, 'node_id': node_id, 'study_uid': study_uid, 'phi_namespace': phi_namespace, } 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 hl7 can not be found') errors_mapping['NOT_PERMITTED'] = NotPermitted('You are not permitted to access this hl7') query_data = { 'api': self._api, 'url': '/hl7/get', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def attachment_add( self, length, name, query_id, type, thumbnail_length=None, thumbnail_type=None, ): """Attachment add. :param length: The attachment size in bytes :param name: The attachment display name :param query_id: Query UUID :param type: The attachment MIME-type :param thumbnail_length: The attachment's thumbnail MIME-type (optional) :param thumbnail_type: The attachment's thumbnail size in bytes (optional) """ request_data = { 'length': length, 'name': name, 'query_id': query_id, 'thumbnail_length': thumbnail_length, 'thumbnail_type': thumbnail_type, '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_CONFIGURED', None)] = NotConfigured('The Azure keys are not configured') errors_mapping[('NOT_FOUND', None)] = NotFound('The query can not be found') errors_mapping[('NOT_PERMITTED', None)] = NotPermitted( 'You are not permitted to add attachments to this query') errors_mapping[( 'TOO_BIG', None)] = TooBig('The attachment size exceeds the limit') query_data = { 'api': self._api, 'url': '/query/attachment/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def list( self, account_id, modality=None, type=None, ): """List. :param account_id: uuid of the account :param modality: Limit to this modality (optional) :param type: Limit to this type (optional) """ request_data = { 'account_id': account_id, 'modality': modality, 'type': type, } errors_mapping = {} errors_mapping[('FILTER_NOT_FOUND', None)] = FilterNotFound( 'The filter can not be found. The error_subtype will hold the filter UUID' ) errors_mapping[('INVALID_CONDITION', None)] = InvalidCondition( 'The condition is not support. The error_subtype will hold the filter expression this applies to' ) errors_mapping[('INVALID_FIELD', None)] = InvalidField( 'The field is not valid for this object. The error_subtype will hold the filter expression this applies to' ) errors_mapping[('INVALID_SORT_FIELD', None)] = InvalidSortField( 'The field is not valid for this object. The error_subtype will hold the field name this applies to' ) errors_mapping[('INVALID_SORT_ORDER', None)] = InvalidSortOrder( 'The sort order for the field is invalid. The error_subtype will hold the field name this applies to' ) 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/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'macros' return QueryOPSF(**query_data)
def object( self, uuid, customfield_detail=None, download=None, reverse=None, ): """Object. :param uuid: The uuid of the object to audit :param customfield_detail: Flag to include the customfield name in the detail (optional) :param download: Flag to create a zipped CSV file. A report_id will be returned and the file can be accessed via /report/status and /report/zip (optional) :param reverse: Flag to reverse the default sort order (optional) """ request_data = { 'customfield_detail': customfield_detail, 'download': download, 'reverse': reverse, 'uuid': uuid, } errors_mapping = {} errors_mapping[('FILTER_NOT_FOUND', None)] = FilterNotFound( 'The filter can not be found. The error_subtype will hold the filter UUID' ) errors_mapping[('INVALID_CONDITION', None)] = InvalidCondition( 'The condition is not support. The error_subtype will hold the filter expression this applies to' ) errors_mapping[('INVALID_FIELD', None)] = InvalidField( 'The field is not valid for this object. The error_subtype will hold the filter expression this applies to' ) 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') errors_mapping[( 'NOT_PERMITTED', None)] = NotPermitted('You are not permitted to audit this object') query_data = { 'api': self._api, 'url': '/audit/object', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'events' return AsyncQueryOPF(**query_data)
def add( self, frame_number, instance_uid, series_uid, version, phi_namespace=None, storage_namespace=None, study_id=None, study_uid=None, ): """Add. :param frame_number: The frame number :param instance_uid: The instance uid :param series_uid: The series uid :param version: The frame version :param phi_namespace: phi_namespace :param storage_namespace: storage_namespace :param study_id: study_id :param study_uid: study_uid Notes: (study_id OR study_uid AND storage_namespace AND phi_namespace) The uuid of the study or the storage triplet """ request_data = { 'study_id': study_id, 'storage_namespace': storage_namespace, 'frame_number': frame_number, 'version': version, 'series_uid': series_uid, 'study_uid': study_uid, 'phi_namespace': phi_namespace, 'instance_uid': instance_uid, } 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 study was not found.') errors_mapping['NOT_PERMITTED'] = NotPermitted('You are not permitted to mark key images for the study') query_data = { 'api': self._api, 'url': '/keyimage/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
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)
def set( self, uuid, code=None, name=None, settings=None, zip=None, ): """Set. :param uuid: The code uuid :param code: The code (optional) :param name: The name of the code (optional) :param settings: JSON hash of settings (optional) :param zip: Base64 encoded ZIP file (optional) """ request_data = { 'code': code, 'name': name, 'settings': settings, 'uuid': uuid, 'zip': zip, } errors_mapping = {} errors_mapping[( 'IS_DEPLOYED', None)] = IsDeployed('The code is deployed and can not be edited') 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_HASH', None)] = NotHash('The field is not a hash') errors_mapping[( 'NOT_PERMITTED', None)] = NotPermitted('You are not permitted to edit the code') errors_mapping[('ONE_ZIP_ONLY', None)] = OneZipOnly( 'Only one code with an attached zip can be deployed to the namespace' ) query_data = { 'api': self._api, 'url': '/customcode/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def progress_add( self, queue, serial_no, state, uuid, accession_number=None, destination_id=None, detail=None, patientid=None, study_uid=None, ): """Progress add. :param queue: The queue :param serial_no: The serial number of the node :param state: The status :param uuid: The node id :param accession_number: DICOM tag (0008,0050) (optional) :param destination_id: The destination uuid (optional) :param detail: JSON detail (optional) :param patientid: DICOM tag (0010,0020) (optional) :param study_uid: Study uid (optional) """ request_data = { 'destination_id': destination_id, 'patientid': patientid, 'detail': detail, 'serial_no': serial_no, 'uuid': uuid, 'accession_number': accession_number, 'study_uid': study_uid, 'state': state, 'queue': queue, } 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 node or destination can not be found') query_data = { 'api': self._api, 'url': '/node/progress/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': False, } return QueryO(**query_data)
def list( self, account_id, strict_account_filter=None, study_extra=None, ): """List. :param account_id: Limit to activities in this account and the personal activities :param strict_account_filter: Flag to apply the account_id to personal activites as well (optional) :param study_extra: Flag to return extra study fields (optional) """ request_data = { 'account_id': account_id, 'strict_account_filter': strict_account_filter, 'study_extra': study_extra, } errors_mapping = {} errors_mapping[('FILTER_NOT_FOUND', None)] = FilterNotFound( 'The filter can not be found. The error_subtype will hold the filter UUID' ) errors_mapping[('INVALID_CONDITION', None)] = InvalidCondition( 'The condition is not support. The error_subtype will hold the filter expression this applies to' ) errors_mapping[('INVALID_FIELD', None)] = InvalidField( 'The field is not valid for this object. The error_subtype will hold the filter expression this applies to' ) errors_mapping[('INVALID_SORT_FIELD', None)] = InvalidSortField( 'The field is not valid for this object. The error_subtype will hold the field name this applies to' ) errors_mapping[('INVALID_SORT_ORDER', None)] = InvalidSortOrder( 'The sort order for the field is invalid. The error_subtype will hold the field name this applies to' ) 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': '/activity/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'activities' return QueryOPSF(**query_data)
def join( self, email, first, last, password, captcha_response=None, customfield_param=None, share_code=None, ): """Join. :param email: Email :param first: First name :param last: Last name :param password: Password :param captcha_response: Response from captcha (optional) :param customfield_param: Custom field(s) defined in the vanity_registration_customfields account setting (optional) :param share_code: Share code they are joining from (optional) """ request_data = { 'first': first, 'share_code': share_code, 'password': password, 'captcha_response': captcha_response, 'email': email, 'last': last, } 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['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['CAPTCHA_FAILED'] = CaptchaFailed('Verifying the captcha failed') errors_mapping['DUPLICATE_EMAIL'] = DuplicateEmail('The email is already used') errors_mapping['LOCKOUT'] = Lockout('Too many joins attempt') 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') query_data = { 'api': self._api, 'url': '/user/join', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': False, } return QueryO(**query_data)
def list( self, account_id, ): """List. :param account_id: uuid of the account """ request_data = { 'account_id': account_id, } errors_mapping = {} errors_mapping[('FILTER_NOT_FOUND', None)] = FilterNotFound( 'The filter can not be found. The error_subtype will hold the filter UUID' ) errors_mapping[('INVALID_CONDITION', None)] = InvalidCondition( 'The condition is not support. The error_subtype will hold the filter expression this applies to' ) errors_mapping[('INVALID_FIELD', None)] = InvalidField( 'The field is not valid for this object. The error_subtype will hold the filter expression this applies to' ) errors_mapping[('INVALID_SORT_FIELD', None)] = InvalidSortField( 'The field is not valid for this object. The error_subtype will hold the field name this applies to' ) errors_mapping[('INVALID_SORT_ORDER', None)] = InvalidSortOrder( 'The sort order for the field is invalid. The error_subtype will hold the field name this applies to' ) 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_PERMITTED', None)] = NotPermitted( 'You are not permitted to view anonymization profiles in this account' ) query_data = { 'api': self._api, 'url': '/anonymization/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'anonymization_profiles' return QueryOPSF(**query_data)
def delete( self, ): """Delete. """ request_data = { } 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') query_data = { 'api': self._api, 'url': '/user/delete', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def tags( self, language, account_id=None, phi_namespace=None, storage_namespace=None, study_uid=None, tags=None, vanity=None, ): """Tags. :param language: The ISO 639-1 language code :param account_id: account_id :param phi_namespace: phi_namespace :param storage_namespace: storage_namespace :param study_uid: study_uid :param tags: A comma separated list of the terminology tags to look up (optional) :param vanity: vanity Notes: (account_id OR vanity OR study_uid AND storage_namespace AND phi_namespace) - The uuid or vanity name of the account or study triplet to apply any account overrides for (optional) """ request_data = { 'storage_namespace': storage_namespace, 'vanity': vanity, 'tags': tags, 'language': language, 'study_uid': study_uid, 'phi_namespace': phi_namespace, 'account_id': account_id, } 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' ) query_data = { 'api': self._api, 'url': '/terminology/tags', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': False, } return QueryO(**query_data)
def list( self, dicom_tags=None, namespace_id=None, study_id=None, ): """List. :param dicom_tags: A JSON list of the DICOM tags to return (optional) :param namespace_id: namespace_id :param study_id: study_id Notes: (study_id OR namespace_id) - uuid of the study or namespace to search """ request_data = { 'study_id': study_id, 'dicom_tags': dicom_tags, 'namespace_id': namespace_id, } errors_mapping = {} errors_mapping['FILTER_NOT_FOUND'] = FilterNotFound( 'The filter can not be found. The error_subtype will hold the filter UUID' ) errors_mapping['INVALID_CONDITION'] = InvalidCondition( 'The condition is not support. The error_subtype will hold the filter expression this applies to' ) errors_mapping['INVALID_FIELD'] = InvalidField( 'The field is not valid for this object. The error_subtype will hold the filter expression this applies to' ) errors_mapping['MISSING_FIELDS'] = MissingFields( 'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields' ) errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to view the DICOM data') query_data = { 'api': self._api, 'url': '/dicomdata/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'dicomdatas' return QueryOPF(**query_data)
def found( self, search_id, serial_no, studies, uuid, ): """Found. :param search_id: The id of the search request :param serial_no: The serial number of the node :param studies: A JSON array of the studies found. Each object has the following fields: study_uid - The study_uid study_date - The study date accession_number - The accession number referring_physician - The referring physician patient_name - Patient name patientid - Patient ID patient_sex - Gender patient_birth_date - Birth date study_description - Study description modality - Modality result_fields - A JSON structure with the answers for the requested result_fields in /destination/search (optional) :param uuid: The node id """ request_data = { 'serial_no': serial_no, 'uuid': uuid, 'studies': studies, 'search_id': search_id, } errors_mapping = {} errors_mapping['ALREADY_DONE'] = AlreadyDone('The search has already had results returned against it') errors_mapping['INVALID_JSON'] = InvalidJson('The field is not in valid JSON format. The error_subtype holds the name of the field') errors_mapping['MISSING_FIELDS'] = MissingFields('A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields') errors_mapping['NOT_FOUND'] = NotFound('The node or search can not be found') query_data = { 'api': self._api, 'url': '/node/found', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': False, } return QueryO(**query_data)
def deliver( self, job_id, serial_no, uuid, ack=None, email_reason=None, status=None, status_reason=None, ): """Deliver. :param job_id: The uuid of the push job :param serial_no: The serial number of the node :param uuid: The node id :param ack: The HL7 ACK if this was an HL7 job (optional) :param email_reason: Email the user this reason for the status change (optional) :param status: status :param status_reason: Detail on the status change (optional) Notes: status - Status code of the job (S OR F OR P OR B OR U) - Success, failure, partial transfer, blocked or uncached """ request_data = { 'status_reason': status_reason, 'serial_no': serial_no, 'uuid': uuid, 'status': status, 'ack': ack, 'job_id': job_id, 'email_reason': email_reason, } errors_mapping = {} errors_mapping['INVALID_STATUS'] = InvalidStatus('Invalid status code') errors_mapping['MISSING_FIELDS'] = MissingFields('A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields') errors_mapping['NOT_FOUND'] = NotFound('The node or job can not be found') query_data = { 'api': self._api, 'url': '/node/deliver', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': False, } return QueryO(**query_data)
def user_list( self, uuid, ): """User list. :param uuid: The location id """ request_data = { 'uuid': uuid, } errors_mapping = {} errors_mapping[('FILTER_NOT_FOUND', None)] = FilterNotFound( 'The filter can not be found. The error_subtype will hold the filter UUID' ) errors_mapping[('INVALID_CONDITION', None)] = InvalidCondition( 'The condition is not support. The error_subtype will hold the filter expression this applies to' ) errors_mapping[('INVALID_FIELD', None)] = InvalidField( 'The field is not valid for this object. The error_subtype will hold the filter expression this applies to' ) errors_mapping[('INVALID_SORT_FIELD', None)] = InvalidSortField( 'The field is not valid for this object. The error_subtype will hold the field name this applies to' ) errors_mapping[('INVALID_SORT_ORDER', None)] = InvalidSortOrder( 'The sort order for the field is invalid. The error_subtype will hold the field name this applies to' ) 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 list the users at the location') query_data = { 'api': self._api, 'url': '/location/user/list', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } query_data['paginated_field'] = 'users' return AsyncQueryOPSF(**query_data)
def sps_find( self, account_id, node_id=None, serial_no=None, ): """Sps find. :param account_id: The account uuid if sid authentication is used :param node_id: node_id :param serial_no: serial_no Notes: (sid OR node_id AND serial_no) - Either the sid or the node uuid and serial number """ request_data = { 'serial_no': serial_no, 'node_id': node_id, 'account_id': account_id, } errors_mapping = {} errors_mapping['FILTER_NOT_FOUND'] = FilterNotFound( 'The filter can not be found. The error_subtype will hold the filter UUID' ) errors_mapping['INVALID_CONDITION'] = InvalidCondition( 'The condition is not support. The error_subtype will hold the filter expression this applies to' ) errors_mapping['INVALID_FIELD'] = InvalidField( 'The field is not valid for this object. The error_subtype will hold the filter expression this applies to' ) errors_mapping['MISSING_FIELDS'] = MissingFields( 'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields' ) errors_mapping['NOT_FOUND'] = NotFound('The node can not be found') errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to view orders in this account') query_data = { 'api': self._api, 'url': '/order/sps/find', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryOF(**query_data)