From e358c10e89a06c78c272179925a9ca764b8dcd85 Mon Sep 17 00:00:00 2001 From: Derek Furst Date: Tue, 19 May 2026 15:39:21 -0400 Subject: [PATCH 1/2] added error handling for when the ancestors-info or descendants-info are hit without included fields. This differs from children and parents which default to the full data because those endpoints are considerably less expensive --- src/app.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/app.py b/src/app.py index 54aa57f2..c48a6cb2 100644 --- a/src/app.py +++ b/src/app.py @@ -1130,6 +1130,10 @@ def get_ancestors_info(uuid): invalid = [f for f in include_fields if f not in valid_fields] if invalid: return bad_request_error(f"Invalid include fields: {invalid}") + else: + return bad_request_error(f"Missing required parameter: 'include'. Must include a list of properties to be returned.") + else: + return bad_request_error(f"Missing required parameter: 'include'. Must include a list of properties to be returned.") result = app_neo4j_queries.get_ancestors_trimmed(neo4j_driver_instance, uuid, included_fields=include_fields) if result is None: return not_found_error(f"Entity {uuid} not found") @@ -1155,6 +1159,10 @@ def get_descendants_info(uuid): invalid = [f for f in include_fields if f not in valid_fields] if invalid: return bad_request_error(f"Invalid include fields: {invalid}") + else: + return bad_request_error(f"Missing required parameter: 'include'. Must include a list of properties to be returned.") + else: + return bad_request_error(f"Missing required parameter: 'include'. Must include a list of properties to be returned.") result = app_neo4j_queries.get_descendants_trimmed(neo4j_driver_instance, uuid, included_fields=include_fields) if result is None: return not_found_error(f"Entity {uuid} not found") From f796b844e73bf0392e4590adec844377f128ab74 Mon Sep 17 00:00:00 2001 From: Derek Furst Date: Tue, 19 May 2026 17:34:46 -0400 Subject: [PATCH 2/2] added comment descriptions for each of the new endpoints created for the new reindex procedure --- src/app.py | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/src/app.py b/src/app.py index c48a6cb2..66cef3dd 100644 --- a/src/app.py +++ b/src/app.py @@ -1114,6 +1114,24 @@ def get_entities_by_type(entity_type): # Response with the final result return jsonify(final_result) + +""" +Retrieve the document info needed for a given entity's ancestors. Result filtering for this +endpoint is required and is given by the required parameter 'include'. +For example /ancestors-info?include=uuid,status,entity_type + + +Parameters +---------- +include : str + A comma delimited string of all the properties to be retrieved by the endpoint + +Returns +------- +json + A list of dicts where each dict contains the requested fields for the given ancestor. +""" + @app.route('/ancestors-info/', methods=['GET']) def get_ancestors_info(uuid): validate_token_if_auth_header_exists(request) @@ -1143,6 +1161,22 @@ def get_ancestors_info(uuid): return jsonify(ordered_response) +""" +Retrieve the document info needed for a given entity's descendant. Result filtering for this +endpoint is required and is given by the required parameter 'include'. +For example /descendants-info?include=uuid,status,entity_type + + +Parameters +---------- +include : str + A comma delimited string of all the properties to be retrieved by the endpoint + +Returns +------- +json + A list of dicts where each dict contains the requested fields for the given descendant. +""" @app.route('/descendants-info/', methods=['GET']) def get_descendants_info(uuid): validate_token_if_auth_header_exists(request) @@ -1171,6 +1205,23 @@ def get_descendants_info(uuid): ordered_response = [alphabetize_dict_recursive(entity) for entity in complete] return jsonify(ordered_response) + +""" +Retrieve the document info needed for a given entity's parents (immediate ancestors). Result filtering for this +endpoint is allowed and is given by the required parameter 'include'. +For example /parents-info?include=uuid,status,entity_type + + +Parameters +---------- +include : str + A comma delimited string of all the properties to be retrieved by the endpoint + +Returns +------- +json + A list of dicts where each dict contains the requested fields for the given parent. +""" @app.route('/parents-info/', methods=['GET']) def get_parents_info(uuid): validate_token_if_auth_header_exists(request) @@ -1196,6 +1247,22 @@ def get_parents_info(uuid): return jsonify(ordered_response) +""" +Retrieve the document info needed for a given entity's children (immediate descendants). Result filtering for this +endpoint is allowed and is given by the required parameter 'include'. +For example /children-info?include=uuid,status,entity_type + + +Parameters +---------- +include : str + A comma delimited string of all the properties to be retrieved by the endpoint + +Returns +------- +json + A list of dicts where each dict contains the requested fields for the given child. +""" @app.route('/children-info/', methods=['GET']) def get_children_info(uuid): validate_token_if_auth_header_exists(request)