Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Previously, the source version of CTKP was hard coded, but now the pa… #271

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions parsers/clinicaltrials/src/loadCTKP.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,12 @@ def __init__(self, test_mode: bool = False, source_data_dir: str = None):
"""
super().__init__(test_mode=test_mode, source_data_dir=source_data_dir)

# until we can use the manifest to determine versions and source data file locations we'll hard code it
self.node_file_name = 'clinical_trials_kg_nodes_v2.2.10.tsv'
self.edge_file_name = 'clinical_trials_kg_edges_v2.2.10.tsv'
# Get latest source version from the manifest and use it to name node and edge files.
self.latest_version = self.get_manifest()['version']
self.node_file_name = f'clinical_trials_kg_nodes_v{self.latest_version}.tsv'
self.edge_file_name = f'clinical_trials_kg_edges_v{self.latest_version}.tsv'
self.data_url = "https://db.systemsbiology.net/gestalt/KG/"

# once we use the manifest, we'll rename the files while downloading and they can be called something generic
# self.node_file_name = 'nodes.tsv'
# self.edge_file_name = 'edges.tsv'

self.data_files = [
self.node_file_name,
self.edge_file_name
Expand All @@ -80,14 +77,12 @@ def __init__(self, test_mode: bool = False, source_data_dir: str = None):
self.source_record_url = "https://db.systemsbiology.net/gestalt/cgi-pub/KGinfo.pl?id="

def get_latest_source_version(self) -> str:
latest_version = "2.2.10"
# we'd like to do this but for now we're using the dev version which is not in the manifest
# latest_version = self.get_manifest()['version']
latest_version = self.get_manifest()['version']
return latest_version

@staticmethod
def get_manifest():
manifest_response = requests.get('https://github.com/multiomicsKP/clinical_trials_kp/blob/main/manifest.json')
manifest_response = requests.get('https://raw.githubusercontent.com/multiomicsKP/clinical_trials_kp/refs/heads/main/manifest.json')
if manifest_response.status_code == 200:
manifest = manifest_response.json()
return manifest
Expand Down