Reports
OmixAtlas class enables users to interact with functional properties of the omixatlas such as create and update an Omixatlas, get summary of it's contents, add, insert, update the schema, add, update or delete datasets, query metadata, download data, save data to workspace etc.
Parameters:
-
token
(str
, default:None
) –token copy from polly.
Usage
from polly.OmixAtlas import OmixAtlas
omixatlas = OmixAtlas(token)
delete_linked_report
Delete the link of the report in workspaces with the specified dataset in OmixAtlas. On success displays a success message.
Parameters:
-
repo_key
(str
) –repo_name/repo_id of the repository which is linked.
-
dataset_id
(str
) –dataset_id of the dataset to be unlinked
-
report_id
(str
) –report id associated with the report in workspaces that is to be deleted. This id can be found when invoking the fetch_linked_report() function.
Raises:
-
InvalidParameterException
–Invalid parameter passed
Returns:
-
None
–None
fetch_linked_reports
Fetch linked reports for a dataset_id in an OmixAtlas.
Parameters:
-
repo_key
(str
) –repo_name/repo_id of the repository for which to fetch the report
-
dataset_id
(str
) –dataset_id of the dataset which to fetch the reports.
Raises:
-
InvalidParameterException
–invalid parameters
-
RequestException
–api request exception
-
UnauthorizedException
–unauthorized to perform this action
Returns:
-
DataFrame
–A Dataframe with the details of the linked reports - who added the report, when it was added and the link.
download_linked_reports
Downloads Linked Reports to the repo
Parameters:
-
repo_key
(str
) –repo_name/repo_id of the repository for which to fetch the report
-
dataset_id
(str
) –dataset_id of the dataset which to fetch the reports.
-
folder_path
(str
) –local folder path where the files need to be downloaded
Returns:
-
Download
–Downloads the datasets in the passed folder path
link_report
This function is used to link a file (html or pdf) present in a workspace with the specified dataset in OmixAtlas. On success it displays the access key URL and a success message. Org admins can now link a report present in a workspace with the specified datasets in an OmixAtlas. Once a report is linked to a dataset in OmixAtlas, it can be fetched both from front-end and polly-python. A message will be displayed on the status of the operation.
Warning
Since this function is only responsible for attaching the report, if you initially attach the report as private and later make the file public, you must re-attach the report as public.
Parameters:
-
repo_key
(str
) –repo_name/repo_id of the repository to be linked
-
dataset_id
(str
) –dataset_id of the dataset to be linked
-
workspace_id
(str / int
) –workspace_id or public url for the file which is to be linked If workspace id provided then workspace path is required, for public url it will attach as public report.
-
workspace_path
(str
, default:None
) –workspace_path for the file which is to be linked
-
access_key
(str
, default:'private'
) –access_key(private or public) depending upon the link access type to be generated. If public, then anyone with a Polly account with the link will be able to see the report. If private, only individuals who have access to the workspace where reports is stored will be able to see them.
Raises:
-
InvalidParameterException
–invalid parameters
Returns:
-
None
–None
Examples
# Install polly python
pip install polly-python
# Import libraries
from polly.auth import Polly
from polly.omixatlas import OmixAtlas
# Create omixatlas object and authenticate
AUTH_TOKEN=(os.environ['POLLY_REFRESH_TOKEN'])
Polly.auth(AUTH_TOKEN)
omixatlas = OmixAtlas()
Link html/pdf/json with a dataset
This function links a given report present in a workspace to the dataset_id of the given OmixAtlas.
repo_key = "geo"
dataset_id = "GSE100000_GPL17021"
workspace_id = 8108 # workspace_id as an integer
workspace_path = "GSE100000_GPL17021_report.html"
access_key = "private" # access can be made public if required, access_key="public"
omixatlas.link_report(repo_key, dataset_id, workspace_id, workspace_path, access_key)
File Successfully linked to dataset id = GSE100000_GPL17021. The URL for the private access is 'https://polly.elucidata.io/manage/restricted/file?id=8108&path=%2Fprojects%2F8108%2Ffiles%2FGSE100000_GPL17021_report.html'
Link URL with a dataset
This function is used to link a URL with the specified dataset in OmixAtlas. It must be a secure link i.e https://abc.com
repo_key = "geo"
dataset_id = "GSE100000_GPL17021"
url_to_be_linked = "'https://polly.elucidata.io/manage/restricted/file?id=8108&path=%2Fprojects%2F8108%2Ffiles%2FGSE100000_GPL17021_report.html'"
link_report(repo_key, dataset_id, url_to_be_linked)
Fetch reports linked with a dataset
This function is used to list of reports linked with the given dataset.
repo_key = "geo"
dataset_id = "GSE100000_GPL17021"
reports_dataframe = omixatlas.fetch_linked_reports(repo_key, dataset_id)
reports_dataframe
Added_by | Added_time | URL | Report_id | |
---|---|---|---|---|
0 | vivek.mathpal@elucidata.io | 17/02/2023 06:09:21 | https://polly.elucidata.io/manage/restricted/f... | 6aea293d-b30b-45bd-af0f-d83dcaa88b64 |
Delete linked reports
This function is used to delete a particular report linked to the respective dataset.
repo_key = "geo"
dataset_id = "GSE100000_GPL17021"
report_id = "6aea293d-b30b-45bd-af0f-d83dcaa88b64"
omixatlas.delete_linked_report(repo_key, dataset_id, report_id)
Linked file with report_id = '6aea293d-b30b-45bd-af0f-d83dcaa88b64' deleted.
Download linked reports
Download linked reports for a dataset_id
in an OmixAtlas.