-
Notifications
You must be signed in to change notification settings - Fork 3
Home
Welcome to the CQS wiki!
The Curated Query Service (CQS) is a Rust-based RESTful web application. There are two primary endpoints for submitting TRAPI queries:
- /query
- /asyncquery
These endpoints expect to receive a TRAPI Query that meets two conditions for MVP1: the query has an Edge with a "biolink:treats" predicate and a "knowledge_type" of "inferred". Note that the CQS will never respond to queries for "lookup" "knowledge_type", but it may be expanded to support additional MVP inferred queries as use cases arise.
{
"message": {
"query_graph": {
"nodes": {
"n0": {"categories": ["biolink:ChemicalEntity"]},
"n1": {"ids": ["MONDO:0009061"]}
},
"edges": {
"e0": {"subject": "n0", "object": "n1", "predicates": ["biolink:treats"], "knowledge_type": "inferred"}
}
}
}
}
In the above example, the "n1" Node contains an array of CURIE identifiers related to a biolink:Disease. Remember that the relevant question being asked here is "What drugs may treat disease X?"
If a TRAPI Query input does NOT meet the two requisite conditions, then the CQS will return the input as is, with no further action undertaken. However, if the TRAPI Query input DOES meet the criteria for further processing, then the following will occur:
-
The "Disease" identifiers will be extracted and used to populate more elaborate, curated TRAPI Query templates.
-
Each curated TRAPI Query template will be sent to the Workflow Runner asynchronously.
-
Each received Response from the Workflow Runner undergoes a number of further transformations. These include:
a. Transform the KnowledgeGraph Edges such that a new CQS ("infores:cqs") Edge is added. The new CQS Edge can be configured to be a infores:primary-knowledge-source or infores:aggregator-knowledge-source per template. Also, the new CQS Edge is the top level Edge used to map Auxiliary (Support) Graphs from each Result. (See table here for examples of when the CQS serves as a primary or aggregator knowledge source.)
b. Then, the CQS will merge all Responses.
c. Then, Results are grouped using NodeBinding identifiers.
d. Then, Analysis scores within each Result are sorted (descending order).
e. Finally, each Result is sorted by the max Analysis score (descending order).
-
The transformed Response is returned to the ARS.
An example CQS query can be found here: https://github.com/TranslatorSRI/CQS/tree/main/templates/example-cqs-mvp-template. CQS DEV endpoint: https://cqs-dev.apps.renci.org/docs/index.html. Workflow Runner DEV endpoint: https://translator-workflow-runner.renci.org/docs#/.