#' Country Codes
#'
#' Includes information about
#' searchable countries
#'
#' @param join_country_code if \code{TRUE} joins information about
#' countries.
#'
#' @return
#' @export
#' @import countrycode
#'
#' @examples
#' dictionary_country_codes(join_country_code = T)
dictionary_country_codes <-
function(join_country_code = T) {
data <-
fromJSON("https://www.usaspending.gov/data/countries.json")
data <-
data$countries %>%
as_tibble() %>%
set_names(c("codeCountry", "nameCountry"))
if (join_country_code) {
data <- data %>%
left_join(countrycode::codelist %>%
as_tibble(),
by = c("codeCountry" = "iso3c"))
}
data
}
#' Federal Government Domain dictionary
#'
#' @return
#' @export
#'
#' @examples
#' dictionary_federal_government_websites()
dictionary_federal_government_websites <-
memoise::memoise(function() {
data <-
"https://raw.githubusercontent.com/GSA/data/master/dotgov-domains/current-federal.csv" %>%
fread(verbose = F,showProgress = FALSE) %>%
as_tibble() %>%
setNames(
c(
"urlDomain",
"branch",
"nameDepartment",
"nameOffice",
"city",
"state",
"emailSecurity"
)
) %>%
separate(
branch,
into = c("remove", "typeBranch"),
extra = "merge",
fill = "right",
sep = "\\-"
) %>%
separate(
nameOffice,
into = c("nameOffice", "detailsOffice"),
sep = "\\-",
fill = "right"
) %>%
mutate_all(str_trim) %>%
select(-remove) %>%
mutate(
emailSecurity = ifelse(emailSecurity == "(blank)", NA, emailSecurity),
urlDomain = str_to_lower(urlDomain),
urlDomain = str_c("https://", urlDomain, sep = "")
) %>%
.munge_data(clean_address = F) %>%
.remove_na()
data
})
#' Dictionary of Federal Domains
#'
#' @return
#' @export
#'
#' @examples
#' dictionary_federal_domains()
dictionary_federal_domains <-
memoise::memoise(function() {
"https://github.com/GSA/data/blob/master/dotgov-websites/censys-federal-snapshot.csv?raw=true" %>%
fread(verbose = F,showProgress = FALSE) %>%
setNames(c("urlDomain")) %>%
as_tibble()
})
#' Dictionary Government Websites
#'
#' @return
#' @export
#'
#' @examples
#' dictionary_government_websites()
dictionary_government_websites <-
memoise::memoise(function() {
data <-
"https://raw.githubusercontent.com/GSA/data/master/dotgov-domains/current-full.csv" %>%
fread(quote = "",showProgress = FALSE) %>%
setNames(
c(
"urlDomain",
"branch",
"nameAgency",
"nameOffice",
"city",
"state",
"emailSecurity"
)
) %>%
as_tibble() %>%
separate(
branch,
into = c("remove", "typeBranch"),
extra = "merge",
sep = "\\-",
fill = "right"
) %>%
separate(
nameOffice,
into = c("nameOffice", "detailsOffice"),
extra = "merge",
fill = "right",
sep = "\\-"
) %>%
mutate_all(str_trim) %>%
select(-remove) %>%
mutate(
emailSecurity = ifelse(emailSecurity == "(blank)", NA, emailSecurity),
urlDomain = str_to_lower(urlDomain)
) %>%
.munge_data()
data
})
#' Agency Logo dictionary
#'
#' @return \code{data_frame}
#' @export
#'
#' @examples
#' dictionary_agency_logos()
dictionary_agency_logos <-
function() {
data <-
structure(
list(
c(
"Agency for International Development",
"Architect of the Capitol",
"Broadcasting Board of Governors",
"Defense Information Systems Agency",
"Defense Logistics Agency",
"Department of Agriculture",
"Department of Commerce",
"Department of Energy",
"Department of Health and Human Services",
"Department of Homeland Security",
"Department of Housing and Urban Development",
"Department of Justice",
"Department of Labor",
"Department of State",
"Department of the Air Force",
"Department of the Army",
"Department of the Interior",
"Department of the Navy",
"Department of the Treasury",
"Department of Transportation",
"Department of Veterans Affairs",
"Environmental Protection Agency",
"General Services Administration",
"Government Publishing Office",
"International Boundary and Water Commission",
"Library of Congress",
"National Aeronautics and Space Administration",
"National Science Foundation",
"National Transportation Safety Board",
"Nuclear Regulatory Commission",
"Office of Personnel Management",
"Other Defense Agencies",
"Securities and Exchange Commission",
"Social Security Administration",
"United States Holocaust Memorial Museum",
"United States Postal Service"
),
c(
"http://www.psi.org/wp-content/uploads/2014/09/usaidlogo.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/US-ArchitectOfTheCapitol-2010Logo.svg/1200px-US-ArchitectOfTheCapitol-2010Logo.svg.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/8/89/Broadcasting_Board_of_Governors.svg/400px-Broadcasting_Board_of_Governors.svg.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/0/05/US-DefenseInformationSystemsAgency-Seal.svg/1200px-US-DefenseInformationSystemsAgency-Seal.svg.png",
"http://arrikai.com/wp-content/uploads/2012/06/dla-700x460.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/6/68/US-DeptOfAgriculture-Seal.svg/600px-US-DeptOfAgriculture-Seal.svg.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/1/1a/Seal_of_the_United_States_Department_of_Commerce.svg/2000px-Seal_of_the_United_States_Department_of_Commerce.svg.png",
"http://tcmoldman.com/wp-content/uploads/2016/06/us-department-of-energy-logo.jpg",
"http://vectorslike.com/wp-content/uploads/2013/10/United-States-Department-of-Health-and-Human-Services-logo.png",
"https://onlinempa.unc.edu/wp-content/uploads/2013/09/dhs-logo.jpg",
"http://vectorslike.com/wp-content/uploads/2013/10/US-Department-of-Housing-and-Urban-Development-logo-eps.png",
"http://www.clipartbest.com/cliparts/7ca/oqe/7caoqe8gi.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/c/c1/Seal_of_the_United_States_Department_of_Labor.svg/1200px-Seal_of_the_United_States_Department_of_Labor.svg.png",
"https://mexicoinstitute.files.wordpress.com/2009/08/department-of-state-logo.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/8/8e/Seal_of_the_United_States_Department_of_the_Air_Force.svg/1024px-Seal_of_the_United_States_Department_of_the_Air_Force.svg.png",
"http://www.ranklogos.com/wp-content/uploads/2012/07/Department-of-The-Army-USA-Logo.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/e/ea/Seal_of_the_United_States_Department_of_the_Interior.svg/1200px-Seal_of_the_United_States_Department_of_the_Interior.svg.png",
"http://www.sciencebrothers.org/wp-content/uploads/2011/02/Navy_Logo.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/c/cb/Seal_of_the_United_States_Department_of_the_Treasury.svg/1200px-Seal_of_the_United_States_Department_of_the_Treasury.svg.png",
"http://vectorslike.com/wp-content/uploads/2013/10/US-Department-of-Transportation-logo-download.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/6/66/US_Department_of_Veterans_Affairs_vertical_logo.svg/1000px-US_Department_of_Veterans_Affairs_vertical_logo.svg.png",
"http://hiddencityphila.org/wp-content/uploads/2013/05/epa_logo.jpg",
"https://www.gsa.gov/cdnstatic/ephox_images/GSAStarMarkweblogopolicy3333_1454214901874.jpg",
"http://r3.myprintresource.com/files/cygnus/image/CGN/2014/FEB/640x360/gpo-logo_11310193.jpg",
"https://upload.wikimedia.org/wikipedia/commons/f/f6/International_Boundary_and_Water_Commission_logo.jpg",
"http://www.essimonaco.org/wp-content/uploads/2014/08/library-of-congress-logo-2.png",
"https://www.nasa.gov/sites/default/files/images/nasaLogo-570x450.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/1/12/NSF.svg/2000px-NSF.svg.png",
"https://upload.wikimedia.org/wikipedia/commons/thumb/1/16/Seal_of_the_United_States_National_Transportation_Safety_Board.svg/1200px-Seal_of_the_United_States_National_Transportation_Safety_Board.svg.png",
"https://www.ucsusa.org/sites/default/files/legacy/assets/images/np/nrc-seal.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Seal_of_the_United_States_Office_of_Personnel_Management.svg/1200px-Seal_of_the_United_States_Office_of_Personnel_Management.svg.png",
NA,
"https://upload.wikimedia.org/wikipedia/commons/thumb/1/1c/Seal_of_the_United_States_Securities_and_Exchange_Commission.svg/1200px-Seal_of_the_United_States_Securities_and_Exchange_Commission.svg.png",
"https://www.ssa.gov/framework/images/logo.svg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/6/6a/United_States_Holocaust_Memorial_Museum_logo.svg/539px-United_States_Holocaust_Memorial_Museum_logo.svg.png",
"https://uspsblog.com/wp-content/uploads/2015/11/USPS_Eagle-Symbol-web-size.png"
)
),
class = c("tbl_df", "tbl", "data.frame"),
row.names = c(NA,
-36L),
.Names = c("nameAgency", "urlAgencyLogo")
)
data <-
data %>%
mutate(nameAgency = nameAgency %>% str_to_upper())
data
}
#' Solicitation group dictionary
#'
#' @return \code{tibble}
#' @export
#'
#' @examples
#' dictionary_solicitation_groups()
dictionary_solicitation_groups <-
function() {
tibble(
idSolicitationGroup = c(
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"22",
"23",
"24",
"25",
"26",
"28",
"29",
"30",
"31",
"32",
"34",
"35",
"36",
"37",
"38",
"39",
"40",
"41",
"42",
"43",
"44",
"45",
"46",
"47",
"48",
"49",
"51",
"52",
"53",
"54",
"55",
"56",
"58",
"59",
"60",
"61",
"62",
"63",
"65",
"66",
"67",
"68",
"69",
"70",
"71",
"72",
"73",
"74",
"75",
"76",
"77",
"78",
"79",
"80",
"81",
"83",
"84",
"85",
"87",
"88",
"89",
"91",
"93",
"94",
"95",
"96",
"99",
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"J",
"K",
"L",
"M",
"N",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z"
),
groupSolicitation = c(
"Weapons",
"Nuclear ordnance",
"Fire control equipment",
"Ammunition & explosives",
"Guided missiles",
"Aircraft & airframe structural components",
"Aircraft components & accessories",
"Aircraft launching, landing & ground handling equipment",
"Space vehicles",
"Ships, small craft, pontoons & floating docks",
"Ship and marine equipment",
"Railway equipment",
"ground effects vehicles, motor vehicles, trailers & cycles",
"Tractors",
"Vehicular equipment components",
"Tires and tubes",
"Engines, turbines & components",
"Engine accessories",
"Mechanical power transmission equipment",
"Bearings",
"Woodworking machinery and equipment",
"Metalworking machinery",
"Service and trade equipment",
"Special industry machinery",
"Agricultural machinery & equipment",
"Construction, mining, excavating & highway maintenance equipment",
"Materials handling equipment",
"Rope, cable, chain & fittings",
"Refrigeration, air-conditioning & air circulating equipment",
"Fire fighting, rescue & safety equipment",
"Pumps & compressors",
"Furnace, steam plant & drying equipment; & nuclear reactors",
"Plumbing, heating, & sanitation equipment",
"Water purification & sewage treatment equipment",
"Pipe, tubing, hose & fittings",
"Valves",
"maintenance & repair shop equipment",
"Hand tools",
"Measuring tools",
"Hardware & abrasives",
"Prefabricated structures and scaffolding",
"Lumber, millwork, plywood & veneer",
"Construction & building Materials",
"Communication, detection, & coherent radiation equipment",
"Electrical and electronic equipment components",
"Fiber optics Materials, components, assemblies & accessories",
"Electric wire & power & distribution equipment",
"Lighting fixtures & lamps",
"Alarm, signal & security detection equipment",
"Medical, dental & veterinary equipment & supplies",
"Instruments & laboratory equipment",
"Photographic equipment",
"Chemicals & chemical products",
"Training aids & devices",
"General purpose information technology equipment",
"Furniture",
"Household & commercial furnishings & appliances",
"Food preparation and serving equipment",
"Office machines, text processing systems & visible record equipment",
"Office supplies and devices",
"Books, maps & other publications",
"Musical Instruments, phonographs & home-type radios",
"Recreational & athletic equipment",
"Cleaning equipment and supplies",
"Brushes, paints, sealers & adhesives",
"Containers, packaging, & packing supplies",
"Textiles, leather, furs, apparel & shoe findings, tents & flags",
"Clothing, individual equipment & insignia",
"Toiletries",
"Agricultural supplies",
"Live animals",
"Subsistence",
"Fuels, lubricants, oils & waxes",
"Nonmetallic fabricated Materials",
"Nonmetallic crude Materials",
"Metal bars, sheets & shapes",
"Ores, minerals & their primary products",
"Miscellaneous",
"Research & Development",
"Special studies and analysis - not R&D",
"Architect and engineering services",
"information technology services, including telecommunications services",
"Purchase of structures & facilities",
"Natural resources & conservation services",
"Social services",
"Quality control, testing & inspection services",
"maintenance, repair & rebuilding of equipment",
"Modification of equipment",
"Technical representative services",
"Operation of Government-owned facilities",
"Installation of equipment",
"Salvage services",
"Medical services",
"Professional, administrative, and management support services",
"Utilities and housekeeping services",
"Photographic, mapping, printing, & publication services",
"Education & Training services",
"Transportation, travel, & relocation services",
"Lease or Rental of equipment",
"Lease or Rental of facilities",
"Construction of structures and facilities",
"maintenance, repair, and alteration of real property"
)
)
}
#' Federal Government APIs
#'
#' List of Federal APIs
#'
#' @return
#' @export
#'
#' @examples
#' dictionary_federal_apis()
dictionary_federal_apis <-
memoise::memoise(function() {
data <-
"https://raw.githubusercontent.com/GSA/federal-apis/2366d97e83e7801fdc480b066ed1409fb47cc6b9/inventory/federal-API-list.csv" %>%
read_csv() %>%
dplyr::slice(-1) %>%
mutate_all(list(function(x) {
case_when(x == "---" ~ NA_character_, TRUE ~ x)
})) %>%
setNames(
c(
"nameAgency",
"nameOffice" ,
"detailsOffice",
"nameAPI",
"urlAPI",
"statusAPI",
"urlAPIAgency",
"urlAgencyOther"
)
) %>%
suppressWarnings() %>%
suppressMessages()
data <-
data %>%
mutate(isActiveAPI = statusAPI == "active") %>%
select(-statusAPI) %>%
mutate(nameAgency = ifelse(is.na(nameAgency), nameOffice, nameAgency)) %>%
.munge_data()
data
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.