Package: nuldc
nuldcA simple CLI for consumingNorthwestern University Libraries Digital Collections API. It also includes a set of python helpers for rolling your own scripts.QuickstartInstall itpip install nuldc❯ nuldc --help

NULDC

USAGE:
    nuldc works <id> [--as=<format>]
    nuldc collections <id> [--as=<format> --all]
    nuldc search <query> [--model=<model>] [--as=<format>] [--all]
    nuldc csv <query> [--fields=<fields>] [--all] <outfile>
    nuldc xml <query> [--all] <outfile>
    nuldc --version

OPTIONS:
    --as=<format>      get results as [default: opensearch]
    --model=<model>    search model (works,collections,filesets) [default: works]
    --all              get all records from search
    --fields=<fields>  optional set of fields,e.g id,ark,test defaults to all
    -h --help          Show this screen

ARGUMENTS:
    as: opensearch
        iiifExamplesGet a workLet's get a work's manifestnuldc works c1960aac-74f0-4ce8-a795-f713b2e3cc22Maybe we should grab that work as a IIIF manifest.nuldc works c1960aac-74f0-4ce8-a795-f713b2e3cc22 --as iiifGet collection's metadatanuldc collections ecacd539-fe38-40ec-bbc0-590acee3d4f2or get metadata  as iiifnuldc collections ecacd539-fe38-40ec-bbc0-590acee3d4f2 --as iiifGet the whole collection as IIIF, stitching together all the pagesnuldc collections ecacd539-fe38-40ec-bbc0-590acee3d4f2 --as iiif --allSearch for thingsSimple searchnuldc search "berkeley AND guitars"Page through all the results and return one big list of items (limit 200 pages)nuldc search "trains AND chicago" --allas iiifnuldc search "trains AND chicago" --as iiif --allSave to CSVDumping to CSV is simple. By default it dumps all the fields that are "label". If you need to dig into
specific fields you can do that as well.nuldc csv "trains AND chicago" --all example.csvLet's grab just a few fields.nuldc csv "trains AND chicago" --all --fields id,title,ark example.csvIt also supports "dot" notation for getting into nested, special purpose fields.nuldc csv "trains AND chicago" --all --fields id,title,ark,subject.id example.csvSave to xmlYou can export search results to an xml serialization of the data structure as well.nuldc xml "trains AND chicago" out.xmlOr get all the recordsnuldc xml "trains AND chicago" --all all.xmlPipeable and Works great with jq!All of this is pipe-able too, so if you want to do further analysis with JQ or pipe data through some other
processing pipeline, go for it! For instance, let's grab just a coupld of fields from the json and reformat it into
a simplified shape.nuldc search "berkeley AND guitars" --all | jq -r '.data[] | [.title,.id]Advanced SearchYou can search within specific fields and perform complex searches using the opensearch/elasticsearchquery-string-query syntax. The query syntax is valid for all "search" operations: search, csv, xml.Examples:Get a csv file of all works that have a fileset label including "recto"nuldc csv "file_sets.label:Recto*" ~/Desktop/rectos.csvLook at results that have a subject that includes "Chicago"nuldc search "subject.label:*Chicago*"Get Results that have a subject of "Chicago" AND a title of "Bus"nuldc search "subject.label:*Chicago* AND title:bus"Get results from a known collection that were modified before a certain date:nuldc search "modified_date:<2022-10-01 AND collection.title:Berkeley*"DevelopmentThis project is built usingPOETRY. Follow the latest install instructions, clone the repository andpoetry install.TestsThis project uses pytest and has a very small set of tests to ensure things are running as expected.From apoetry shellrunpytest.