def get_facets(solr_api_url,solr_api_key,q=query,fields=["document_uuid_s","guidance_s","effectendpoint_s"]):
    config,config_servers, config_security, auth_object, msg = aa.parseOpenAPI3() 
    if auth_object!=None:
        auth_object.setKey(solr_api_key)    
    facets = client_solr.Facets()
    facets.set_annotation_folder(annotation_folder)
    return  facets.summary(solr_api_url,auth_object, query=q,fields=fields)        
Ejemplo n.º 2
0
def retrieve_params(solr_api_url, solr_api_key):
    config, config_servers, config_security, auth_object, msg = aa.parseOpenAPI3(
    )
    if auth_object != None:
        auth_object.setKey(solr_api_key)
    r = client_solr.get(solr_api_url,
                        query={
                            "q": "*:*",
                            "wt": "csv",
                            "rows": 0
                        },
                        auth=auth_object)

    params = pd.read_csv(io.StringIO(r.content.decode('utf-8')))
    tmp = pd.DataFrame(params.columns, columns=["field"])
    tmp["type"] = tmp["field"].apply(lambda x: "number" if x.endswith(
        "_d") else ("QUALIFIER" if x.endswith("QUALIFIER") else
                    ("unit" if x.endswith("UNIT") else "STRING")))
    tmp["field_clean"] = tmp["field"].apply(lambda col: re.sub(
        "_s$", "",
        re.sub(
            "_d$", "",
            re.sub(
                "_UPQUALIFIER_s$", "",
                re.sub(
                    "_LOVALUE_d$", "",
                    re.sub(
                        "_LOQUALIFIER_s$", "",
                        re.sub("_UPVALUE_d$", "", re.sub("_UNIT_s$", "", col)))
                )))).replace(".", "_"))
    tmp["title"] = tmp["field_clean"].apply(lambda col: re.sub(
        "^T_", "", re.sub("^E_", "", col)).replace("_", " ").strip())
    tmp.sort_values(by=['field_clean'], inplace=True)
    return tmp
def retrieve_params(solr_api_url,solr_api_key,query="*:*"):
    config,config_servers, config_security, auth_object, msg = aa.parseOpenAPI3() 
    if auth_object!=None:
        auth_object.setKey(solr_api_key)    
    r = client_solr.get(solr_api_url ,query={"q": query, "wt": "json", "rows" : 1000000 , "fq" : "type_s:params"},auth=auth_object)
    
    tmp = pd.DataFrame(r.json()["response"]["docs"])
    return tmp
Ejemplo n.º 4
0
def get_facets(solr_api_url,
               solr_api_key,
               q="*:*",
               fields=[
                   "document_uuid_s", "topcategory_s", "endpointcategory_s",
                   "E.method_s"
               ]):
    config, config_servers, config_security, auth_object, msg = aa.parseOpenAPI3(
    )
    if auth_object != None:
        auth_object.setKey(solr_api_key)
    facets = client_solr.Facets()
    return facets.summary(solr_api_url, auth_object, query=q, fields=fields)
Ejemplo n.º 5
0
def prepare(solr_api_url,
            solr_api_key,
            folder_output,
            query="owner_name_s:GRACIOUS",
            method="BET"):
    #print(query)
    config, config_servers, config_security, auth_object, msg = aa.parseOpenAPI3(
    )
    if auth_object != None:
        auth_object.setKey(solr_api_key)

    q = query

    results = get_documents_by_method(solr_api_url, auth_object, q, method)

    return results
Ejemplo n.º 6
0
# + tags=["parameters"]
upstream = None
folder_output = None
solr_api_url = None
solr_api_key = None
annotation_folder = None
query=None
plot_dose_response=None
# -

from pynanomapper import client_solr,aa
import os, os.path

config,config_servers, config_security, auth_object, msg = aa.parseOpenAPI3() 
if auth_object!=None:
    auth_object.setKey(solr_api_key) 

def log_query(q):
    #logger.debug(q)
    pass
def beautify(r):
    pass


# Database records

facets = client_solr.Facets()
facets.set_annotation_folder(annotation_folder)
_query = "*:*" if query=="" else query.replace("owner_name_s","owner_name_hs")
dfm = facets.summary(solr_api_url,auth_object, query=_query,fields=["owner_name_hs"],fq='type_s:substance',log_query=log_query,log_result=beautify)    
projects = dfm["owner_name_hs"].unique()