-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
491 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,35 @@ | ||
Package: phsopendata | ||
Title: Extract Open Data from opendata.nhs.scot | ||
Version: 0.1.0 | ||
Authors@R: | ||
c(person(given = "Csilla", family = "Scharle", role = c("aut", "cre"), email = "[email protected]"), | ||
person("James", "McMahon", email = "[email protected]", role = "aut"), | ||
person("David", "Aikman", email = "[email protected]", role = "aut")) | ||
Description: Functions to extract and interact with data from the Scottish Health and Social Care Open Data platform. | ||
Authors@R: c( | ||
person("Csilla", "Scharle", , "[email protected]", role = c("aut", "cre")), | ||
person("James", "McMahon", , "[email protected]", role = "aut"), | ||
person("David", "Aikman", , "[email protected]", role = "aut") | ||
) | ||
Description: Functions to extract and interact with data from the Scottish | ||
Health and Social Care Open Data platform. | ||
License: GPL (>= 2) | ||
URL: https://github.com/Public-Health-Scotland/phsopendata, | ||
https://public-health-scotland.github.io/phsopendata/ | ||
BugReports: https://github.com/Public-Health-Scotland/phsopendata/issues | ||
Imports: | ||
cli, | ||
dplyr (>= 1.0.0), | ||
httr (>= 1.0.0), | ||
glue (>= 1.0.0), | ||
purrr, | ||
tibble (>= 3.0.0), | ||
httr (>= 1.0.0), | ||
jsonlite (>= 1.0.0), | ||
magrittr (>= 1.0.0), | ||
purrr, | ||
readr (>= 1.0.0), | ||
stringdist, | ||
cli, | ||
tibble (>= 3.0.0), | ||
xml2 | ||
Suggests: | ||
covr, | ||
testthat (>= 3.0.0) | ||
Config/testthat/edition: 3 | ||
Config/testthat/parallel: true | ||
Encoding: UTF-8 | ||
LazyData: true | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.3.1 | ||
Config/testthat/edition: 3 | ||
URL: https://github.com/Public-Health-Scotland/phsopendata, | ||
https://public-health-scotland.github.io/phsopendata/ | ||
BugReports: https://github.com/Public-Health-Scotland/phsopendata/issues |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
add_context <- function(data, id, name, created_date, modified_date) { | ||
# Catch if the resource has never been modified | ||
if (is.null(modified_date)) { | ||
modified_date <- NA_character_ | ||
} | ||
|
||
# Parse the date values | ||
created_date <- as.POSIXct(created_date, format = "%FT%X", tz = "UTC") | ||
modified_date <- as.POSIXct(modified_date, format = "%FT%X", tz = "UTC") | ||
|
||
# The platform can record the modified date as being before the created date | ||
# by a few microseconds, this will catch any rounding which ensure | ||
# created_date is always <= modified_date | ||
if (modified_date < created_date) { | ||
modified_date <- created_date | ||
} | ||
|
||
data_with_context <- dplyr::mutate( | ||
data, | ||
"ResID" = id, | ||
"ResName" = name, | ||
"ResCreatedDate" = created_date, | ||
"ResModifiedDate" = modified_date, | ||
.before = dplyr::everything() | ||
) | ||
|
||
return(data_with_context) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.