Skip to content

Use catalog records in a script

The MIDAS Catalog publishes all its records in one file, in their LinkML representation: https://catalog.midasnetwork.us/linkml/catalog.jsonld. The file is a JSON array, with one object per record. A few lines of Python can search it, with nothing to install.

This example lists the records about mpox. Those are the records whose subjects (the about field) include the Disease Ontology's term for mpox, http://purl.obolibrary.org/obo/DOID_3292. For each record, the script prints its id and name.

Download the catalog

The catalog file is about 75 MB, or about 5 MB compressed. --compressed asks the server for the compressed copy and unpacks it as it arrives:

mkdir mpox-records && cd mpox-records
curl -sSfL --compressed -o catalog.jsonld https://catalog.midasnetwork.us/linkml/catalog.jsonld

Use curl rather than Python's urllib, which fails with CERTIFICATE_VERIFY_FAILED on macOS if Python came from the python.org installer.

The script

Save this as mpox_records.py in the same folder. It uses only Python's standard library. You need Python 3.11 or newer (https://www.python.org/downloads/).

# mpox_records.py
import json
import sys

MPOX = "http://purl.obolibrary.org/obo/DOID_3292"   # the Disease Ontology's term for mpox

with open(sys.argv[1], encoding="utf-8") as f:
    records = json.load(f)                  # the file is a JSON array of records

for record in records:
    subjects = {term["id"] for term in record.get("about", [])}
    if MPOX in subjects:
        print(record["id"], record["name"], sep="\t")

The model requires every subject term to have an id. The about field itself is optional, which is why the script uses record.get("about", []).

Run it

python3 mpox_records.py catalog.jsonld | head -n 5
https://w3id.org/midas-catalog/81   COVID-19: Keeping Los Angeles Safe
https://w3id.org/midas-catalog/140  GISAID
https://w3id.org/midas-catalog/321  DxConnect Test Directory
https://w3id.org/midas-catalog/350  2022-2023 U.S. Map & Case Count
https://w3id.org/midas-catalog/351  An Update of Monkeypox Outbreak in Nigeria

To count them:

python3 mpox_records.py catalog.jsonld | wc -l
     171

These results come from the live catalog on 5 November 2026, when it held 2,182 records. The numbers grow as the catalog does. The example record on the Examples page is based on record 350.

The output is tab-separated, so other tools can split it into columns. For example, cut -f 2 keeps only the names.

Other searches

To search for another subject, change MPOX to that term's id, written exactly as the catalog writes it. The id is an IRI, a web address used as an identifier, so an https version of an http IRI doesn't match. The identifier rules on Write a record in YAML say which vocabularies each kind of term comes from.