fetch_norman: Fetch Multiple Datasets from Norman API

View source: R/fetch_norman.R

fetch_normanR Documentation

Fetch Multiple Datasets from Norman API

Description

This function interacts with the Norman Network Database System (NDS) API. It allows the user to pass a vector of values (e.g., multiple CAS numbers or NSIDs). It iterates through each value, performs the API request, and aggregates the results into a named list.

Usage

fetch_norman(
  module,
  parameter,
  values,
  page = NULL,
  format = "json",
  verbose = TRUE
)

Arguments

module

A character string specifying the database module. Allowed values:

  • "susdat" - Substance Database

  • "ecotox" - Ecotoxicology Database

  • "empodat" - EMPODAT Database

  • "passive" - Passive Sampling Database

parameter

A character string specifying the search parameter. The allowed parameters depend on the selected module:

  • For module = "susdat": "nsid", "casrn", "inchikey"

  • For module = "ecotox": "nsid", "casrn", "inchikey"

  • For module = "empodat": "nsid", "casrn", "inchikey", "country", "matrix", "id"

  • For module = "passive": "nsid", "casrn", "inchikey", "country", "matrix"

Parameter Descriptions:

  • nsid: Norman SusDat ID (e.g., "NS00001027" or "1027")

  • casrn: CAS Registry Number (e.g., "1490-04-6")

  • inchikey: International Chemical Identifier Key (e.g., "NOOLISFMXDJSKH-UHFFFAOYSA-N")

  • country: Country Alpha-2 code (e.g., "SK")

  • matrix: Ecosystem/matrix ID (e.g., "3")

  • id: Empodat ID or range (e.g., "100" or "100:150")

values

A character or numeric value corresponding to the chosen parameter.

page

(Optional) Integer or character. The page number for pagination. If NULL (default), the page segment is omitted from the URL.

format

A character string specifying the output format. Allowed values: "json", "xml". Defaults to "json".

verbose

Logical. If TRUE, prints progress messages to the console. Defaults to TRUE.

Value

  • If format = "json": A list or data frame (parsed JSON).

  • If format = "xml": A raw character string (XML content).

A named list where each element's name corresponds to the search value and the content is the data returned by the API. If a request fails, the element will contain an error message or NULL.

Examples

## Not run: 
  # Define multiple CAS numbers
  cas_list <- c("3380-34-5", "1490-04-6")
  
  # Fetch data for all values
  results <- fetch_norman(
    module = "susdat",
    parameter = "casrn",
    values = cas_list
  )
  
  # Access specific result
  triclosan_data <- results[["3380-34-5"]]

## End(Not run)


normanR documentation built on Sept. 12, 2026, 5:10 p.m.