Skip to content

Latest commit

 

History

History
62 lines (42 loc) · 2.63 KB

File metadata and controls

62 lines (42 loc) · 2.63 KB

CSD Analytics Functions Library 📊

A centralized collection of R functions designed to streamline CSD data workflows, data analysis, and dashboard development.


🛠 Environment & Dependencies

Static Badge

Static Badge Static Badge Static Badge Static Badge Static Badge


🚀 Functions

Authentication

  • get_oclc_token(): Fetches a new OCLC access token for specified APIs (WorldCat Metadata/Search).
  • ensure_valid_token(): Checks token expiration and auto-refreshes if necessary.

Enrichment & Data Processing

  • enrich_lc_classification(): Hits the WorldCat Metadata API classification-bibs endpoint to retrieve the most frequent LC call number for a given OCLC list.
  • enrich_uc_overlap(): Uses the WorldCat Search API to identify UC-wide holdings. Returns a pipe-separated list of UC institutions holding the item.
  • enrich_total_holdings(): Retrieves the worldwide holding count for OCLC numbers via the bibs-holdings endpoint.
  • enrich_selectors(): Joins LC call numbers against a master Google Sheet lookup table to assign Selectors and Roles.
  • enrich_vernacular_title(): Cleans MARC Local Param columns (field 880). It strips $$6 prefixes and removes $$b (subtitle) or $$c markers to return a readable vernacular title.

⚙️ Configuration

Environment Variables

This library requires an .Renviron file to store sensitive API credentials and other details.

💡 Note: See .Renviron.example in this repository for the required naming conventions and structure.


⚡ Quick Start

library(httr2)
library(dplyr)
library(purrr)
library(stringr)          #only needed if using enrich_vernacular_title()
library(googlesheets4)    #only needed if using enrich_selectors()

source("csd_function_library.R")

🔄 Dashboards & Apps Using This Library

  • ILL Borrowing Data Dashboard: Interlibrary loan analytics
  • Selector Assignment Tool: Batch call number to selector matching
  • UC Overlap Tool: Selective & Batch checking of OCLC Numbers for UC Overlap

AI Disclosure: Large language models (LLMs) were used to assist in writing, troubleshooting, and documenting the contents of this repository. All outputs were reviewed and validated by the developer.