<jupyter_start><jupyter_text>Querying LymeMIND CommonsThe LymeMIND commons adopts Signature Commons as its backbone. The metadata API (https://commons.lymemind.org/metadata-api/) provides fast full-text search and field comparison filtering of the metadata as well as metadata aggregations for statistical summaries.  Metadata SearchUsers can query for metadata using JSON formatted loopback queries (https://loopback.io/doc/en/lb3/Querying-data.html).**Method** 	`GET`**URL** 	`/`**PARAMETERS****filter** "stringified JSON query**RETURNS** JSON list of all the matches ModelsThe following are the models used by LymeMIND Commons* Consortium Members: `resources`* Projects: `libraries`* Datasets: `signatures` Full Text Search<jupyter_code>METADATA_API = "https://commons.lymemind.org/metadata-api"
endpoint = "/signatures"
term = "microarray"

query = {
    "where": {
        "meta": {"fullTextSearch": term}     
    },
    "limit": 1
}
res = requests.get(METADATA_API+ endpoint , params={"filter": json.dumps(query)})
print(json.dumps(res.json(),indent=4))<jupyter_output>[
    {
        "$validator": "/dcic/signature-commons-schema/v5/core/signature.json",
        "id": "5394cedf-6660-42b6-9bc0-cc5972131387",
        "library": "5675bd3a-078d-487d-9e34-e542b029b647",
        "meta": {
            "gpl": "20301",
            "gse": "153261",
            "uid": "200153261",
            "assay": [
                {
                    "Name": "Microarray",
                    "Accession": "BAO:0010048"
                }
            ],
            "files": [
                {
                    "name": "Control\\_2",
                    "download_url": "https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=+GSM4637152"
                },
                {
                    "name": "Treated48\\_2",
                    "download_url": "https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=+GSM4637155"
                },
                {
                    "name": "Treated48\\_1",
                    "download_url": "https://www.ncbi.nlm.nih.gov/geo/query/acc.[...]<jupyter_text>Alternatively, users can also perform a POST request using the `/find` endpoint**Method** 	`POST`**URL** 	`//find`**PARAMETERS****filter** JSON serialized query**RETURNS** JSON list of all the matches Filtering by fields<jupyter_code>METADATA_API = "https://commons.lymemind.org/metadata-api"
endpoint = "/libraries/find"
term = "Bioinformatics and Biotechnologies"

query = {
    "filter":{
        "where": {
            "meta.Category": term     
        },
        "limit": 1
    }
}
res = requests.post(METADATA_API+ endpoint, json=query)
print(json.dumps(res.json(),indent=4))<jupyter_output>[
    {
        "$validator": "/dcic/signature-commons-schema/v5/core/library.json",
        "id": "74edb74b-801c-4238-b3b0-0bf9f5411167",
        "resource": "a749e1de-548b-4c1b-9ca5-7f0e802c8b81",
        "dataset": "lymemind",
        "dataset_type": "rank_matrix",
        "meta": {
            "Icon": "static/lyme/ucsf.png",
            "Grantee": [
                {
                    "Name": "<NAME>",
                    "Type": "Researcher",
                    "Website": "https://profiles.ucsf.edu/charles.chiu",
                    "Organization": "UCSF"
                }
            ],
            "Category": "Bioinformatics and Biotechnologies",
            "$validator": "/dcic/signature-commons-schema/v5/core/unknown.json",
            "Cohen-funded_study_title": "A Combined Pathogen-Host Sequencing Assay for Diagnosis of Lyme and Other Tickborne Infections"
        }
    }
]<jupyter_text>Aggregating metadata Counting results**Method** 	`GET`**URL** 	`//count`**PARAMETERS****filter** JSON serialized query**RETURNS** The number of matching results<jupyter_code>METADATA_API = "https://commons.lymemind.org/metadata-api"
endpoint = "/signatures/count"
term = "microarray"

query = {
    "meta": {"fullTextSearch": term}     
}
res = requests.get(METADATA_API+ endpoint , params={"where": json.dumps(query)})
print(json.dumps(res.json(),indent=4))<jupyter_output>{
    "count": 27
}<jupyter_text>Counting top terms**Method** 	`GET`**URL** 	`//value_count`**PARAMETERS****filter** JSON serialized query**RETURNS** JSON list of the value counts<jupyter_code>METADATA_API = "https://commons.lymemind.org/metadata-api"
endpoint = "/signatures/value_count"
term = "PTLDS"

query = {
    "fields": ["meta.published_date.year"],
    "where": {
        "meta": {"fullTextSearch": term}     
    }
}
res = requests.get(METADATA_API+ endpoint,  params={"filter": json.dumps(query)})
print(json.dumps(res.json(),indent=4))<jupyter_output>{
    "meta.published_date.year": {
        "2016": 1,
        "2019": 1
    }
}
{'fraction_non_alphanumeric': 0.1564021164021164, 'fraction_numerical': 0.03322751322751323, 'mean_word_length': 2.6749611197511665, 'pattern_counts': {'":': 53, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 10, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '541099', 'license': 'MIT', 'n_tokens_mistral': 1672, 'n_tokens_neox': 1528, 'n_words': 279, 'path': 'Tutorial/API Tutorial.ipynb', 'repo_name': 'MaayanLab/lymemind-commons-schema', 'size': '4731'}