Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vemonet committed Oct 13, 2023
1 parent 6b65fe7 commit 3b935fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/trapi_predict_kit/trapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ async def add_process_time_header(request: Request, call_next):
start_time = time.time()
response = await call_next(request)
process_time = time.time() - start_time
response.headers["X-Process-Time"] = str(process_time)
response.headers["Server-Timing"] = f"total;dur={process_time}"
return response

@self.get("/health", include_in_schema=False)
Expand Down
6 changes: 6 additions & 0 deletions src/trapi_predict_kit/trapi_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ def resolve_trapi_query(reasoner_query, endpoints_list):
and any(i in subject_parents for i in query_plan[edge_qg_id]["subject_types"])
and any(i in object_parents for i in query_plan[edge_qg_id]["object_types"])
):
# TODO: pass all ids_to_predict instead of iterating
# And also pass the list of target IDs if provided: query_plan[edge_qg_id]["object_kg_id"]
# if "subject_kg_id" in query_plan[edge_id]
# and "object_kg_id" in query_plan[edge_id]
# New params are: input_ids, target_ids (target can be None, input is length 1 minimum)
for id_to_predict in query_plan[edge_id]["ids_to_predict"]:
labels_dict = get_entities_labels([id_to_predict])
label_to_predict = None
Expand Down Expand Up @@ -280,6 +285,7 @@ def resolve_trapi_query(reasoner_query, endpoints_list):
"attribute_source": "infores:openpredict",
},
],
# "knowledge_types": knowledge_types
}

# Map the source/target of query_graph to source/target of association
Expand Down

0 comments on commit 3b935fb

Please sign in to comment.