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 APIIndustryDocsSearch.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 stringcase
: Case pertaining to documentscollection
: Collection of which documents are parttype
: Type of documentsindustry
: Industry of which documents are partbrand
: Brand to which documents pertainavailability
: Availability of documentsdate
: Date documents were createdid
: ID of particular documentauthor
: Creator of document(s)source
: Source of document(s)bates
: Bates code for documentoriginalformat
: Original format that documents were createdn
: Number of documents you want to retrieve. Pass-1
to retrieve all documents returned by the query. Defaults to1000
.
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.