Skip to content

Commit

Permalink
1. The 'provider' field (IEC or External) removed from the response f…
Browse files Browse the repository at this point in the history
…or the assayclasses endpoint.

2. The 'isepc' field in the response for the dataset-types endpoints renamed to 'is_externally_processed'.
3. The 'isepic' parameter for the dataset-types endpoints is renamed to 'is_externally_processed'.
4. The 'is_externally_processed' field in the response for the dataset-types endpoints is now boolean.
5. The SmartAPI YAML updated to reflect the changes in the assayclasses and dataset-types endpoints.
  • Loading branch information
AlanSimmons committed Sep 23, 2024
1 parent c85baba commit 9865f9c
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 29 deletions.
10 changes: 3 additions & 7 deletions hs-ontology-api-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ paths:
- sennet
- HuBMAP
- SenNet
- name: isepic
- name: is_externally_processed
in: query
required: false
description: filter on whether dataset types are for EPIC datasets
Expand Down Expand Up @@ -179,7 +179,7 @@ paths:
- sennet
- HuBMAP
- SenNet
- name: isepic
- name: is_externally_processed
in: query
required: false
description: filter on whether dataset types are for EPIC datasets
Expand Down Expand Up @@ -1969,10 +1969,6 @@ components:
type: string
description: whether datasets generated by the processing workflow associated with the assay class are "primary" (from the original experiment); "derived"/"processed" (from post-experimental data processing); or "epic" (Externally Processed Integrated Collections)
example: primary
provider:
type: string
description: the provider of datasets generated by the processing workflow associate with the assay class. Possible values are "IEC" (corresponding to datasets generated by the HuBMAP/SenNet Infrastructure and Engagement Component) or "External" (complete datasets coming directly from a HuBMAP/SenNet lab--e.g., a Tissue Mapping Center).
example: IEC
vitessce_hints:
type: array
description: set of keys used to identify the type of visualization that the Vitessce application should use to represent datasets associated with the assay class.
Expand Down Expand Up @@ -2017,7 +2013,7 @@ components:
items:
type: string
example: IMC2D
isepic:
is_externally_processed:
type: string
description: whether the dataset type is for an EPIC dataset
example: false
17 changes: 7 additions & 10 deletions src/hs_ontology_api/cypher/assayclass.cypher
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,7 @@ CALL
AND ppii.CUI = context+':C004009 CUI'
RETURN DISTINCT CASE WHEN NOT ppii.CUI IS null THEN true ELSE false END AS contains_full_genetic_sequences
}
// provider
CALL
{
WITH CUIRBD,context
OPTIONAL MATCH (pRBD:Concept)-[:has_provider]->(pProvider:Concept)-[:CODE]-(cProvider:Code)-[r:PT]->(tProvider:Term)
WHERE pRBD.CUI=CUIRBD AND r.CUI=pProvider.CUI AND cProvider.SAB=context
RETURN DISTINCT tProvider.name AS provider
}

// active status
CALL
{
Expand All @@ -182,7 +175,12 @@ CALL
}
CALL
{
WITH context, CodeRBD, NameRBD, assaytype, dir_schema, tbl_schema, vitessce_hints,process_state,pipeline_shorthand,description,dataset_type,pdr_category,fig2_aggregated_assaytype,fig2_modality,fig2_category,is_multiassay,must_contain,MeasCodes,contains_full_genetic_sequences,provider,active_status
WITH
context, CodeRBD, NameRBD, assaytype, dir_schema, tbl_schema,
vitessce_hints,process_state,pipeline_shorthand,
description,dataset_type,pdr_category,
fig2_aggregated_assaytype,fig2_modality,fig2_category,
is_multiassay,must_contain,MeasCodes,contains_full_genetic_sequences,active_status
RETURN
{
rule_description:
Expand All @@ -194,7 +192,6 @@ RETURN
process_state:process_state,
pipeline_shorthand:pipeline_shorthand, description:description,
is_multiassay:is_multiassay, must_contain:must_contain,
provider:provider,
active_status:active_status,
dataset_type:
{
Expand Down
6 changes: 3 additions & 3 deletions src/hs_ontology_api/cypher/datasettypes.cypher
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ CALL
WHERE pDatasetType.CUI = CUIDatasetType
AND cEpic.CODE = 'C004034'
AND cEpic.SAB = context
RETURN DISTINCT CASE WHEN pEpic IS NULL THEN 'false' ELSE 'true' END AS isepic
RETURN DISTINCT CASE WHEN pEpic IS NULL THEN false ELSE true END AS is_externally_processed
}
WITH dataset_type,pdr_category,fig2_aggregated_assaytype,fig2_modality,fig2_category,assaytypes,isepic
WITH dataset_type,pdr_category,fig2_aggregated_assaytype,fig2_modality,fig2_category,assaytypes,is_externally_processed
$epictype_filter
RETURN
{
Expand All @@ -87,5 +87,5 @@ RETURN
category:fig2_category
},
assaytypes:assaytypes,
isepic:isepic
is_externally_processed:is_externally_processed
} AS dataset_types
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def datasettypes_get(name=None):
# Validate parameters.

# Check for invalid parameter names.
err = validate_query_parameter_names(parameter_name_list=['application_context','isepic'])
err = validate_query_parameter_names(parameter_name_list=['application_context','is_externally_processed'])
if err != 'ok':
return make_response(err, 400)

Expand All @@ -44,9 +44,9 @@ def datasettypes_get(name=None):

# Check for valid isepic. The parameter is case-insensitive
val_enum = ['TRUE','FALSE']
isepic = request.args.get('isepic')
isepic = request.args.get('is_externally_processed')
if isepic is not None:
err = validate_parameter_value_in_enum(param_name='isepic', param_value=isepic.upper(),
err = validate_parameter_value_in_enum(param_name='is_externally_processed', param_value=isepic.upper(),
enum_list=val_enum)
if err != 'ok':
return make_response(err, 400)
Expand Down
8 changes: 6 additions & 2 deletions src/hs_ontology_api/utils/neo4j_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,7 @@ def datasettypes_get_logic(neo4j_instance,datasettype=None, context=None, isepic
:param neo4j_instance: neo4j connection
:param datasettype: dataset_type
:param context: application context--i.e., HUBMAP or SENNET
:param isepic: optional filter to Epic dataset types
:param isepic: optional filter to Epic (externally processed) dataset types
"""
datasettypes: [dict] = []
Expand All @@ -1518,7 +1518,11 @@ def datasettypes_get_logic(neo4j_instance,datasettype=None, context=None, isepic
querytxt = querytxt.replace('$datasettype_filter','')

if isepic in ['true','false']:
querytxt = querytxt.replace('$epictype_filter', f"WHERE isepic='{isepic}'")
if isepic == 'true':
isepicbool = True
else:
isepicbool = False
querytxt = querytxt.replace('$epictype_filter', f"WHERE is_externally_processed={isepicbool}")
else:
querytxt = querytxt.replace('$epictype_filter','')

Expand Down
8 changes: 4 additions & 4 deletions test/test_api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,19 +186,19 @@ echo
echo | tee -a test.out
echo | tee -a test.out

echo "3. /dataset-types?application_context=HUBMAP&isepic=mango => invalid parameter; should return custom 400" | tee -a test.out
echo "3. /dataset-types?application_context=HUBMAP&is_externally_processed=mango => invalid parameter; should return custom 400" | tee -a test.out
curl --request GET \
--url "${UBKG_URL}/dataset-types?application_context=HUBMAP&isepic=mango" \
--url "${UBKG_URL}/dataset-types?application_context=HUBMAP&is_externally_processed=mango" \
--header "Accept: application/json" | cut -c1-60 | tee -a test.out
echo
echo "4. /dataset-types?application_context=HUBMAP => valid; should return 200" | tee -a test.out
curl --request GET \
--url "${UBKG_URL}/dataset-types?application_context=HUBMAP" \
--header "Accept: application/json" | cut -c1-60 | tee -a test.out
echo
echo "5. /dataset-types?application_context=HUBMAP&isepic=false => valid; should return 200" | tee -a test.out
echo "5. /dataset-types?application_context=HUBMAP&is_externally_processed=false => valid; should return 200" | tee -a test.out
curl --request GET \
--url "${UBKG_URL}/dataset-types?application_context=HUBMAP&isepic=true" \
--url "${UBKG_URL}/dataset-types?application_context=HUBMAP&is_externally_processed=true" \
--header "Accept: application/json" | tee -a test.out


Expand Down

0 comments on commit 9865f9c

Please sign in to comment.