Skip to main content

A simple python wrapper for the UCSF Industry Documents API.

Project description

Industry Documents Wrapper

This is a simple Python Wrapper for the UCSF Industry Documents Library API. Documentation about the API can be found here. Please use the API documentation to learn about best practices to construct search queries.

It offers basic functionality to perform queries on the API to retrieve metadata of the documents in the library.

You will want to install the package using pip:

pip install industryDocumentsWrapper

The the package has one class IndustryDocsSearch with two main methods of are:

  • IndustryDocsSearch.query(): performs the query on the API
  • IndustryDocsSearch.save(): saves query results as a JSON or Parquet file.

Basic usage looks like:

import industry_documents_wrapper as idw

wrapper = idw.ucsf_api.IndustryDocsSearch()
wrapper.query(q="industry:tobacco AND case:'State of North Carolina' AND collection:'JUUL labs Collection', n=100")
wrapper.save('query_results.json', format='json')

Alternatively, to avoid constructing the whole query, you can pass parts of the query as arguments:

import industry_documents_wrapper as idw

wrapper = idw.ucsf_api.IndustryDocsSearch()
wrapper.query(industry='tobacco', case='State of North Carolina', collection='JUUl labs collection', n=100)
wrapper.save('query_results.json', format='json')

Currently there is support for the following parameters:

  • q: complete query string
  • case: Case pertaining to documents
  • collection: Collection of which documents are part
  • type: Type of documents
  • industry: Industry of which documents are part
  • brand: Brand to which documents pertain
  • availability: Availability of documents
  • date: Date documents were created
  • id: ID of particular document
  • author: Creator of document(s)
  • source: Source of document(s)
  • bates: Bates code for document
  • originalformat: Original format that documents were created
  • n: Number of documents you want to retrieve. Pass -1 to retrieve all documents returned by the query. Defaults to 1000.

NOTE: The query method will use the q parameter instead of the others (excluding n) if it is passed, please use the q parameter or pass the values with the individual parameters (case, collection, etc.).

For guidance on the proper way to pass values in the query, please refer to the API documentation.

Please reach out to Rolando Rodriguez with any questions, concerns, or issues.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

industrydocumentswrapper-0.11.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

industrydocumentswrapper-0.11-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file industrydocumentswrapper-0.11.tar.gz.

File metadata

  • Download URL: industrydocumentswrapper-0.11.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Darwin/22.3.0

File hashes

Hashes for industrydocumentswrapper-0.11.tar.gz
Algorithm Hash digest
SHA256 778cc8d4d79e71893d8b300271e6024e0ab0e21ec4af98bbd84ef53e116fc665
MD5 2eb6c034274b4d9cf2f64a55185614ec
BLAKE2b-256 b1d05d3908027f4086060372d0c48bafb1972c6bd25d459b657466876de3c454

See more details on using hashes here.

File details

Details for the file industrydocumentswrapper-0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for industrydocumentswrapper-0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 8a5ba7af2693e0ca5b57ccff44ff2e17da4b4857c3ec4a5b6b5ebbf94ac773d1
MD5 571a2b7a5fe8762e09bc1962440ba66d
BLAKE2b-256 90de2eb827c2e4052924ccc3ce481cd3964cd4080bbcc47719e49bea8feea81c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page