Retrieving data from the Clinical Knowledge Graph database

CKG has multiple cypher queries predefined to extract knowledge from the graph. These queries are part of:

These queries have been defined in YAML format. This structure allows assigning attributes such as name, description or involved nodes and relationships, which make the queries searchable using the functionality we implemented in query_utils.py.

For instance, we can use functions in this module to find within a query file, which queries involve specific types of nodes or relationships:

selected_queries = {}
queries = query_utils.read_queries(queries_file="ckg/report_manager/queries/knowledge_annotation.yml")
for data_type in queries:
    selected_queries[data_type] = query_utils.find_queries_involving_nodes(queries=queries[data_type], nodes=["Protein", "Disease"], print_pretty=True)

If you want to contribute, you can add new queries following the same structure and they will then be available for everyone.

identifier:
    name: ... # string
    description: ... # string
    involved_nodes: # list
      - ... # node type in the graph
      - ...
    involved_rels: # list
      - ... # relationship type in the graph
    query: > # string
        ...
        ...
        ... # Cypher query