| Type: | Package |
| Title: | UCSF Industry Documents Library API Wrapper |
| Version: | 0.1.0 |
| Description: | Serves as a R wrapper for the University of California San Francisco's [Industry Documents Digital Library]https://www.industrydocuments.ucsf.edu/ API. The API, and this wrapper, serve to pull metadata about of items within the digital library. For more information the API, see the [API's documentation]https://www.industrydocuments.ucsf.edu/wp-content/uploads/2020/08/IndustryDocumentsDataAPI_v7.pdf. |
| License: | MIT + file LICENSE |
| Imports: | arrow, data.table, httr, jsonlite, magrittr, dplyr, R6, stringr |
| Suggests: | mockery, testthat |
| Config/testthat/edition: | 3 |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.2 |
| NeedsCompilation: | no |
| Packaged: | 2025-04-28 19:22:53 UTC; rolando |
| Author: | Rolando Rodriguez [aut, cre] |
| Maintainer: | Rolando Rodriguez <rolando@ad.unc.edu> |
| Repository: | CRAN |
| Date/Publication: | 2025-04-29 09:10:02 UTC |
UCSF Industry Documents Library Solr API
Description
UCSF Industry Documents Library Solr API
UCSF Industry Documents Library Solr API
Public fields
resultsplaceholder for storing query results
Methods
Public methods
Method new()
Create a new IndustryDocsSearch instance
Usage
IndustryDocsSearch$new()
Arguments
NONENo parameters for initialization
Method query()
Query the UCSF Industry Documents Solr Library
Usage
IndustryDocsSearch$query( q = NULL, case = NULL, collection = NULL, doc_type = NULL, industry = NULL, brand = NULL, availability = NULL, date = NULL, id = NULL, author = NULL, source = NULL, bates = NULL, box = NULL, originalformat = NULL, wt = "json", cursor_mark = "*", sort = "id%20asc", n = 1000 )
Arguments
qThe query text that may incoporate the rest of the parameters. The function will not use the rest of the parameters if
qis not NULL.caseThe case the collection is related to.
collectionThe collection the results are found in.
doc_typeThe document type(s) to filter the results.
industryThe industry the documents are located within.
brandThe brand the documents are related to.
availabilityThe availability status of the documents.
dateThe date of the documents.
idThe id of the document(s).
authorThe author or originator of the contents of the document(s).
sourceThe source of the document(s); usually the institution that deposited the documents.
batesThe bates number(s) of the document(s) to be retrieved.
boxThe box id of the document(s) to be retrieved.
originalformatThe original format of the document(s) to be retrieved.
wtThe format the results should come in. Defaults to json. Functions depend on the results being returned as a JSON object.
cursor_markInitial placeholder for cursormark within the API URL
sortThe results will be sorted by ID in ascending order.
nThe number of results we want to capture. Defaults to 1000. If
nis set to-1then all documents available related to the query will be retrieved.
Method save()
Save results to file
Usage
IndustryDocsSearch$save(filename, format)
Arguments
filenameOutput filename
formatOutput format ('parquet' or 'json' or 'csv')
Examples
ids = IndustryDocsSearch$new()
ids$query(
industry='tobacco',
case='State of North Carolina',
collection='JUUL labs Collection',
n=100)
ids$save('query_results.csv', format='csv')
file.remove('query_results.csv')
Method clone()
The objects of this class are cloneable with this method.
Usage
IndustryDocsSearch$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
## ------------------------------------------------
## Method `IndustryDocsSearch$save`
## ------------------------------------------------
ids = IndustryDocsSearch$new()
ids$query(
industry='tobacco',
case='State of North Carolina',
collection='JUUL labs Collection',
n=100)
ids$save('query_results.csv', format='csv')
file.remove('query_results.csv')
Clean text for URL encoding
Description
Clean text for URL encoding
Usage
clean_query_text(text)
Arguments
text |
Text string to clean |
Value
URL-encoded string
Convert nested lists to data frame
Description
Convert nested lists to data frame
Usage
flatten_results(results)
Arguments
results |
List of API results |
Value
data.frame
Parse API response
Description
Parse API response
Usage
parse_response(response)
Arguments
response |
Raw API response |
Value
Parsed response object
Validate query parameters
Description
Validate query parameters
Usage
validate_params(params)
Arguments
params |
List of query parameters |
Value
Logical indicating if parameters are valid