View source: R/get_hc_drug_by_din.R
| get_hc_drug_by_din | R Documentation |
Retrieves detailed information for a specific drug product listed in the
Health Canada Drug Product Database (DPD) using the RESTful API endpoint
/drug/drugproduct?din=<DIN>.
This includes details such as the Drug Identification Number (DIN), product name, class, number of active ingredients, company name, and update date.
get_hc_drug_by_din(din)
din |
A character or numeric string representing the Drug Identification Number (DIN) of the product to retrieve. |
Sends a GET request to the Health Canada Drug Product Database API. Supports caching via the memoise package and enforces a rate limit between successive API requests.
If the DIN does not exist or the API returns an error, the function
returns NULL with an informative message.
The function fails gracefully when internet resources are unavailable, including SSL certificate errors, network timeouts, or server issues.
A tibble with the following columns:
drug_code: Unique code identifying the drug product
class_name: Class of drug (e.g., Human, Veterinary)
din: DIN assigned by Health Canada
brand_name: Brand or trade name of the product
number_of_ais: Number of active ingredients
ai_group_no: Active ingredient group number
company_name: Manufacturer name
last_update_date: Date of last update in the database
Returns NULL if the resource is unavailable or if an error occurs.
Requires an internet connection.
Health Canada Drug Product Database (DPD) API: https://health-products.canada.ca/api/documentation/dpd-documentation-en.html
GET,
fromJSON,
as_tibble
# This function requires an internet connection and downloads data from Health Canada
result <- get_hc_drug_by_din("02456789")
if (!is.null(result)) {
print(result)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.