View source: R/health_canada_dpd_parser.R
| parseHealthCanadaDPD | R Documentation |
Reads Health Canada's Drug Product Database data extract and returns a
dvobject with its 13 tables. Each of the four product sets
(marketed, approved, cancelled, dormant) is read from its unzipped folder
or straight from its zip; the rows of every set go in one table with an
extract column.
parseHealthCanadaDPD(
dpd_dir,
extracts = c("marketed", "approved", "cancelled", "dormant"),
release = NULL,
release_date = NULL,
retrieved_at = NULL
)
dpd_dir |
Character. Folder holding the extract's zips or unzipped folders. |
extracts |
Character. Product sets to read, any of
|
release |
Character or NULL. Release label, e.g. |
release_date |
Date, |
retrieved_at |
Date, |
dpd_dir holds the extract as Health Canada distributes it, each
product set either as its zip or unzipped into a folder of the same name:
allfiles (marketed), allfiles_ap (approved),
allfiles_ia (cancelled) and allfiles_dr (dormant), plus
inactive (the inactive products list). Zips are extracted to a
temporary folder that is removed after reading. When neither
inactive nor inactive.zip is there, inactive.txt is
read from the cancelled set, which holds the same file.
The files have no header: column names are those of Health Canada's
read-me ("Read Me File - Drug Product Database (DPD) Data Extract"),
lower case, and table names are the read-me's without QRYM_. Every
value is quoted and the files are UTF-8; empty values become NA.
Code columns (drug_code, active_ingredient_code,
company_code, pharm_form_code,
route_of_administration_code, si_code) are integers and the
DD-MON-YYYY dates are dates; every other column stays text as
written. Dates are kept as written, including two lot expiry dates in the
cancelled set written with years 0030 and 0031.
The therapeutic class files hold four fields where the read-me lists seven columns: the three certain ones are kept and the parser stops if the fourth ever holds a value.
The parser groups nothing: status holds every status row as
written, with current_status_flag marking each product's current
one.
DPD data are published under the Open Government Licence - Canada
(version 2.0); the attribution it asks for is recorded in the object's
metadata (see get_source_metadata). The DPD extract page
also links to Health Canada's website terms; the dataset record on
open.canada.ca states the Open Government Licence – Canada.
A dvobject with 13 tibbles, each keyed by drug_code:
drug_product, active_ingredients, companies,
form, packaging, pharmaceutical_std, route,
schedule, status, therapeutic_class,
veterinary_species, biosimilars (each with
extract) and inactive_products. inactive_products
lists cancelled products, so it is built only when extracts
includes "cancelled" and an inactive products file is found.
Other parsers:
cett_nodes_options(),
drug_node_options(),
parseDrugBank(),
parseHGNC(),
parseHPO(),
parseOnSIDES(),
parseOpenFDA(),
parseTWOSIDES(),
references_node_options()
dpd_dir <- system.file("extdata", "health_canada_dpd", package = "dbparser")
dpd <- parseHealthCanadaDPD(dpd_dir, release = "2026-10",
retrieved_at = "2026-10-21")
dpd$drug_product[, c("drug_code", "brand_name", "extract")]
get_source_metadata(dpd)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.