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, 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 event( self, integration_key=None, namespace_id=None, share_code=None, study_count=None, type=None, ): """Event. :param integration_key: The integration key associated with the event (optional) :param namespace_id: namespace_id :param share_code: share_code :param study_count: The number of studies associated with the event (optional) :param type: type Notes: type - The type of event (STUDY_UPLOAD_START OR STUDY_UPLOAD_END) (namespace_id OR share_code) - The namespace or share code for the event """ request_data = { 'integration_key': integration_key, 'namespace_id': namespace_id, 'study_count': study_count, 'share_code': share_code, 'type': type, } errors_mapping = {} errors_mapping['INVALID_TYPE'] = InvalidType('Invalid event type') 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': '/webhook/event', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def add( self, account_id, address, aetitle, name, node_id, path, port, c_echo_interval=None, c_echo_schedule=None, can_mwl_search=None, can_query_retrieve=None, can_retrieve_thin=None, can_search=None, cd_burn_info=None, cd_burn_name=None, cd_burn_priority=None, default_query_retrieve_level=None, fire_webhooks=None, gateway_settings=None, hl7_address=None, hl7_fetch_filter=None, hl7_port=None, push_related_studies=None, sort_order=None, sqlch_psh_if_img_unchg=None, sqlch_psh_if_route_hl7=None, type=None, ): """Add. :param account_id: uuid of the account :param address: Address of the destination (required if DICOM type) :param aetitle: Aetitle of the destination (required if DICOM type) :param name: Name of the destination :param node_id: uuid of the node that handles the destination :param path: Path of the folder for a FOLDER type of destination (required if FOLDER type) :param port: Port of the destination (required if DICOM type) :param c_echo_interval: Interval in seconds to C echo the destination (optional) :param c_echo_schedule: C echo schedule (optional) :param can_mwl_search: Can this destination support searching a modality work list (optional) :param can_query_retrieve: Can this destination support query retrieve from HL7 messages (optional) :param can_retrieve_thin: Can this destination support retrieving thin studies (optional) :param can_search: Can this destination support searching (optional) :param cd_burn_info: A JSON hash with the CD burning information (optional) :param cd_burn_name: Name for the CD burner software (optional) :param cd_burn_priority: Integer value for the burner priority (optional) :param default_query_retrieve_level: default_query_retrieve_level :param fire_webhooks: Fire webhooks for events associated with this destination (optional) :param gateway_settings: Gateway settings (optional) :param hl7_address: Address of an attached HL7 destination (optional except for VIRTUAL destinations) :param hl7_fetch_filter: A transform condition expression (see /transform/add for format) to match against the HL7 message. Only fire a query retrieve if the message matches the condition (optional) :param hl7_port: Port of an attached HL7 destination (optional except for VIRTUAL destinations) :param push_related_studies: Push all the related studies (same MRN/patientid) in the namespace when a study is pushed (optional) :param sort_order: Integer value for sorting (optional) :param sqlch_psh_if_img_unchg: Squelch pushes to the destination if the image count has not changed and the push is by a routing rule (optional) :param sqlch_psh_if_route_hl7: Squelch pushes to the destination if the push was generated by HL7 triggered routing (optional) :param type: Type of the destination either DICOM, FOLDER, ACCELERATOR,VIRTUAL, BURNER or UPLOADER. Defaults to DICOM (optional) Notes: default_query_retrieve_level - Default query retrieve level this can be either (study OR series OR image) and defaults to study if not specified (optional) """ request_data = { 'node_id': node_id, 'cd_burn_info': cd_burn_info, 'sort_order': sort_order, 'can_retrieve_thin': can_retrieve_thin, 'hl7_address': hl7_address, 'can_mwl_search': can_mwl_search, 'c_echo_interval': c_echo_interval, 'name': name, 'type': type, 'aetitle': aetitle, 'c_echo_schedule': c_echo_schedule, 'push_related_studies': push_related_studies, 'cd_burn_name': cd_burn_name, 'can_query_retrieve': can_query_retrieve, 'gateway_settings': gateway_settings, 'path': path, 'fire_webhooks': fire_webhooks, 'hl7_port': hl7_port, 'sqlch_psh_if_route_hl7': sqlch_psh_if_route_hl7, 'port': port, 'hl7_fetch_filter': hl7_fetch_filter, 'address': address, 'cd_burn_priority': cd_burn_priority, 'sqlch_psh_if_img_unchg': sqlch_psh_if_img_unchg, 'default_query_retrieve_level': default_query_retrieve_level, 'account_id': account_id, 'can_search': can_search, } errors_mapping = {} errors_mapping['DUP_AETITLE'] = DupAetitle( 'Duplicate aetitle. All destinations for the same node must have a unique aetitle' ) errors_mapping['INVALID_CD_BURN_INFO'] = InvalidCdBurnInfo( 'Invalid cd_burn_info. The error_subtype holds more detail') errors_mapping['INVALID_FLAG'] = InvalidFlag( 'An invalid flag was passed. The error_subtype holds the name of the invalid flag' ) errors_mapping['INVALID_GATEWAY_TYPE'] = InvalidGatewayType( 'The type is wrong for the gateway it is getting attached to') errors_mapping['INVALID_INTEGER'] = InvalidInteger( 'An invalid integer was passed. The error_subtype holds the name of the invalid integer' ) errors_mapping['INVALID_NODE_TYPE'] = InvalidNodeType( 'The node is not a harvester') errors_mapping['INVALID_NODE_TYPE'] = InvalidNodeType( 'The node type is invalid for this type of destination') errors_mapping['INVALID_SCHEDULE'] = InvalidSchedule( 'The schedule is invalid. The error_subtype holds the error detail' ) errors_mapping['INVALID_TYPE'] = InvalidType( 'An invalid type was passed') errors_mapping['INVALID_VALUE'] = InvalidValue( 'An invalid value was passed. The error_subtype holds the value') 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['NODE_NOT_FOUND'] = NodeNotFound( 'The node can not be found') errors_mapping['NOT_FOUND'] = NotFound('The account can not be found') errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to add a destination to this account') query_data = { 'api': self._api, 'url': '/destination/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def add( self, accelerator_id, name, account_id=None, category=None, ctc_bucket=None, facility_contact=None, facility_contact_title=None, facility_email=None, facility_name=None, facility_notes=None, facility_zip=None, group_id=None, is_public=None, location_id=None, type=None, uuid=None, ): """Add. :param accelerator_id: uuid of the accelerator if this is an accelerator node :param name: Description of the node :param account_id: account_id :param category: category :param ctc_bucket: Name of the S3 bucket to use for a cloud to cloud gateway (optional) :param facility_contact: Name of the facility contact (optional) :param facility_contact_title: Title of the facility contact (optional) :param facility_email: Email of the facility contact (optional) :param facility_name: Name of the facility it is installed at (optional) :param facility_notes: Notes about the facility (optional) :param facility_zip: Zip code of the facility it is installed at (optional) :param group_id: group_id :param is_public: Flag if the node is public (optional) :param location_id: location_id :param type: type :param uuid: uuid of the node (optional, you can use this to explicitly set the UUID) Notes: category - Node category (ACTIVE OR INACTIVE OR MIGRATION OR TEST OR DUPLICATE OR INTEGRATED OR ACCELERATOR) (optional) (account_id OR location_id OR group_id) - uuid of the account, location or group to link this node to type - Type of node (STORAGE OR HARVESTER OR ACCELERATOR OR CLEARINGHOUSE OR VIRTUAL OR UTILITY) """ request_data = { 'accelerator_id': accelerator_id, 'facility_name': facility_name, 'group_id': group_id, 'facility_contact': facility_contact, 'facility_email': facility_email, 'ctc_bucket': ctc_bucket, 'facility_notes': facility_notes, 'type': type, 'name': name, 'is_public': is_public, 'uuid': uuid, 'facility_contact_title': facility_contact_title, 'category': category, 'location_id': location_id, 'account_id': account_id, 'facility_zip': facility_zip, } errors_mapping = {} errors_mapping['ACCOUNT_NOT_FOUND'] = AccountNotFound('The account was not found') errors_mapping['INVALID_LINKAGE'] = InvalidLinkage('The linkage is invalid') errors_mapping['INVALID_TYPE'] = InvalidType('Invalid type of node') errors_mapping['INVALID_UUID'] = InvalidUuid('Invalid uuid format or this uuid is already in use') 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 add a node to this account') query_data = { 'api': self._api, 'url': '/node/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def add( self, group_id, subject, body=None, customfield_param=None, notify=None, owner_namespace_id=None, owner_user_id=None, query_type=None, recipients=None, study_id=None, ): """Add. :param group_id: Id of the group associated to a trial site to add them to :param subject: Subject line of the query :param body: The query body (optional) :param customfield_param: Expected values are CUSTOMFIELD_UUID. Custom field(s) (optional) :param notify: Comma delimited list of the emails to be notified of the query events (optional) :param owner_namespace_id: The namespace owning the query. The account default from the default_query_owner_namespace account setting is used if not passed through the parameter (optional) :param owner_user_id: The user owning the query (optional) :param query_type: The query type (optional) :param recipients: JSON array of the user UUIDs to add to the query as recipients (optional) :param study_id: The study the query is related to (optional) """ request_data = { 'body': body, 'group_id': group_id, 'notify': notify, 'owner_namespace_id': owner_namespace_id, 'owner_user_id': owner_user_id, 'query_type': query_type, 'recipients': recipients, 'study_id': study_id, 'subject': subject, } 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_GROUP', None)] = InvalidGroup( 'The group passed is not linked to a trial site') errors_mapping[('INVALID_TYPE', None)] = InvalidType( 'The passed type is not valid for the group and patient arm') 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 group's account is not configured') 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 query to the namespace') query_data = { 'api': self._api, 'url': '/query/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)
def set( self, uuid, body=None, customfield_param=None, group_id=None, notify=None, owner_user_id=None, query_type=None, recipients=None, subject=None, ): """Set. :param uuid: The query uuid :param body: The query body (optional) :param customfield_param: Expected values are CUSTOMFIELD_UUID. Custom field(s) (optional) :param group_id: Id of the group associated to a trial site to add them to. Group change is not allowed for study-related queries (optional) :param notify: Comma delimited list of the emails to be notified of the query events (optional) :param owner_user_id: The user owning the query (optional) :param query_type: The query type (optional) :param recipients: JSON array of the user UUIDs to add to the query as recipients (optional) :param subject: Subject line of the query (optional) """ request_data = { 'body': body, 'group_id': group_id, 'notify': notify, 'owner_user_id': owner_user_id, 'query_type': query_type, 'recipients': recipients, 'subject': subject, '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_GROUP', None)] = InvalidGroup( 'The group passed is not linked to a trial site or is from another account' ) errors_mapping[('INVALID_TYPE', None)] = InvalidType( 'The passed type is not valid for the group and patient arm') 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 group's account is not configured') 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 edit the query') errors_mapping[('STUDY_QUERY_GROUP_CHANGE', None)] = StudyQueryGroupChange( 'Cannot change group for the study-related query') query_data = { 'api': self._api, 'url': '/query/set', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return AsyncQueryO(**query_data)
def add( self, account_id, capture_on_share_code, customfield_param, display_order, name, required, wrapped_dicom_only, dicom_tag=None, dicom_tag_ignore_empty=None, hl7_component=None, hl7_field=None, hl7_segment=None, load_dicom_tag=None, load_from_sr=None, load_hl7=None, load_hl7_filter=None, options=None, other_dicom_tags=None, type=None, ): """Add. :param account_id: uuid of the account :param capture_on_share_code: Flag if the field should be captured during a share code exchange (only applicable to study fields) :param customfield_param: The object to associate the customfield with (Study|User_account|Group|Location|Account|Patient|Case|Order|Appointment|Dicomdata) :param display_order: Integer to order how the fields should be displayed :param name: Name of the customfield :param required: Flag if the field is required :param wrapped_dicom_only: Only capture for wrapped DICOM uploads during a share code exchange :param dicom_tag: DICOM tag to map this field to. Format should be of form (1234,1234). (only applicable to study fields) (optional) :param dicom_tag_ignore_empty: Flag to not map an empty custom field to the DICOM tag. (only applicable if a dicom_tag is specified) (optional) :param hl7_component: Component number to map this field to in HL7 ORM messages. Valid values are 1 to 64. (only applicable to study fields) (optional) :param hl7_field: Segment field number to map this field to in HL7 ORM messages. Valid values are 1 to 64. (only applicable to study fields) (optional) :param hl7_segment: hl7_segment :param load_dicom_tag: Flag to load the current value from the study into this field. (only applicable if a dicom_tag is specified) (optional) :param load_from_sr: Load the value from the structured reports in the study (only applicable to study fields) .(optional) :param load_hl7: If this is set to a HL7 message type the value of this field will be updated from the hl7_segment, hl7_field and hl7_component from incoming HL7 messages of the matching message type (only applicable to study fields) (optional) :param load_hl7_filter: Filter token for the load_hl7 option (only applicable to study fields) (optional) :param options: Additional options in JSON format (optional) :param other_dicom_tags: JSON array of other DICOM tags to map this field to. (only applicable to study fields) (optional) :param type: type Notes: object - The object to associate the customfield with (Study OR User_account OR Group OR Location OR Account OR Patient OR Case OR Order OR Appointment OR Dicomdata) type - Type of the custom field (text OR number OR date OR memo OR select OR multiselect OR radio OR checkbox OR search) hl7_segment - Segment to map this field to in HL7 ORM messages. Valid values are (NTE OR PID OR PID1 OR PV1 OR PV2 OR OBR OR DG1 OR OBX OR CTI OR BLG OR ORC) (only applicable to study fields) (optional) """ request_data = { 'load_from_sr': load_from_sr, 'dicom_tag_ignore_empty': dicom_tag_ignore_empty, 'wrapped_dicom_only': wrapped_dicom_only, 'hl7_component': hl7_component, 'capture_on_share_code': capture_on_share_code, 'dicom_tag': dicom_tag, 'type': type, 'name': name, 'options': options, 'hl7_segment': hl7_segment, 'required': required, 'load_hl7': load_hl7, 'load_dicom_tag': load_dicom_tag, 'display_order': display_order, 'hl7_field': hl7_field, 'load_hl7_filter': load_hl7_filter, 'other_dicom_tags': other_dicom_tags, '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['INVALID_DICOM_TAG'] = InvalidDicomTag( 'The DICOM tag is invalid') errors_mapping['INVALID_DICOM_TAG_OBJECT'] = InvalidDicomTagObject( 'DICOM tags can only be applied to study fields') errors_mapping['INVALID_HL7_OBJECT'] = InvalidHl7Object( 'HL7 fields can only be applied to study fields') errors_mapping['INVALID_HL7_SEGMENT'] = InvalidHl7Segment( 'Invalid segment name') errors_mapping['INVALID_JSON'] = InvalidJson( 'The field is not in valid JSON format. The error_subtype holds the name of the field' ) errors_mapping['INVALID_OBJECT'] = InvalidObject( 'An invalid object was passed.') errors_mapping['INVALID_OPTIONS'] = InvalidOptions( 'An option is invalid. The error_subtype holds the specific error message' ) errors_mapping['INVALID_SEARCH_SOURCE'] = InvalidSearchSource( 'An invalid search source was passed.') errors_mapping['INVALID_TYPE'] = InvalidType( 'An invalid type was passed.') errors_mapping['MISSING_FIELDS'] = MissingFields( 'A required field is missing or does not have data in it. The error_subtype holds a array of all the missing fields' ) errors_mapping['NOT_FOUND'] = NotFound('The account can not be found') errors_mapping['NOT_PERMITTED'] = NotPermitted( 'You are not permitted to add a customfield to this account') errors_mapping['NO_DICOM_TAG_DEFINED'] = NoDicomTagDefined( 'The load_dicom_tag flag is set but the dicom_tag field is not defined' ) query_data = { 'api': self._api, 'url': '/customfield/add', 'request_data': request_data, 'errors_mapping': errors_mapping, 'required_sid': True, } return QueryO(**query_data)