diff --git a/src/hs_ontology_api/routes/assayname/assayname_controller.py b/src/hs_ontology_api/routes/assayname/assayname_controller.py index eba551f..ee34298 100644 --- a/src/hs_ontology_api/routes/assayname/assayname_controller.py +++ b/src/hs_ontology_api/routes/assayname/assayname_controller.py @@ -72,7 +72,9 @@ def assayname_post(): assaytype = {} val = r.get('value') assaytype['name'] = val.get('assaytype') - assaytype['primary'] = val.get('primary') + # July 2024 - Process states have changed from a simple binary for primary/derived to a categorical + # value of 'primary', 'derived', or 'epic'. The legacy model will observe the binary model. + assaytype['primary'] = val.get('process_state')=='primary' assaytype['description'] = val.get('description') assaytype['vitessce-hints'] = val.get('vitessce_hints') # The vis-only and contains-pii properties have been deprecated. diff --git a/src/hs_ontology_api/routes/assaytype/assaytype_controller.py b/src/hs_ontology_api/routes/assaytype/assaytype_controller.py index 55b04a0..33d472a 100644 --- a/src/hs_ontology_api/routes/assaytype/assaytype_controller.py +++ b/src/hs_ontology_api/routes/assaytype/assaytype_controller.py @@ -30,7 +30,7 @@ def assaytype_get(name=None): # Validate parameters. # Check for invalid parameter names. - err = validate_query_parameter_names(parameter_name_list=['application_context', 'is_primary']) + err = validate_query_parameter_names(parameter_name_list=['application_context', 'primary']) if err != 'ok': return make_response(err, 400) @@ -48,17 +48,24 @@ def assaytype_get(name=None): return make_response(err, 400) # Check for valid parameter values. - is_primary = request.args.get('is_primary') + # Map the legacy is_primary parameter to new process_state parameter. + is_primary = request.args.get('primary') if is_primary is not None: is_primary = is_primary.lower() val_enum = ['true', 'false'] - err = validate_parameter_value_in_enum(param_name='is_primary', param_value=is_primary, enum_list=val_enum) + err = validate_parameter_value_in_enum(param_name='primary', param_value=is_primary, enum_list=val_enum) if err != 'ok': return make_response(err, 400) + if is_primary == 'true': + process_state = 'primary' + else: + process_state = 'derived' + else: + process_state = None neo4j_instance = current_app.neo4jConnectionHelper.instance() result = assayclasses_get_logic( - neo4j_instance, assaytype=name, context=application_context) + neo4j_instance, assaytype=name, process_state=process_state, context=application_context) if (result is None or result == []): # Empty result @@ -72,7 +79,10 @@ def assaytype_get(name=None): assaytype = {} val = r.get('value') assaytype['name'] = val.get('assaytype') - assaytype['primary'] = val.get('primary') + # July 2024 - Process states have changed from a simple binary for primary/derived to a categorical + # value of 'primary', 'derived', or 'epic'. The legacy model will observe the binary model. + assaytype['primary'] = val.get('process_state') == 'primary' + #assaytype['primary'] = val.get('primary') assaytype['description'] = val.get('description') assaytype['vitessce-hints'] = val.get('vitessce_hints') # The vis-only and contains-pii properties have been deprecated.