def get_scigraph_nodes(id_list)-> Iterator[Dict]:
    """
    Queries scigraph neighbors to get a list of nodes back

    We use the scigraph neighbors function because ids can be sent in batch
    which is faster than iteratively querying solr search
    or the scigraph graph/id function

    :return: json decoded result from scigraph_ontology._neighbors_graph
    :raises ValueError: If id is not in scigraph
    """
    scigraph = OntologyFactory().create('scigraph:data')

    chunks = [id_list[i:i + 400] for i in range(0, len(list(id_list)), 400)]
    for chunk in chunks:
        params = {
            'id': chunk,
            'depth': 0
        }

        try:
            result_graph = scigraph._neighbors_graph(**params)
            for node in result_graph['nodes']:
                yield node
        except JSONDecodeError as exception:
            # Assume json decode is due to an incorrect class ID
            # Should we handle this?
            raise ValueError(exception.doc)
def get_scigraph_nodes ( id_list ) -> Iterator [ Dict ] : scigraph = OntologyFactory ( ) . create ( 'scigraph:data' ) chunks = [ id_list [ i : i + 400 ] for i in range ( 0 , len ( list ( id_list ) ) , 400 ) ] for chunk in chunks : params = { 'id' : chunk , 'depth' : 0 } try : result_graph = scigraph . _neighbors_graph ( ** params ) for node in result_graph [ 'nodes' ] : yield node except JSONDecodeError as exception : raise ValueError ( exception . doc )
Queries scigraph neighbors to get a list of nodes back

    We use the scigraph neighbors function because ids can be sent in batch
    which is faster than iteratively querying solr search
    or the scigraph graph/id function

    :return: json decoded result from scigraph_ontology._neighbors_graph
    :raises ValueError: If id is not in scigraph