nuldc


Namenuldc JSON
Version 0.11.0 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2024-10-13 02:49:21
maintainerNone
docs_urlNone
authordavidschober
requires_python<4,>=3.8.1
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # nuldc


A simple CLI for consuming [Northwestern University Libraries Digital Collections API](https://api.dc.library.northwestern.edu/). It also includes a set of python helpers for rolling your own scripts.

## Quickstart

### Install it

`pip install nuldc`

### Upgrading to a new verson

`pip install --upgrade 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
        iiif
```

## Examples

### Get a work

Let's get a work's manifest

`nuldc works c1960aac-74f0-4ce8-a795-f713b2e3cc22`

Maybe we should grab that work as a IIIF manifest.

`nuldc works c1960aac-74f0-4ce8-a795-f713b2e3cc22 --as iiif`

### Get collection's metadata

`nuldc collections ecacd539-fe38-40ec-bbc0-590acee3d4f2`

or get metadata  as iiif

`nuldc collections ecacd539-fe38-40ec-bbc0-590acee3d4f2 --as iiif`

Get the whole collection as IIIF, stitching together all the pages

`nuldc collections ecacd539-fe38-40ec-bbc0-590acee3d4f2 --as iiif --all`

### Search for things

Simple search

`nuldc search "berkeley AND guitars"`

Page through all the results and return one big list of items (limit 200 pages)

`nuldc search "trains AND chicago" --all`

as iiif

`nuldc search "trains AND chicago" --as iiif --all`

### Save to CSV

Dumping 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.csv`

Let's grab just a few fields. 

`nuldc csv "trains AND chicago" --all --fields id,title,ark example.csv`

It also supports "dot" notation for getting into nested, special purpose fields.

`nuldc csv "trains AND chicago" --all --fields id,title,ark,subject.id example.csv`

### Save to xml

You can export search results to an xml serialization of the data structure as well.

`nuldc xml "trains AND chicago" out.xml`

Or get all the records

`nuldc xml "trains AND chicago" --all all.xml`

### Pipeable 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 Search

You can search within specific fields and perform complex searches using the opensearch/elasticsearch [query-string-query syntax](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-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.csv`

Look 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*"`


## Development

This project is built using [POETRY](https://python-poetry.org/). Follow the latest install instructions, clone the repository and `poetry install`.

### Tests

This project uses pytest and has a very small set of tests to ensure things are running as expected.

From a `poetry shell` run `pytest`.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "nuldc",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.8.1",
    "maintainer_email": null,
    "keywords": null,
    "author": "davidschober",
    "author_email": "davidschob@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b2/95/79d31955c4c66a78ba641725ccbf09d1cd9aca460e619f8dc9cc643c4c4d/nuldc-0.11.0.tar.gz",
    "platform": null,
    "description": "# nuldc\n\n\nA simple CLI for consuming [Northwestern University Libraries Digital Collections API](https://api.dc.library.northwestern.edu/). It also includes a set of python helpers for rolling your own scripts.\n\n## Quickstart\n\n### Install it\n\n`pip install nuldc`\n\n### Upgrading to a new verson\n\n`pip install --upgrade nuldc`\n\n```\n\u276f nuldc --help\n\nNULDC\n\nUSAGE:\n    nuldc works <id> [--as=<format>]\n    nuldc collections <id> [--as=<format> --all]\n    nuldc search <query> [--model=<model>] [--as=<format>] [--all]\n    nuldc csv <query> [--fields=<fields>] [--all] <outfile>\n    nuldc xml <query> [--all] <outfile>\n    nuldc --version\n\nOPTIONS:\n    --as=<format>      get results as [default: opensearch]\n    --model=<model>    search model (works,collections,filesets) [default: works]\n    --all              get all records from search\n    --fields=<fields>  optional set of fields,e.g id,ark,test defaults to all\n    -h --help          Show this screen\n\nARGUMENTS:\n    as: opensearch\n        iiif\n```\n\n## Examples\n\n### Get a work\n\nLet's get a work's manifest\n\n`nuldc works c1960aac-74f0-4ce8-a795-f713b2e3cc22`\n\nMaybe we should grab that work as a IIIF manifest.\n\n`nuldc works c1960aac-74f0-4ce8-a795-f713b2e3cc22 --as iiif`\n\n### Get collection's metadata\n\n`nuldc collections ecacd539-fe38-40ec-bbc0-590acee3d4f2`\n\nor get metadata  as iiif\n\n`nuldc collections ecacd539-fe38-40ec-bbc0-590acee3d4f2 --as iiif`\n\nGet the whole collection as IIIF, stitching together all the pages\n\n`nuldc collections ecacd539-fe38-40ec-bbc0-590acee3d4f2 --as iiif --all`\n\n### Search for things\n\nSimple search\n\n`nuldc search \"berkeley AND guitars\"`\n\nPage through all the results and return one big list of items (limit 200 pages)\n\n`nuldc search \"trains AND chicago\" --all`\n\nas iiif\n\n`nuldc search \"trains AND chicago\" --as iiif --all`\n\n### Save to CSV\n\nDumping to CSV is simple. By default it dumps all the fields that are \"label\". If you need to dig into\nspecific fields you can do that as well. \n\n`nuldc csv \"trains AND chicago\" --all example.csv`\n\nLet's grab just a few fields. \n\n`nuldc csv \"trains AND chicago\" --all --fields id,title,ark example.csv`\n\nIt also supports \"dot\" notation for getting into nested, special purpose fields.\n\n`nuldc csv \"trains AND chicago\" --all --fields id,title,ark,subject.id example.csv`\n\n### Save to xml\n\nYou can export search results to an xml serialization of the data structure as well.\n\n`nuldc xml \"trains AND chicago\" out.xml`\n\nOr get all the records\n\n`nuldc xml \"trains AND chicago\" --all all.xml`\n\n### Pipeable and Works great with jq!\n\nAll of this is pipe-able too, so if you want to do further analysis with JQ or pipe data through some other\nprocessing pipeline, go for it! For instance, let's grab just a coupld of fields from the json and reformat it into \na simplified shape.\n\n`nuldc search \"berkeley AND guitars\" --all | jq -r '.data[] | [.title,.id]`\n\n\n### Advanced Search\n\nYou can search within specific fields and perform complex searches using the opensearch/elasticsearch [query-string-query syntax](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax). The query syntax is valid for all \"search\" operations: search, csv, xml. \n\n#### Examples:\n\nGet a csv file of all works that have a fileset label including \"recto\"\n\n`nuldc csv \"file_sets.label:Recto*\" ~/Desktop/rectos.csv`\n\nLook at results that have a subject that includes \"Chicago\"\n\n`nuldc search \"subject.label:*Chicago*\"`\n\nGet Results that have a subject of \"Chicago\" AND a title of \"Bus\"\n\n`nuldc search \"subject.label:*Chicago* AND title:bus\"`\n\nGet results from a known collection that were modified before a certain date:\n\n`nuldc search \"modified_date:<2022-10-01 AND collection.title:Berkeley*\"`\n\n\n## Development\n\nThis project is built using [POETRY](https://python-poetry.org/). Follow the latest install instructions, clone the repository and `poetry install`.\n\n### Tests\n\nThis project uses pytest and has a very small set of tests to ensure things are running as expected.\n\nFrom a `poetry shell` run `pytest`.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": null,
    "version": "0.11.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "774d7180d3b5c802c8b45d65650ab22d922719e40ac3708f7eb4c35f9b33df34",
                "md5": "99bef6e32249f4f21a57facb4ffb8dc6",
                "sha256": "08c48ed4df58beab8a5c060af806ffb931d6b6581dcf0d5b822b50e3c957c434"
            },
            "downloads": -1,
            "filename": "nuldc-0.11.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "99bef6e32249f4f21a57facb4ffb8dc6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.8.1",
            "size": 9206,
            "upload_time": "2024-10-13T02:49:19",
            "upload_time_iso_8601": "2024-10-13T02:49:19.855216Z",
            "url": "https://files.pythonhosted.org/packages/77/4d/7180d3b5c802c8b45d65650ab22d922719e40ac3708f7eb4c35f9b33df34/nuldc-0.11.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b29579d31955c4c66a78ba641725ccbf09d1cd9aca460e619f8dc9cc643c4c4d",
                "md5": "5a25a2814b05689410ae8570bcdd2b5e",
                "sha256": "a16f2481e4701ee33a607c33c16312ecbf55f9996fc39b37dc7bf46d0e3ed4f0"
            },
            "downloads": -1,
            "filename": "nuldc-0.11.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5a25a2814b05689410ae8570bcdd2b5e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.8.1",
            "size": 7410,
            "upload_time": "2024-10-13T02:49:21",
            "upload_time_iso_8601": "2024-10-13T02:49:21.337921Z",
            "url": "https://files.pythonhosted.org/packages/b2/95/79d31955c4c66a78ba641725ccbf09d1cd9aca460e619f8dc9cc643c4c4d/nuldc-0.11.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-13 02:49:21",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "nuldc"
}
        
Elapsed time: 0.34117s