diff --git a/pkgdown.yml b/pkgdown.yml
index 1316a5c..9416da2 100644
--- a/pkgdown.yml
+++ b/pkgdown.yml
@@ -2,7 +2,7 @@ pandoc: 3.1.11
pkgdown: 2.1.1
pkgdown_sha: ~
articles: {}
-last_built: 2024-11-20T10:28Z
+last_built: 2024-11-21T12:00Z
urls:
reference: https://public-health-scotland.github.io/phsopendata/reference
article: https://public-health-scotland.github.io/phsopendata/articles
diff --git a/reference/index.html b/reference/index.html
index 5d79809..b4b7bbb 100644
--- a/reference/index.html
+++ b/reference/index.html
@@ -44,30 +44,6 @@
All functionscheck_dataset_name()
-
-
- Throws an error if a dataset name is invalid
- -
-
-
check_res_id()
-
-
- - Check if a resource ID is valid
-
-
-
-
dump_download()
-
-
- - Use datastore dump to download whole files
-
-
-
-
error_check()
-
-
- - Throws errors found in the content of an
httr::GET
request
-
-
-
get_dataset()
@@ -86,12 +62,6 @@
-
-
get_resource()
@@ -116,46 +86,10 @@ All functionsparse_col_select()
-
-
- - Create fields query for GET
-
-
-
parse_error()
- Generates error message from an "error" element of an
httr::content
object
-
-
-
-
parse_row_filters()
-
-
- - Create JSON 'dict' from named list or vector
-
-
-
-
phs_GET()
-
-
- - Send a GET request to the PHS CKAN API
-
-
-
-
request_url()
-
-
- - Produces a URL for a GET request to opendata.nhs.scot
-
-
-
-
suggest_dataset_name()
-
-
- - Throw an error with suggested dataset name, if possible.
-
-
-
-
use_dump_check()
-
-
- - Determines if the datastore dump should be used
diff --git a/search.json b/search.json
index f461792..d2956c0 100644
--- a/search.json
+++ b/search.json
@@ -1 +1 @@
-[{"path":"https://public-health-scotland.github.io/phsopendata/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Csilla Scharle. Author, maintainer. James McMahon. Author. David Aikman. Author. Ross Hull. Author.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Scharle C, McMahon J, Aikman D, Hull R (2024). phsopendata: Extract Open Data opendata.nhs.scot. R package version 0.2.0, https://public-health-scotland.github.io/phsopendata/, https://github.com/Public-Health-Scotland/phsopendata.","code":"@Manual{, title = {phsopendata: Extract Open Data from opendata.nhs.scot}, author = {Csilla Scharle and James McMahon and David Aikman and Ross Hull}, year = {2024}, note = {R package version 0.2.0, https://public-health-scotland.github.io/phsopendata/}, url = {https://github.com/Public-Health-Scotland/phsopendata}, }"},{"path":"https://public-health-scotland.github.io/phsopendata/index.html","id":"phsopendata","dir":"","previous_headings":"","what":"Extract Open Data from opendata.nhs.scot","title":"Extract Open Data from opendata.nhs.scot","text":"phsopendata contains functions interact open data Scottish Health Social Care Open Data platform via CKAN API. get_resource() extracts single resource open dataset resource id get_latest_resource() extracts recent resource applicable datasets, dataset name get_dataset() extracts multiple resources open dataset dataset name list_datasets() returns names available datasets list_resources() returns information resources within open dataset dataset name phsopendata can used Posit Workbench desktop versions RStudio.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Extract Open Data from opendata.nhs.scot","text":"need install phsopendata GitHub, requires package like remotes devtools. Using remotes run install package:","code":"remotes::install_github(\"Public-Health-Scotland/phsopendata\", upgrade = \"never\" )"},{"path":[]},{"path":"https://public-health-scotland.github.io/phsopendata/index.html","id":"downloading-a-data-table-with-get_resource","dir":"","previous_headings":"Examples","what":"Downloading a data table with get_resource()","title":"Extract Open Data from opendata.nhs.scot","text":"extract specific resource, need unique identifier - resource id. can found dataset metadata, URL resource’s page https://www.opendata.nhs.scot/, extracted using list_resources().","code":"library(phsopendata) # define a resource ID res_id <- \"a794d603-95ab-4309-8c92-b48970478c14\" # download the data from the CKAN database data <- get_resource(res_id = \"a794d603-95ab-4309-8c92-b48970478c14\")"},{"path":"https://public-health-scotland.github.io/phsopendata/index.html","id":"queryingfiltering-data-with-get_resource","dir":"","previous_headings":"Examples","what":"Querying/filtering data with get_resource()","title":"Extract Open Data from opendata.nhs.scot","text":"can define row limit rows argument get first N rows table. can use col_select row_filters query data server-side (.e., data filtered downloaded machine).","code":"# get first 100 rows get_resource( res_id = \"a794d603-95ab-4309-8c92-b48970478c14\", rows = 100 ) # get first 100 rows get_resource( res_id = \"a794d603-95ab-4309-8c92-b48970478c14\", col_select = c(\"GPPracticeName\", \"TelephoneNumber\"), row_filters = list( HB = \"S08000017\", Dispensing = \"Y\" ) )"},{"path":"https://public-health-scotland.github.io/phsopendata/index.html","id":"downloading-multiple-tables-with-get_dataset","dir":"","previous_headings":"Examples","what":"Downloading multiple tables with get_dataset()","title":"Extract Open Data from opendata.nhs.scot","text":"extract resources dataset, need use dataset name. Note differ dataset title displays website. can found using list_datasets(), taken dataset URL. example, downloading GP Practice Population Demographics : opendata.nhs.scot/dataset/gp-practice-populations, dataset name gp-practice-populations.","code":"# if max_resources is not set, all resources will be returned by default. # Here we pull 10 rows from the first 2 resources only get_dataset(\"gp-practice-populations\", max_resources = 2, rows = 10)"},{"path":"https://public-health-scotland.github.io/phsopendata/index.html","id":"contributing-to-phsopendata","dir":"","previous_headings":"","what":"Contributing to phsopendata","title":"Extract Open Data from opendata.nhs.scot","text":"present, package maintained Csilla Scharle. requests suggestions additional functionality, please contact package maintainer /PHS Open Data team. like share examples work open data, can also Open Data repository, example scripts resources collated.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/check_dataset_name.html","id":null,"dir":"Reference","previous_headings":"","what":"Throws an error if a dataset name is invalid — check_dataset_name","title":"Throws an error if a dataset name is invalid — check_dataset_name","text":"Used attempt validate dataset name submitting API","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/check_dataset_name.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Throws an error if a dataset name is invalid — check_dataset_name","text":"","code":"check_dataset_name(dataset_name)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/check_dataset_name.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Throws an error if a dataset name is invalid — check_dataset_name","text":"dataset_name resource ID","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/check_res_id.html","id":null,"dir":"Reference","previous_headings":"","what":"Check if a resource ID is valid — check_res_id","title":"Check if a resource ID is valid — check_res_id","text":"Used attempt validate res_id submitting API","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/check_res_id.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check if a resource ID is valid — check_res_id","text":"","code":"check_res_id(res_id)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/check_res_id.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check if a resource ID is valid — check_res_id","text":"res_id resource ID","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/check_res_id.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check if a resource ID is valid — check_res_id","text":"TRUE / FALSE indicating validity res_id","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/dump_download.html","id":null,"dir":"Reference","previous_headings":"","what":"Use datastore dump to download whole files — dump_download","title":"Use datastore dump to download whole files — dump_download","text":"Use datastore dump download whole files","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/dump_download.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Use datastore dump to download whole files — dump_download","text":"","code":"dump_download(res_id)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/dump_download.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Use datastore dump to download whole files — dump_download","text":"res_id resource ID","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/dump_download.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Use datastore dump to download whole files — dump_download","text":"dataframe containing resource records","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/error_check.html","id":null,"dir":"Reference","previous_headings":"","what":"Throws errors found in the content of an httr::GET request — error_check","title":"Throws errors found in the content of an httr::GET request — error_check","text":"Throws errors found content httr::GET request","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/error_check.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Throws errors found in the content of an httr::GET request — error_check","text":"","code":"error_check(content)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/error_check.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Throws errors found in the content of an httr::GET request — error_check","text":"content object produced httr::content","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset.html","id":null,"dir":"Reference","previous_headings":"","what":"Get Open Data resources from a dataset — get_dataset","title":"Get Open Data resources from a dataset — get_dataset","text":"Get Open Data resources dataset","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get Open Data resources from a dataset — get_dataset","text":"","code":"get_dataset( dataset_name, max_resources = NULL, rows = NULL, row_filters = NULL, col_select = NULL, include_context = FALSE )"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get Open Data resources from a dataset — get_dataset","text":"dataset_name name dataset found NHS Open Data platform max_resources (optional) maximum number resources return, use testing code, return n latest resources rows (optional) specify max number rows return resource. row_filters (optional) named list vector specifies values columns/fields keep. e.g. list(Date = 20220216, Sex = \"Female\"). col_select (optional) character vector containing names desired columns/fields. e.g. c(\"Date\", \"Sex\"). include_context (optional) TRUE additional information resource added columns data, including resource ID, resource name, creation date last modified/updated date.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get Open Data resources from a dataset — get_dataset","text":"tibble data","code":""},{"path":[]},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get Open Data resources from a dataset — get_dataset","text":"","code":"get_dataset(\"gp-practice-populations\", max_resources = 2, rows = 10 ) #> # A tibble: 20 × 24 #> Date PracticeCode HB HSCP Sex SexQF AllAges AllAgesQF Ages0to4 #> #> 1 20241001 10002 S08000030 S3700… Male \"\" 4109 \"\" 173 #> 2 20241001 10002 S08000030 S3700… Fema… \"\" 4221 \"\" 172 #> 3 20241001 10002 S08000030 S3700… All \"d\" 8330 \"\" 345 #> 4 20241001 10017 S08000030 S3700… Male \"\" 3742 \"\" 136 #> 5 20241001 10017 S08000030 S3700… Fema… \"\" 3721 \"\" 119 #> 6 20241001 10017 S08000030 S3700… All \"d\" 7463 \"\" 255 #> 7 20241001 10036 S08000030 S3700… Male \"\" 2452 \"\" 96 #> 8 20241001 10036 S08000030 S3700… Fema… \"\" 2412 \"\" 56 #> 9 20241001 10036 S08000030 S3700… All \"d\" 4864 \"\" 152 #> 10 20241001 10106 S08000030 S3700… Male \"\" 3106 \"\" 96 #> 11 20240701 10002 S08000030 S3700… Male \"\" 4072 \"\" 179 #> 12 20240701 10002 S08000030 S3700… Fema… \"\" 4188 \"\" 175 #> 13 20240701 10002 S08000030 S3700… All \"d\" 8260 \"\" 354 #> 14 20240701 10017 S08000030 S3700… Male \"\" 3697 \"\" 136 #> 15 20240701 10017 S08000030 S3700… Fema… \"\" 3657 \"\" 116 #> 16 20240701 10017 S08000030 S3700… All \"d\" 7354 \"\" 252 #> 17 20240701 10036 S08000030 S3700… Male \"\" 2449 \"\" 94 #> 18 20240701 10036 S08000030 S3700… Fema… \"\" 2407 \"\" 55 #> 19 20240701 10036 S08000030 S3700… All \"d\" 4856 \"\" 149 #> 20 20240701 10106 S08000030 S3700… Male \"\" 3100 \"\" 92 #> # ℹ 15 more variables: Ages0To4QF , Ages5to14 , Ages5To14QF , #> # Ages15to24 , Ages15To24QF , Ages25to44 , Ages25To44QF , #> # Ages45to64 , Ages45To64QF , Ages65to74 , Ages65To74QF , #> # Ages75to84 , Ages75To84QF , Ages85plus , Ages85PlusQF "},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset_additional_info.html","id":null,"dir":"Reference","previous_headings":"","what":"get a datasets additional info — get_dataset_additional_info","title":"get a datasets additional info — get_dataset_additional_info","text":"get_dataset_additional_info() returns tibble dataset names along amount resources date last updated.Last updated taken mean recent date resource within dataset created modified.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset_additional_info.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"get a datasets additional info — get_dataset_additional_info","text":"","code":"get_dataset_additional_info(dataset_name)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset_additional_info.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"get a datasets additional info — get_dataset_additional_info","text":"dataset_name name dataset found NHS Open Data platform","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset_additional_info.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"get a datasets additional info — get_dataset_additional_info","text":"tibble data","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset_additional_info.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"get a datasets additional info — get_dataset_additional_info","text":"","code":"get_dataset_additional_info(\"gp-practice-populations\") #> # A tibble: 1 × 3 #> name n_resources last_updated #> #> 1 gp-practice-populations 44 2024-10-21 09:30:01"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the latest resource from a data set — get_latest_resource","title":"Get the latest resource from a data set — get_latest_resource","text":"Returns latest resource available dataset.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the latest resource from a data set — get_latest_resource","text":"","code":"get_latest_resource( dataset_name, rows = NULL, row_filters = NULL, col_select = NULL, include_context = TRUE )"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the latest resource from a data set — get_latest_resource","text":"dataset_name name dataset found NHS Open Data platform rows (optional) specify max number rows return resource. row_filters (optional) named list vector specifies values columns/fields keep. e.g. list(Date = 20220216, Sex = \"Female\"). col_select (optional) character vector containing names desired columns/fields. e.g. c(\"Date\", \"Sex\"). include_context (optional) TRUE additional information resource added columns data, including resource ID, resource name, creation date last modified/updated date.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the latest resource from a data set — get_latest_resource","text":"tibble data","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Get the latest resource from a data set — get_latest_resource","text":"datasets open data platform keep historic resources instead updating existing ones. useful able retrieve latest resource. 1.8.2024 data sets include: gp-practice-populations gp-practice-contact-details--list-sizes nhsscotland-payments--general-practice dental-practices--patient-registrations general-practitioner-contact-details prescribed-dispensed dispenser-location-contact-details community-pharmacy-contractor-activity","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the latest resource from a data set — get_latest_resource","text":"","code":"dataset_name <- \"gp-practice-contact-details-and-list-sizes\" data <- get_latest_resource(dataset_name) filters <- list(\"Postcode\" = \"DD11 1ES\") wanted_cols <- c(\"PracticeCode\", \"Postcode\", \"Dispensing\") filtered_data <- get_latest_resource( dataset_name = dataset_name, row_filters = filters, col_select = wanted_cols )"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource_id.html","id":null,"dir":"Reference","previous_headings":"","what":"get_latest_resource_id — get_latest_resource_id","title":"get_latest_resource_id — get_latest_resource_id","text":"confident resource returned one intended two conditions met. appear top resource list shown open data platform. order returned via api appear open data platform. also recent date created","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource_id.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"get_latest_resource_id — get_latest_resource_id","text":"","code":"get_latest_resource_id(dataset_name)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource_id.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"get_latest_resource_id — get_latest_resource_id","text":"dataset_name name dataset found NHS Open Data platform","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource_id.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"get_latest_resource_id — get_latest_resource_id","text":"string resource id","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource_id.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"get_latest_resource_id — get_latest_resource_id","text":"datasets functionality relevant , listed within applicable datasets datasets keep historic resources instead writing .","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource.html","id":null,"dir":"Reference","previous_headings":"","what":"Get Open Data resource — get_resource","title":"Get Open Data resource — get_resource","text":"Get Open Data resource","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get Open Data resource — get_resource","text":"","code":"get_resource( res_id, rows = NULL, row_filters = NULL, col_select = NULL, include_context = FALSE )"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get Open Data resource — get_resource","text":"res_id resource ID found NHS Open Data platform rows (optional) specify max number rows return. row_filters (optional) named list vector specifies values columns/fields keep. e.g. list(Date = 20220216, Sex = \"Female\"). col_select (optional) character vector containing names desired columns/fields. e.g. c(\"Date\", \"Sex\"). include_context (optional) TRUE additional information resource added columns data, including resource ID, resource name, creation date last modified/updated date.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get Open Data resource — get_resource","text":"tibble data","code":""},{"path":[]},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get Open Data resource — get_resource","text":"","code":"res_id <- \"ca3f8e44-9a84-43d6-819c-a880b23bd278\" data <- get_resource(res_id) filters <- list(\"HB\" = \"S08000030\", \"Month\" = \"202109\") wanted_cols <- c(\"HB\", \"Month\", \"TotalPatientsSeen\") filtered_data <- get_resource( res_id = res_id, row_filters = filters, col_select = wanted_cols )"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource_sql.html","id":null,"dir":"Reference","previous_headings":"","what":"Get PHS Open Data using SQL — get_resource_sql","title":"Get PHS Open Data using SQL — get_resource_sql","text":"Similar get_resource() options server-side querying data. However, function lower maximum row number (32,000 vs 99,999) returned results.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource_sql.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get PHS Open Data using SQL — get_resource_sql","text":"","code":"get_resource_sql(sql)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource_sql.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get PHS Open Data using SQL — get_resource_sql","text":"sql (character) single PostgreSQL SELECT query. Must include resource ID, must double-quoted e.g., SELECT * \"58527343-a930-4058-bf9e-3c6e5cb04010\" Column names must double-quoted, character values filters must single-quoted. e.g., \"Age\" = '34' may need escape quote marks \\ implement . e.g., sql = \"SELECT * \\\"\\\" \\\"Age\\\" = '34'\".","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource_sql.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get PHS Open Data using SQL — get_resource_sql","text":"tibble query results. 32,000 rows can returned single SQL query.","code":""},{"path":[]},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource_sql.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get PHS Open Data using SQL — get_resource_sql","text":"","code":"sql <- \" SELECT \\\"TotalCancelled\\\",\\\"TotalOperations\\\",\\\"Hospital\\\",\\\"Month\\\" FROM \\\"bcc860a4-49f4-4232-a76b-f559cf6eb885\\\" WHERE \\\"Hospital\\\" = 'D102H' \" df <- get_resource_sql(sql) # This is equivalent to: cols <- c( \"TotalCancelled\", \"TotalOperations\", \"Hospital\", \"Month\" ) row_filter <- c(Hospital = \"D102H\") df2 <- get_resource( \"bcc860a4-49f4-4232-a76b-f559cf6eb885\", col_select = cols, row_filters = row_filter )"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/list_datasets.html","id":null,"dir":"Reference","previous_headings":"","what":"Lists all available datasets — list_datasets","title":"Lists all available datasets — list_datasets","text":"list_datasets() shows datasets hosted phs open data platform.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/list_datasets.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Lists all available datasets — list_datasets","text":"","code":"list_datasets()"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/list_datasets.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Lists all available datasets — list_datasets","text":"tibble.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/list_datasets.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Lists all available datasets — list_datasets","text":"","code":"head(list_datasets()) #> # A tibble: 6 × 1 #> name #> #> 1 18-weeks-referral-to-treatment #> 2 27-30-month-review-statistics #> 3 alcohol-related-hospital-statistics-scotland #> 4 allied-health-professionals-musculoskeletal-waiting-times #> 5 allied-health-professional-vacancies #> 6 annual-cancer-incidence"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/list_resources.html","id":null,"dir":"Reference","previous_headings":"","what":"Lists all available resources for a dataset — list_resources","title":"Lists all available resources for a dataset — list_resources","text":"list_resources() returns resources associated dataset","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/list_resources.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Lists all available resources for a dataset — list_resources","text":"","code":"list_resources(dataset_name)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/list_resources.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Lists all available resources for a dataset — list_resources","text":"dataset_name name dataset found NHS Open Data platform","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/list_resources.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Lists all available resources for a dataset — list_resources","text":"tibble data","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/list_resources.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Lists all available resources for a dataset — list_resources","text":"","code":"list_resources(\"weekly-accident-and-emergency-activity-and-waiting-times\") #> # A tibble: 1 × 4 #> res_id name created last_modified #> #> 1 a5f7ca94-c810-41b5-a7c9-25c18d4… Week… 2023-05-02 07:57:54 2024-11-19 09:30:20"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/parse_col_select.html","id":null,"dir":"Reference","previous_headings":"","what":"Create fields query for GET — parse_col_select","title":"Create fields query for GET — parse_col_select","text":"Produces comma separated list","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/parse_col_select.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create fields query for GET — parse_col_select","text":"","code":"parse_col_select(col_select)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/parse_col_select.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create fields query for GET — parse_col_select","text":"col_select character vector identifying columns select.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/parse_col_select.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create fields query for GET — parse_col_select","text":"character string","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/parse_error.html","id":null,"dir":"Reference","previous_headings":"","what":"Generates error message from an ","title":"Generates error message from an ","text":"Generates error message \"error\" element httr::content object","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/parse_error.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generates error message from an ","text":"","code":"parse_error(error)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/parse_error.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generates error message from an ","text":"error \"error\" element object produced httr::content","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/parse_error.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generates error message from an ","text":"character string","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/parse_row_filters.html","id":null,"dir":"Reference","previous_headings":"","what":"Create JSON 'dict' from named list or vector — parse_row_filters","title":"Create JSON 'dict' from named list or vector — parse_row_filters","text":"Formats list named vector valid query","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/parse_row_filters.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create JSON 'dict' from named list or vector — parse_row_filters","text":"","code":"parse_row_filters(row_filters)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/parse_row_filters.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create JSON 'dict' from named list or vector — parse_row_filters","text":"row_filters list named vectors matching fields values","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/parse_row_filters.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create JSON 'dict' from named list or vector — parse_row_filters","text":"json character string","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/phs_GET.html","id":null,"dir":"Reference","previous_headings":"","what":"Send a GET request to the PHS CKAN API — phs_GET","title":"Send a GET request to the PHS CKAN API — phs_GET","text":"Send GET request PHS CKAN API","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/phs_GET.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Send a GET request to the PHS CKAN API — phs_GET","text":"","code":"phs_GET(action, query, verbose = FALSE)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/phs_GET.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Send a GET request to the PHS CKAN API — phs_GET","text":"action API endpoint want use, e.g., \"package_show\" / \"datastore_search\". query query pass endpoint defined action argument. verbose TRUE FALSE. TRUE, success message printed console.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/phs_GET.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Send a GET request to the PHS CKAN API — phs_GET","text":"content httr::GET request","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/pipe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pipe operator — %>%","text":"lhs value magrittr placeholder. rhs function call using magrittr semantics.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/pipe.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pipe operator — %>%","text":"result calling rhs(lhs).","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/request_url.html","id":null,"dir":"Reference","previous_headings":"","what":"Produces a URL for a GET request to opendata.nhs.scot — request_url","title":"Produces a URL for a GET request to opendata.nhs.scot — request_url","text":"Produces URL GET request opendata.nhs.scot","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/request_url.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Produces a URL for a GET request to opendata.nhs.scot — request_url","text":"","code":"request_url(action, query)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/request_url.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Produces a URL for a GET request to opendata.nhs.scot — request_url","text":"action API endpoint want use, e.g., \"package_show\" / \"datastore_search\". query query pass endpoint defined action argument.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/request_url.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Produces a URL for a GET request to opendata.nhs.scot — request_url","text":"URL character string","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/suggest_dataset_name.html","id":null,"dir":"Reference","previous_headings":"","what":"Throw an error with suggested dataset name, if possible. — suggest_dataset_name","title":"Throw an error with suggested dataset name, if possible. — suggest_dataset_name","text":"Throw error suggested dataset name, possible.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/suggest_dataset_name.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Throw an error with suggested dataset name, if possible. — suggest_dataset_name","text":"","code":"suggest_dataset_name(dataset_name)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/suggest_dataset_name.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Throw an error with suggested dataset name, if possible. — suggest_dataset_name","text":"dataset_name string matched valid dataset names","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/use_dump_check.html","id":null,"dir":"Reference","previous_headings":"","what":"Determines if the datastore dump should be used — use_dump_check","title":"Determines if the datastore dump should be used — use_dump_check","text":"Determines datastore dump used","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/use_dump_check.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determines if the datastore dump should be used — use_dump_check","text":"","code":"use_dump_check(query, rows)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/use_dump_check.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determines if the datastore dump should be used — use_dump_check","text":"query list items query rows number rows user requesting","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/use_dump_check.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determines if the datastore dump should be used — use_dump_check","text":"logical value. TRUE indicates dump used","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/news/index.html","id":"phsopendata-020-2024-09-18","dir":"Changelog","previous_headings":"","what":"phsopendata 0.2.0 (2024-09-18)","title":"phsopendata 0.2.0 (2024-09-18)","text":"get_dataset() get_resource() gain new parameter include_context allows adding context resource ID modified / created dates returned data (#24). magrittr pipe (%>%) now exported (#29). get_dataset() now suggest multiple dataset names, dataset ’ve asked doesn’t exist (.e. ’s typo) multiple likely candidates (#28). Two new functions list_datasets() list_resources() allow browsing available datasets resources (#10). new function get_latest_resource() retrieves recent resource dataset additional context resource ID modified / created dates (#36).","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/news/index.html","id":"phsopendata-010-2021-07-22","dir":"Changelog","previous_headings":"","what":"phsopendata 0.1.0 (2021-07-22)","title":"phsopendata 0.1.0 (2021-07-22)","text":"Initial package release. get_dataset(), get_resource() get_resource_sql() functions added.","code":""}]
+[{"path":"https://public-health-scotland.github.io/phsopendata/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Csilla Scharle. Author, maintainer. James McMahon. Author. David Aikman. Author. Ross Hull. Author.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Scharle C, McMahon J, Aikman D, Hull R (2024). phsopendata: Extract Open Data opendata.nhs.scot. R package version 0.2.0, https://public-health-scotland.github.io/phsopendata/, https://github.com/Public-Health-Scotland/phsopendata.","code":"@Manual{, title = {phsopendata: Extract Open Data from opendata.nhs.scot}, author = {Csilla Scharle and James McMahon and David Aikman and Ross Hull}, year = {2024}, note = {R package version 0.2.0, https://public-health-scotland.github.io/phsopendata/}, url = {https://github.com/Public-Health-Scotland/phsopendata}, }"},{"path":"https://public-health-scotland.github.io/phsopendata/index.html","id":"phsopendata","dir":"","previous_headings":"","what":"Extract Open Data from opendata.nhs.scot","title":"Extract Open Data from opendata.nhs.scot","text":"phsopendata contains functions interact open data Scottish Health Social Care Open Data platform via CKAN API. get_resource() extracts single resource open dataset resource id get_latest_resource() extracts recent resource applicable datasets, dataset name get_dataset() extracts multiple resources open dataset dataset name list_datasets() returns names available datasets list_resources() returns information resources within open dataset dataset name phsopendata can used Posit Workbench desktop versions RStudio.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Extract Open Data from opendata.nhs.scot","text":"need install phsopendata GitHub, requires package like remotes devtools. Using remotes run install package:","code":"remotes::install_github(\"Public-Health-Scotland/phsopendata\", upgrade = \"never\" )"},{"path":[]},{"path":"https://public-health-scotland.github.io/phsopendata/index.html","id":"downloading-a-data-table-with-get_resource","dir":"","previous_headings":"Examples","what":"Downloading a data table with get_resource()","title":"Extract Open Data from opendata.nhs.scot","text":"extract specific resource, need unique identifier - resource id. can found dataset metadata, URL resource’s page https://www.opendata.nhs.scot/, extracted using list_resources().","code":"library(phsopendata) # define a resource ID res_id <- \"a794d603-95ab-4309-8c92-b48970478c14\" # download the data from the CKAN database data <- get_resource(res_id = \"a794d603-95ab-4309-8c92-b48970478c14\")"},{"path":"https://public-health-scotland.github.io/phsopendata/index.html","id":"queryingfiltering-data-with-get_resource","dir":"","previous_headings":"Examples","what":"Querying/filtering data with get_resource()","title":"Extract Open Data from opendata.nhs.scot","text":"can define row limit rows argument get first N rows table. can use col_select row_filters query data server-side (.e., data filtered downloaded machine).","code":"# get first 100 rows get_resource( res_id = \"a794d603-95ab-4309-8c92-b48970478c14\", rows = 100 ) # get first 100 rows get_resource( res_id = \"a794d603-95ab-4309-8c92-b48970478c14\", col_select = c(\"GPPracticeName\", \"TelephoneNumber\"), row_filters = list( HB = \"S08000017\", Dispensing = \"Y\" ) )"},{"path":"https://public-health-scotland.github.io/phsopendata/index.html","id":"downloading-multiple-tables-with-get_dataset","dir":"","previous_headings":"Examples","what":"Downloading multiple tables with get_dataset()","title":"Extract Open Data from opendata.nhs.scot","text":"extract resources dataset, need use dataset name. Note differ dataset title displays website. can found using list_datasets(), taken dataset URL. example, downloading GP Practice Population Demographics : opendata.nhs.scot/dataset/gp-practice-populations, dataset name gp-practice-populations.","code":"# if max_resources is not set, all resources will be returned by default. # Here we pull 10 rows from the first 2 resources only get_dataset(\"gp-practice-populations\", max_resources = 2, rows = 10)"},{"path":"https://public-health-scotland.github.io/phsopendata/index.html","id":"contributing-to-phsopendata","dir":"","previous_headings":"","what":"Contributing to phsopendata","title":"Extract Open Data from opendata.nhs.scot","text":"present, package maintained Csilla Scharle. requests suggestions additional functionality, please contact package maintainer /PHS Open Data team. like share examples work open data, can also Open Data repository, example scripts resources collated.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset.html","id":null,"dir":"Reference","previous_headings":"","what":"Get Open Data resources from a dataset — get_dataset","title":"Get Open Data resources from a dataset — get_dataset","text":"Get Open Data resources dataset","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get Open Data resources from a dataset — get_dataset","text":"","code":"get_dataset( dataset_name, max_resources = NULL, rows = NULL, row_filters = NULL, col_select = NULL, include_context = FALSE )"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get Open Data resources from a dataset — get_dataset","text":"dataset_name name dataset found NHS Open Data platform max_resources (optional) maximum number resources return, use testing code, return n latest resources rows (optional) specify max number rows return resource. row_filters (optional) named list vector specifies values columns/fields keep. e.g. list(Date = 20220216, Sex = \"Female\"). col_select (optional) character vector containing names desired columns/fields. e.g. c(\"Date\", \"Sex\"). include_context (optional) TRUE additional information resource added columns data, including resource ID, resource name, creation date last modified/updated date.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get Open Data resources from a dataset — get_dataset","text":"tibble data","code":""},{"path":[]},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get Open Data resources from a dataset — get_dataset","text":"","code":"get_dataset(\"gp-practice-populations\", max_resources = 2, rows = 10 ) #> # A tibble: 20 × 24 #> Date PracticeCode HB HSCP Sex SexQF AllAges AllAgesQF Ages0to4 #> #> 1 20241001 10002 S08000030 S3700… Male \"\" 4109 \"\" 173 #> 2 20241001 10002 S08000030 S3700… Fema… \"\" 4221 \"\" 172 #> 3 20241001 10002 S08000030 S3700… All \"d\" 8330 \"\" 345 #> 4 20241001 10017 S08000030 S3700… Male \"\" 3742 \"\" 136 #> 5 20241001 10017 S08000030 S3700… Fema… \"\" 3721 \"\" 119 #> 6 20241001 10017 S08000030 S3700… All \"d\" 7463 \"\" 255 #> 7 20241001 10036 S08000030 S3700… Male \"\" 2452 \"\" 96 #> 8 20241001 10036 S08000030 S3700… Fema… \"\" 2412 \"\" 56 #> 9 20241001 10036 S08000030 S3700… All \"d\" 4864 \"\" 152 #> 10 20241001 10106 S08000030 S3700… Male \"\" 3106 \"\" 96 #> 11 20240701 10002 S08000030 S3700… Male \"\" 4072 \"\" 179 #> 12 20240701 10002 S08000030 S3700… Fema… \"\" 4188 \"\" 175 #> 13 20240701 10002 S08000030 S3700… All \"d\" 8260 \"\" 354 #> 14 20240701 10017 S08000030 S3700… Male \"\" 3697 \"\" 136 #> 15 20240701 10017 S08000030 S3700… Fema… \"\" 3657 \"\" 116 #> 16 20240701 10017 S08000030 S3700… All \"d\" 7354 \"\" 252 #> 17 20240701 10036 S08000030 S3700… Male \"\" 2449 \"\" 94 #> 18 20240701 10036 S08000030 S3700… Fema… \"\" 2407 \"\" 55 #> 19 20240701 10036 S08000030 S3700… All \"d\" 4856 \"\" 149 #> 20 20240701 10106 S08000030 S3700… Male \"\" 3100 \"\" 92 #> # ℹ 15 more variables: Ages0To4QF , Ages5to14 , Ages5To14QF , #> # Ages15to24 , Ages15To24QF , Ages25to44 , Ages25To44QF , #> # Ages45to64 , Ages45To64QF , Ages65to74 , Ages65To74QF , #> # Ages75to84 , Ages75To84QF , Ages85plus , Ages85PlusQF "},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset_additional_info.html","id":null,"dir":"Reference","previous_headings":"","what":"get a datasets additional info — get_dataset_additional_info","title":"get a datasets additional info — get_dataset_additional_info","text":"get_dataset_additional_info() returns tibble dataset names along amount resources date last updated.Last updated taken mean recent date resource within dataset created modified.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset_additional_info.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"get a datasets additional info — get_dataset_additional_info","text":"","code":"get_dataset_additional_info(dataset_name)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset_additional_info.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"get a datasets additional info — get_dataset_additional_info","text":"dataset_name name dataset found NHS Open Data platform","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset_additional_info.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"get a datasets additional info — get_dataset_additional_info","text":"tibble data","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_dataset_additional_info.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"get a datasets additional info — get_dataset_additional_info","text":"","code":"get_dataset_additional_info(\"gp-practice-populations\") #> # A tibble: 1 × 3 #> name n_resources last_updated #> #> 1 gp-practice-populations 44 2024-10-21 09:30:01"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the latest resource from a data set — get_latest_resource","title":"Get the latest resource from a data set — get_latest_resource","text":"Returns latest resource available dataset.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the latest resource from a data set — get_latest_resource","text":"","code":"get_latest_resource( dataset_name, rows = NULL, row_filters = NULL, col_select = NULL, include_context = TRUE )"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the latest resource from a data set — get_latest_resource","text":"dataset_name name dataset found NHS Open Data platform rows (optional) specify max number rows return resource. row_filters (optional) named list vector specifies values columns/fields keep. e.g. list(Date = 20220216, Sex = \"Female\"). col_select (optional) character vector containing names desired columns/fields. e.g. c(\"Date\", \"Sex\"). include_context (optional) TRUE additional information resource added columns data, including resource ID, resource name, creation date last modified/updated date.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the latest resource from a data set — get_latest_resource","text":"tibble data","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Get the latest resource from a data set — get_latest_resource","text":"datasets open data platform keep historic resources instead updating existing ones. useful able retrieve latest resource. 1.8.2024 data sets include: gp-practice-populations gp-practice-contact-details--list-sizes nhsscotland-payments--general-practice dental-practices--patient-registrations general-practitioner-contact-details prescribed-dispensed dispenser-location-contact-details community-pharmacy-contractor-activity","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the latest resource from a data set — get_latest_resource","text":"","code":"dataset_name <- \"gp-practice-contact-details-and-list-sizes\" data <- get_latest_resource(dataset_name) filters <- list(\"Postcode\" = \"DD11 1ES\") wanted_cols <- c(\"PracticeCode\", \"Postcode\", \"Dispensing\") filtered_data <- get_latest_resource( dataset_name = dataset_name, row_filters = filters, col_select = wanted_cols )"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource.html","id":null,"dir":"Reference","previous_headings":"","what":"Get Open Data resource — get_resource","title":"Get Open Data resource — get_resource","text":"Get Open Data resource","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get Open Data resource — get_resource","text":"","code":"get_resource( res_id, rows = NULL, row_filters = NULL, col_select = NULL, include_context = FALSE )"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get Open Data resource — get_resource","text":"res_id resource ID found NHS Open Data platform rows (optional) specify max number rows return. row_filters (optional) named list vector specifies values columns/fields keep. e.g. list(Date = 20220216, Sex = \"Female\"). col_select (optional) character vector containing names desired columns/fields. e.g. c(\"Date\", \"Sex\"). include_context (optional) TRUE additional information resource added columns data, including resource ID, resource name, creation date last modified/updated date.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get Open Data resource — get_resource","text":"tibble data","code":""},{"path":[]},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get Open Data resource — get_resource","text":"","code":"res_id <- \"ca3f8e44-9a84-43d6-819c-a880b23bd278\" data <- get_resource(res_id) filters <- list(\"HB\" = \"S08000030\", \"Month\" = \"202109\") wanted_cols <- c(\"HB\", \"Month\", \"TotalPatientsSeen\") filtered_data <- get_resource( res_id = res_id, row_filters = filters, col_select = wanted_cols )"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource_sql.html","id":null,"dir":"Reference","previous_headings":"","what":"Get PHS Open Data using SQL — get_resource_sql","title":"Get PHS Open Data using SQL — get_resource_sql","text":"Similar get_resource() options server-side querying data. However, function lower maximum row number (32,000 vs 99,999) returned results.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource_sql.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get PHS Open Data using SQL — get_resource_sql","text":"","code":"get_resource_sql(sql)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource_sql.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get PHS Open Data using SQL — get_resource_sql","text":"sql (character) single PostgreSQL SELECT query. Must include resource ID, must double-quoted e.g., SELECT * \"58527343-a930-4058-bf9e-3c6e5cb04010\" Column names must double-quoted, character values filters must single-quoted. e.g., \"Age\" = '34' may need escape quote marks \\ implement . e.g., sql = \"SELECT * \\\"\\\" \\\"Age\\\" = '34'\".","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource_sql.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get PHS Open Data using SQL — get_resource_sql","text":"tibble query results. 32,000 rows can returned single SQL query.","code":""},{"path":[]},{"path":"https://public-health-scotland.github.io/phsopendata/reference/get_resource_sql.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get PHS Open Data using SQL — get_resource_sql","text":"","code":"sql <- \" SELECT \\\"TotalCancelled\\\",\\\"TotalOperations\\\",\\\"Hospital\\\",\\\"Month\\\" FROM \\\"bcc860a4-49f4-4232-a76b-f559cf6eb885\\\" WHERE \\\"Hospital\\\" = 'D102H' \" df <- get_resource_sql(sql) # This is equivalent to: cols <- c( \"TotalCancelled\", \"TotalOperations\", \"Hospital\", \"Month\" ) row_filter <- c(Hospital = \"D102H\") df2 <- get_resource( \"bcc860a4-49f4-4232-a76b-f559cf6eb885\", col_select = cols, row_filters = row_filter )"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/list_datasets.html","id":null,"dir":"Reference","previous_headings":"","what":"Lists all available datasets — list_datasets","title":"Lists all available datasets — list_datasets","text":"list_datasets() shows datasets hosted phs open data platform.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/list_datasets.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Lists all available datasets — list_datasets","text":"","code":"list_datasets()"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/list_datasets.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Lists all available datasets — list_datasets","text":"tibble.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/list_datasets.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Lists all available datasets — list_datasets","text":"","code":"head(list_datasets()) #> # A tibble: 6 × 1 #> name #> #> 1 18-weeks-referral-to-treatment #> 2 27-30-month-review-statistics #> 3 alcohol-related-hospital-statistics-scotland #> 4 allied-health-professionals-musculoskeletal-waiting-times #> 5 allied-health-professional-vacancies #> 6 annual-cancer-incidence"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/list_resources.html","id":null,"dir":"Reference","previous_headings":"","what":"Lists all available resources for a dataset — list_resources","title":"Lists all available resources for a dataset — list_resources","text":"list_resources() returns resources associated dataset","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/list_resources.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Lists all available resources for a dataset — list_resources","text":"","code":"list_resources(dataset_name)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/list_resources.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Lists all available resources for a dataset — list_resources","text":"dataset_name name dataset found NHS Open Data platform","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/list_resources.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Lists all available resources for a dataset — list_resources","text":"tibble data","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/list_resources.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Lists all available resources for a dataset — list_resources","text":"","code":"list_resources(\"weekly-accident-and-emergency-activity-and-waiting-times\") #> # A tibble: 1 × 4 #> res_id name created last_modified #> #> 1 a5f7ca94-c810-41b5-a7c9-25c18d4… Week… 2023-05-02 07:57:54 2024-11-19 09:30:20"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/parse_error.html","id":null,"dir":"Reference","previous_headings":"","what":"Generates error message from an ","title":"Generates error message from an ","text":"Generates error message \"error\" element httr::content object","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/parse_error.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generates error message from an ","text":"","code":"parse_error(error)"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/parse_error.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generates error message from an ","text":"error \"error\" element object produced httr::content","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/parse_error.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generates error message from an ","text":"character string","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://public-health-scotland.github.io/phsopendata/reference/pipe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pipe operator — %>%","text":"lhs value magrittr placeholder. rhs function call using magrittr semantics.","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/reference/pipe.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pipe operator — %>%","text":"result calling rhs(lhs).","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/news/index.html","id":"phsopendata-020-2024-09-18","dir":"Changelog","previous_headings":"","what":"phsopendata 0.2.0 (2024-09-18)","title":"phsopendata 0.2.0 (2024-09-18)","text":"get_dataset() get_resource() gain new parameter include_context allows adding context resource ID modified / created dates returned data (#24). magrittr pipe (%>%) now exported (#29). get_dataset() now suggest multiple dataset names, dataset ’ve asked doesn’t exist (.e. ’s typo) multiple likely candidates (#28). Two new functions list_datasets() list_resources() allow browsing available datasets resources (#10). new function get_latest_resource() retrieves recent resource dataset additional context resource ID modified / created dates (#36).","code":""},{"path":"https://public-health-scotland.github.io/phsopendata/news/index.html","id":"phsopendata-010-2021-07-22","dir":"Changelog","previous_headings":"","what":"phsopendata 0.1.0 (2021-07-22)","title":"phsopendata 0.1.0 (2021-07-22)","text":"Initial package release. get_dataset(), get_resource() get_resource_sql() functions added.","code":""}]
diff --git a/sitemap.xml b/sitemap.xml
index e81d394..e89bdde 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -3,26 +3,15 @@
https://public-health-scotland.github.io/phsopendata/authors.html
https://public-health-scotland.github.io/phsopendata/index.html
https://public-health-scotland.github.io/phsopendata/news/index.html
-https://public-health-scotland.github.io/phsopendata/reference/check_dataset_name.html
-https://public-health-scotland.github.io/phsopendata/reference/check_res_id.html
-https://public-health-scotland.github.io/phsopendata/reference/dump_download.html
-https://public-health-scotland.github.io/phsopendata/reference/error_check.html
https://public-health-scotland.github.io/phsopendata/reference/get_dataset.html
https://public-health-scotland.github.io/phsopendata/reference/get_dataset_additional_info.html
https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource.html
-https://public-health-scotland.github.io/phsopendata/reference/get_latest_resource_id.html
https://public-health-scotland.github.io/phsopendata/reference/get_resource.html
https://public-health-scotland.github.io/phsopendata/reference/get_resource_sql.html
https://public-health-scotland.github.io/phsopendata/reference/index.html
https://public-health-scotland.github.io/phsopendata/reference/list_datasets.html
https://public-health-scotland.github.io/phsopendata/reference/list_resources.html
-https://public-health-scotland.github.io/phsopendata/reference/parse_col_select.html
https://public-health-scotland.github.io/phsopendata/reference/parse_error.html
-https://public-health-scotland.github.io/phsopendata/reference/parse_row_filters.html
-https://public-health-scotland.github.io/phsopendata/reference/phs_GET.html
https://public-health-scotland.github.io/phsopendata/reference/pipe.html
-https://public-health-scotland.github.io/phsopendata/reference/request_url.html
-https://public-health-scotland.github.io/phsopendata/reference/suggest_dataset_name.html
-https://public-health-scotland.github.io/phsopendata/reference/use_dump_check.html