0%

How to use the solr_request function from the impc-api python package

The solr_request function performs a single Solr request to the IMPC Solr API.

Here is an example:

num_found, df = solr_request(
    core='statistical-result', 
    params={
        'q': '*:*'
    }
)

The solr_request function uploads the found data as a pandas DataFrame. It requires two parameters:

  1. core: The name of the IMPC Solr core.
  2. params: A dictionary containing the Solr API call parameters.

This function is useful for short queries and prototyping, particularly if you need to download a large dataset later on. In the output of the solr_request function, you will find:

  • The URL with your request, containing encoded special characters, which can be opened in the browser.
  • The number of found documents.
  • A pandas DataFrame with the retrieved data.
Output of solr_request function is:
1. Your request URL.
2. Number of found documents.
3. Table with your query result which includes four columns: doc_id, allele_accession_id, allele_name, allele_symbol. Two rows of value are included.

Figure 4. Output of solr_request function.