Package: iqvia-e360
E360 Clients WrapperE360™ Clients Wrapper for PythonIntroductioniqvia_e360is a Python library allowing for IQVIA E360™ users to connect to E360 Workspaces, download datasets, retrieve and create assets.FeaturesAuthentication using OIDC (internal network only) and Api Gateway (internal and external network)Handles the creation of E360 clientsProvides convenient functions for the following use-cases:List ADT reportsDownload an ADT reportUpload an ADTList workspaces, folders and assetsCreate workspaces, folders and assetsUpload a document to workspacesMove and rename a workspace assetCreate an E360 visualisation from a Plotly figureAPI KeyTo get started you will need to get an API token from your E360™Manage Accountpage. You may download a settings file, which will contains the API key and the API Gateway information needed to connect. See documentation for more details how to use the settings file.If this option is not available on your profile, please request for it to be enabled by the E360™ support team.Quick StartThe API credentials can be stored in a settings file and reused between uses, or passed directly to at creation time.A settings file can be provided using thecreate_from_settingsclassmethod:fromiqvia_e360importE360Contextcontext=E360Context.create_from_settings("<path-to-settings-file>")Connecting using Api GatewayIf you are using Api Gateway, create a file (default file name:e360.ini), and include the following configuration:[e360]api_gateway_url=https://api-gateway-url.comapi_gateway_key=my-keyverify_ssl=yesAlternatively, the configuration can be passed directly to the helper class methods as seen below:fromiqvia_e360importE360Contexte360_context=E360Context.create_with_gateway("<my-apikey>")# Optionally can pass gateway_url and verify_sslConnecting from internal networkIf you are using OIDC, it is recommended to use a settings file. This is an example OIDC settings file:[e360]verify_ssl=yesservice_directory_url=https://e360-sd-service.dev.comoidc_client_id=client-idoidc_client_secret=client-secretoidc_endpoint_url=https://e360-oidc-endpoint.dev.comuse_oidc_mode=yesoidc_user_id=user-idDocumentationclassiqvia_e360.E360Context(**kwargs)The main class for retrieving E360™ microservice clients, for interacting  with E360 Workspace assets.To facilitate initializing class instances, use of the class methods below is highly recommended.classmethodE360Context.create_from_settings(settings_path: pathlib.Path|str) -> E360ContextCreate an E360Context instance from a settings file.The settings file can be created with the following content:[e360]api_gateway_url=https://api-gateway-url.comapi_gateway_key=my-keyverify_ssl=yesExample for creating an authenticated instance ofE360Context:frompathlibimportPathfromiqvia_e360importE360Contextsettings_path=Path('/path/to/e360.ini')context=E360Context.create_from_settings(settings_path)method.get_adt_reports(**filters) -> List[AdtReportAssetModel]Retrieves a list of ADT Report assets the user can access through workspaces.Returns a list ofAdtReportAssetModelinstances.The keywordfiltersrepresents an unpacked a mapping with the following values:metadata_key(Optional): A metadata key to filter by; must be provided together with metadata_valuemetadata_value(Optional): A metadata value to filter byembed(Optional): A asset embed value to filter by -parent,metadataordatasetInfofields(Optional): A list of fields to filter bysort(Optional): A sort field value to filter by (defaults to-created)Example:context.get_adt_reports(metadata_key='mykey',metadata_value='myvalue')method.get_adt_report_by_id(id: str) -> AdtReportAssetModelReturns an instance ofAdtReportAssetModelby anidof the analytic dataset report.method.get_adt_reports_by_name(name: str) -> List[AdtReportAssetModel]Returns a list ofAdtReportAssetModelinstances filtered bynamein the asset.method.get_workspace_containers(name: str = None, include_folders: bool = False) -> List[ContainerAssetModel]Returns a list ofContainerAssetModelinstances optionally filtered bynameand if it should include folders.Args:name(Optional): The name of the container/folder.include_folders(Optional): A boolean indicating if folders should be retrieved as well as workspaces.method.move_workspace_asset(asset: AssetModel|str, target_container: ContainerAssetModel|str, new_name: str = None, hidden: bool = False) -> AssetModelChange location of a workspace asset. Also allows to optionally rename, and to make an asset visible or hidden. Returns a movedAssetModelinstance.Args:asset: The id of the asset to move, or an instance of iqvia_360.AssetModeltarget_container: The id of the container the asset is being moved to, or an instance of iqvia_360.ContainerAssetModelnew_name(Optional): The new name of the asset.hidden(Optional): A boolean indicating if the asset should not be visible in workspaces.method.create_workspace_container(target_container: ContainerAssetModel|str, name: str, description: str = None) -> ContainerAssetModelCreate a new workspace container, returnsContainerAssetModel.Args:target_container: Theidor aContainerAssetModelinstance of the parent of the new containername: The name of the new containerdescription(Optional): A description of this containermethod.download_adt_report(asset: AdtReportAssetModel|str, location: pathlib.Path|str = None) -> pathlib.Path|NoneDownload the requested analytic dataset report to the local environment.
The format of the report is pre-determined at the time of generation from its definition.Args:asset: The workspace asset instance for the required report, or the asset idlocation(Optional): The directory where the report should be downloaded; defaults to current working directorymethod.download_adt_report_by_id(report_id: str, location: pathlib.Path | str, content_type: str) -> pathlib.Path | NoneDownload the requested analytic dataset report to the local environment. The format of the report is pre-determined at the time of generation from its definition.
Returns aPathobject pointing to the downloaded report, orNoneif the download failed.Args:report_id: The id of the analytic dataset report to download.location: The directory where the report should be downloaded.content_type: They content type of the download request. Needs to be one oftext/csv,application/vnd.apache.parquetorapplication/zipmethod.create_workspace_asset(asset: AssetModel) -> AssetModelGiven an instance ofAssetModel, create it on workspaces.
Returns the instance of theasset.method.upload_document_file(target_container: ContainerModel|str, file_path: pathlib.Path|str, name: str, description: str = "") -> AssetModel|NoneUpload a local document file into E360 workspaces.
Returns anAssetModelfor the newly created asset, or None if creation failedArgs:target_container: The id of the container the asset is created in, or an instance of iqvia_360.ContainerAssetModelfile_path: The path to the document to upload
name: The asset name for the uploaded documentdescription(Optional): An asset description for the uploaded documentmethod.upload_adt_file(target_container: ContainerModel|str, file_path: pathlib.Path|str, name: str, granularity: Granularity, format_: AnalyticDatasetFormat, dataset_release_id: str = None) -> AnalyticDatasetModelUpload a local document file into E360 workspaces.
Returns an instance ofAnalyticDatasetModelfor the newly created report.Args:target_container: The id of the container the ADT asset is created in, or an instance of iqvia_360.ContainerAssetModelfile_path: The path to report that will be uploadedname: The asset name for the uploaded reportgranularity: The granularity of the data. Values can be selected fromadt_clients.models.Granularity- please look at the specific adt_clients package version to get the list of supported values.format_: The format of the data uploaded. Values can be selected fromadt_clients.models.AnalyticDatasetFormat- please look at the specific adt_clients package version to get the list of supported values.dataset_release_id(Optional): The dataset_release_id that should be associated with this data.method.create_plotly_visualization(vis_payload: dict, target_container: ContainerModel|str, name: str, description: str = "", from_plotly: bool = True) -> AssetModelProvided a plotly figure object, create an E360 visualisation.
Returns anAssetModelfor the newly created asset.Args:vis_payload: A plotly figure object.target_container: The id of the container the visualisation asset is created in, or an instance ofContainerAssetModelname: The asset name for the uploaded visualisationdescription(Optional): An asset description for the uploaded visualisationfrom_plotly(Optional): Flag to convert from a plotly payload to a VRS payload structureExample: create a simple Plotly object, and create a visualisation in the first container:importplotly.graph_objectsasgofromiqvia_e360importE360Contextcontext=E360Context.create_from_settings(...)containers=context.get_workspace_containers("Personal Workspace")fig=go.Figure(go.Scatter(x=[1,2,3],y=[1,2,3]))context.create_plotly_visualization(fig,containers[0],"My Scatter Plot")method.create_plotly_visualization_from_object(visualization_obj: BaseVisualisation, target_container: ContainerModel|str, name: str, description: str = "") -> AssetModelCreate a visualisation usinge360_chartinglibrary, create an E360 visualisation.
Returns anAssetModelfor the newly created asset.Args:visualization_obj: A visualisation created usinge360_chartinglib.target_container: The id of the container the visualisation asset is created in, or an instance ofContainerAssetModelname: The asset name for the uploaded visualisationdescription(Optional): An asset description for the uploaded visualisationExample: create a simple visualisation, and create a visualisation in the first container:frome360_chartingimportPieVisualisationfromiqvia_e360importE360Contextcontext=E360Context.create_from_settings(...)containers=context.get_workspace_containers("Personal Workspace")vis=PieVisualisation(report_title='My Pie Chart',labels=['a','b','c'],values=[33,66,1],)context.create_plotly_visualization_from_object(vis,containers[0],"My Scatter Plot")ModelsModels help keep E360 Assets organised and encapsulate their desired features.classAssetModel(BaseModel)A model fromworkspace_clients.AssetModel, which is commonly used to store metadata to assets in the workspaces.classClientStoreAssetModel(AssetModel)Base class model, from which all other model classes inherit from.method.delete(purge: bool = False) -> boolDeletes the asset from the Workspaces. SetpurgetoTrueto delete any child assets.classContainerAssetModel(ClientStoreAssetModel)Model class used to represent a Workspace container asset metadata; this can be a workspace or a folder.method.upload_adt_file(file_path: pathlib.Path|str, name: str, granularity: Granularity, format_: AnalyticDatasetFormat, dataset_release_id: str = None) -> AnalyticDatasetModelUploads a tabular file as an ADT report asset file into container.
Returns an instance ofAnalyticDatasetModelfor the newly created report.Args:file_path: The path to report that will be uploadedname: The asset name for the uploaded reportgranularity: The granularity of the data. Values can be selected fromadt_clients.models.Granularity- please look at the specific adt_clients package version to get the list of supported values.format_: The format of the data uploaded. Values can be selected fromadt_clients.models.AnalyticDatasetFormat- please look at the specific adt_clients package version to get the list of supported values.dataset_release_id(Optional): The dataset_release_id that should be associated with this data.Example:container=ContainerAssetModel(...)my_adt=container.upload_adt_file('my_file.csv','My File','csv','patient')method.create_child_container(name: str, description: str = "") -> ContainerAssetModelCreates a child container with mandatorynameand an optionaldescriptionas strings.
On success returns an object instance of classContainerAssetModel.method.upload_document(file_path: pathlib.Path|str, name: str, description: str = "") -> AssetModelUploads a file document to the Container location. Must specify thefile_pathandnamewith optionaldescriptionas strings.
On success returns an object instance of classAssetModel.classFileAssetModel(ClientStoreAssetModel)Model class used to represent a File asset metadata.classAdtDefinitionAssetModel(ClientStoreAssetModel)Model class used to represent ADT definition asset metadata.classAdtReportAssetModel(ClientStoreAssetModel)Model class used to represent ADT report asset metadata.method.download(location: pathlib.Path|str = None) -> pathlib.PathDownloads the ADT report to thelocationpath specified (optional).SupportIf you are having issues with using this library, please contact our E360 support team.