-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from cdisc-org/add-cosmos-endpoints
Add COSMoS endpoints to the CDISC library client
- Loading branch information
Showing
5 changed files
with
217 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,3 +127,6 @@ dmypy.json | |
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# VSCode | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,42 @@ | ||
# cdisc-library-client | ||
|
||
Python client for accessing the CDISC library. Deployed to PYPI | ||
|
||
# operations | ||
## operations | ||
|
||
``` | ||
get_sdtm - get an sdtm standard | ||
get_adam - get an adam or adamig standard | ||
get_cdash - get a cdash standard | ||
get_sdtmig - gets sdtmig standard | ||
get_sendig - gets sendig standard | ||
get_cdashig - gets cdashig standard | ||
get_terminology_package - get a ct package given the version | ||
get_codelist_terms - returns an array of all terms in a codelist | ||
get_codelist_term - returns the library representation of a codelist term | ||
get_rule_catalogs - returns a list of links to all rule catalogs in the CDISC Library | ||
get_rules_catalog - returns all rules in a single rules catalog. | ||
get_rule - gets a rule definition given standard, version, and rule id | ||
get_bc_packages - get biomedical concept package list | ||
get_bc_package_biomedicalconcepts - get biomedical concept list in a package | ||
get_bc_package_biomedicalconcept - get biomedical concept in a package | ||
get_bc_latest_biomedicalconcepts - get biomedical concept list (latest versions) | ||
get_bc_latest_biomedicalconcept - get biomedical concept (latest version) | ||
get_bc_categories - get biomedical concept categories list | ||
get_bc_latest_biomedicalconcepts_category - get biomedical concepts for a given category (latest version) | ||
get_sdtm_packages - get sdtm dataset specialization package list | ||
get_sdtm_package_datasetspecializations - get sdtm dataset specialization list in a package | ||
get_sdtm_package_datasetspecialization - get sdtm dataset specialization in a package | ||
get_sdtm_latest_sdtm_datasetspecializations - get sdtm dataset specialization list (latest versions) | ||
get_sdtm_latest_sdtm_datasetspecialization - get sdtm dataset specialization (latest version) | ||
get_sdtm_domains - get sdtm dataset specialization domain list | ||
get_sdtm_latest_sdtm_datasetspecializations_domain - get a list of sdtm dataset specializations for a given domain (latest version) | ||
get_biomedicalconcept_latest_datasetspecializations - get a list of dataset specializations that specialize a biomedical concept (latest versions) | ||
``` | ||
More info on CDISC Library API endpoints can be found here: https://www.cdisc.org/cdisc-library/api-documentation | ||
|
||
More info on CDISC Library API endpoints can be found at the [CDISC Library API Portal](https://api.developer.library.cdisc.org/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
import os | ||
from cdisc_library_client import CDISCLibraryClient | ||
|
||
if __name__ == "__main__": | ||
api_key = os.environ.get("CDISC_LIBRARY_API_KEY") | ||
client = CDISCLibraryClient(api_key=api_key) | ||
|
||
# Get BC packages | ||
bc_packages = client.get_bc_packages("v2") | ||
print(f"There are {len(bc_packages)} Biomedical Concept packages") | ||
|
||
# Get BCs in package | ||
for package in bc_packages: | ||
title = package['title'] | ||
href = package['href'] | ||
package = href.split("/")[-2] | ||
biomedicalconcepts = client.get_bc_package_biomedicalconcepts("v2", package) | ||
print(f"{title} has {len(biomedicalconcepts)} Biomedical Concepts") | ||
|
||
# Get a specific BC in a package | ||
bc = client.get_bc_package_biomedicalconcept("v2", "2023-12-12", "C25298") | ||
package = bc['_links']['parentPackage']['title'] | ||
title = bc['shortName'] | ||
print(f"{title} in {package} has {len(bc['dataElementConcepts'])} Data Element Concepts") | ||
|
||
# Get latest BCs | ||
biomedicalconcepts = client.get_bc_latest_biomedicalconcepts("v2") | ||
print(f"There are {len(biomedicalconcepts)} Biomedical Concepts in the CDISC Library") | ||
|
||
# Get the latest version of a specific BC | ||
bc = client.get_bc_latest_biomedicalconcept("v2", "C25298") | ||
package = bc['_links']['parentPackage']['title'] | ||
title = bc['shortName'] | ||
print(f"{title} in {package} has {len(bc['dataElementConcepts'])} Data Element Concepts") | ||
|
||
# Get BC categories | ||
categories = client.get_bc_categories("v2") | ||
print(f"There are {len(categories)} Biomedical Concept categories") | ||
|
||
# Get latest BCs in a category | ||
biomedicalconcepts = client.get_bc_latest_biomedicalconcepts_category("v2", "RECIST 1.1") | ||
print(f"There are {len(biomedicalconcepts)} Biomedical Concepts in the RECIST 1.1 category in the CDISC Library") | ||
|
||
# Get latest BCs in a category | ||
biomedicalconcepts = client.get_bc_latest_biomedicalconcepts_category("v2", "") | ||
print(f"There are {len(biomedicalconcepts)} Biomedical Concepts in the CDISC Library") | ||
|
||
# Get SDTM Dataset Specialization Packages | ||
sdtm_packages = client.get_sdtm_packages("v2") | ||
print(f"There are {len(sdtm_packages)} SDTM Dataset Specialization packages") | ||
|
||
# Get Specializations in package | ||
for package in sdtm_packages: | ||
title = package['title'] | ||
href = package['href'] | ||
package = href.split("/")[-2] | ||
datasetspecializations = client.get_sdtm_package_datasetspecializations("v2", package) | ||
print(f"{title} has {len(datasetspecializations)} SDTM Dataset Specializations") | ||
|
||
# Get a specific SDTM Dataset Specializatio in a package | ||
sdtm = client.get_sdtm_package_datasetspecialization("v2", "2023-12-12", "SYSBP") | ||
package = sdtm['_links']['parentPackage']['title'] | ||
title = sdtm['shortName'] | ||
print(f"{title} in {package} has {len(sdtm['variables'])} Variables") | ||
|
||
# Get SDTM domains | ||
domains = client.get_sdtm_domains("v2") | ||
print(f"There are {len(domains)} SDTM domains") | ||
|
||
# Get latest SDTM Dataset Specializations | ||
specializations = client.get_sdtm_latest_sdtm_datasetspecializations("v2") | ||
print(f"There are {len(specializations)} SDTM Dataset Specializations in the CDISC Library") | ||
|
||
# Get the latest version of a specific SDTM Dataset Specialization | ||
sdtm = client.get_sdtm_latest_sdtm_datasetspecialization("v2", "SYSBP") | ||
package = sdtm['_links']['parentPackage']['title'] | ||
title = sdtm['shortName'] | ||
print(f"{title} in {package} has {len(sdtm['variables'])} Variables") | ||
|
||
# Get latest SDTM Dataset Specializations in a domain | ||
specializations = client.get_sdtm_latest_sdtm_datasetspecializations_domain("v2", "VS") | ||
print(f"There are {len(specializations)} SDTM Dataset Specializations in the VS domain in the CDISC Library") | ||
|
||
# Get latest SDTM Dataset Specializations in a domain | ||
specializations = client.get_sdtm_latest_sdtm_datasetspecializations_domain("v2", "") | ||
print(f"There are {len(specializations)} SDTM Dataset Specializations in the CDISC Library") | ||
|
||
# Get latest SDTM Dataset Specializations that specialize a Biomedical Concept | ||
specializations = client.get_biomedicalconcept_latest_datasetspecializations("v2", "") | ||
sdtm_specializations = specializations['sdtm'] | ||
print(f"There are {len(sdtm_specializations)} SDTM Dataset Specializations in the CDISC Library") | ||
|
||
# Get latest SDTM Dataset Specializations that specialize a Biomedical Concept | ||
biomedicalConcept = "C25298" | ||
specializations = client.get_biomedicalconcept_latest_datasetspecializations("v2", biomedicalConcept) | ||
sdtm_specializations = specializations['sdtm'] | ||
print(f"There are {len(sdtm_specializations)} SDTM Dataset Specializations in the CDISC Library that specialize {biomedicalConcept}") | ||
|
||
# Get latest SDTM Dataset Specializations that specialize a Biomedical Concept | ||
biomedicalConcept = "C105585" | ||
specializations = client.get_biomedicalconcept_latest_datasetspecializations("v2", biomedicalConcept) | ||
sdtm_specializations = specializations['sdtm'] | ||
print(f"There are {len(sdtm_specializations)} SDTM Dataset Specializations in the CDISC Library that specialize {biomedicalConcept}") | ||
|
||
# Get latest SDTM Dataset Specializations that specialize a Biomedical Concept | ||
biomedicalConcept = "C123456" | ||
specializations = client.get_biomedicalconcept_latest_datasetspecializations("v2", biomedicalConcept) | ||
sdtm_specializations = specializations['sdtm'] | ||
print(f"There are {len(sdtm_specializations)} SDTM Dataset Specializations in the CDISC Library that specialize {biomedicalConcept}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
__version__ = '0.1.4' | ||
__version__ = '0.1.5' | ||
|
||
import setuptools | ||
|
||
|