From 2595394a66f764527ca45c37d1b0e0404f6e8428 Mon Sep 17 00:00:00 2001 From: fnguyen Date: Tue, 17 Sep 2024 09:11:05 -0400 Subject: [PATCH 1/4] [wip] From a2361534cd2c534224287ccef44f5e0e39b07d46 Mon Sep 17 00:00:00 2001 From: Karen Cranston Date: Thu, 10 Oct 2024 13:29:38 -0400 Subject: [PATCH 2/4] Add link to API in readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 679588f..f28c0d1 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Query API for Katsu and HTSGet that allows for caching and pagination of calls. +[openapi spec on Swagger](https://editor.swagger.io/?url=https://raw.githubusercontent.com/CanDIG/query/main/query_server/openapi.yaml) + ## Stack - [Flask](http://flask.pocoo.org/) From 47416a55c2a8fe9f7889d969d24e64c3ba5d51e9 Mon Sep 17 00:00:00 2001 From: Daisie Huang Date: Thu, 17 Oct 2024 10:52:23 -0700 Subject: [PATCH 3/4] query needs to default to giant page size --- query_server/query_operations.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/query_server/query_operations.py b/query_server/query_operations.py index 5f8253c..2010f40 100644 --- a/query_server/query_operations.py +++ b/query_server/query_operations.py @@ -224,7 +224,9 @@ def query(treatment="", primary_site="", drug_name="", systemic_therapy_type="", (systemic_therapy_type, "systemic_therapy_type"), (exclude_cohorts, "exclude_cohorts") ] - params = {} + params = { + 'page_size': PAGE_SIZE + } for param in param_mapping: if param[0] == "" or param[0] == []: continue @@ -444,7 +446,9 @@ def discovery_query(treatment="", primary_site="", systemic_therapy="", systemic (systemic_therapy_type, "systemic_therapy_type"), (exclude_cohorts, "exclude_cohorts") ] - params = {} + params = { + "page_size": PAGE_SIZE + } for param in param_mapping: if param[0] == "" or param[0] == []: continue From ffdc3e93c68cea4e6cde46d495bc0820f1ff6dcc Mon Sep 17 00:00:00 2001 From: Daisie Huang Date: Thu, 17 Oct 2024 17:46:02 -0700 Subject: [PATCH 4/4] update query param names --- query_server/query_operations.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/query_server/query_operations.py b/query_server/query_operations.py index 2010f40..814e888 100644 --- a/query_server/query_operations.py +++ b/query_server/query_operations.py @@ -432,7 +432,7 @@ def discovery_programs(): return fix_dicts(ret_val), 200 @app.route('/discovery/query') -def discovery_query(treatment="", primary_site="", systemic_therapy="", systemic_therapy_type="", chrom="", gene="", assembly="hg38", exclude_cohorts=[]): +def discovery_query(treatment="", primary_site="", drug_name="", chrom="", gene="", assembly="hg38", exclude_cohorts=[]): url = f"{config.KATSU_URL}/v3/explorer/donors/" headers = {} for k in request.headers.keys(): @@ -442,8 +442,7 @@ def discovery_query(treatment="", primary_site="", systemic_therapy="", systemic param_mapping = [ (treatment, "treatment_type"), (primary_site, "primary_site"), - (systemic_therapy, "systemic_therapy_drug_name"), - (systemic_therapy_type, "systemic_therapy_type"), + (drug_name, "systemic_therapy_drug_name"), (exclude_cohorts, "exclude_cohorts") ] params = {