Skip to content

Commit

Permalink
Merge pull request #15 from f-hafner/drop_education_degrees
Browse files Browse the repository at this point in the history
drop graduates with ed. degrees
  • Loading branch information
f-hafner committed Nov 4, 2022
2 parents 5f22083 + 7e16e85 commit 38616c7
Show file tree
Hide file tree
Showing 12 changed files with 145 additions and 77 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Description: Functions to extract, transform and load data on PhD and their
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.0
RoxygenNote: 7.2.1
Imports:
DBI,
dbplyr,
Expand Down
3 changes: 3 additions & 0 deletions R/get_proquest.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ get_proquest <- function(conn, from, start_year = 1985, end_year = 2005, ...) {
"
us_universities <- dplyr::tbl(conn, dbplyr::sql(query_keep_us))

special_degrees <- c("Psy.D.", "Ed.D.", "D.Ed.") # relevant for psyschology

graduates <- dplyr::tbl(conn, "pq_authors") %>%
dplyr::filter(!(.data$degree_level %in% special_degrees)) %>%
dplyr::inner_join(us_universities, by = "university_id") %>%
dplyr::filter(.data$degree_year >= start_year
& .data$degree_year <= end_year)
Expand Down
12 changes: 6 additions & 6 deletions R/tools/setup_db_tests.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ capture_mockdb(production_db = db_file,
limit = 1,
lazy = FALSE)
)
files <- c("SELECT-db1387", "SELECT-1aa0ce")
files <- c("SELECT-db1387", "SELECT-1aa0ce", "SELECT-1aa0ce")
purrr::map(files,
.f = ~copy_fixture(
origin = mock_origin,
Expand Down Expand Up @@ -88,12 +88,13 @@ capture_mockdb(production_db = db_file,
)

# Note: some of these here are now deleted and do not exist anymore.. need to clean up!
files <- c("SELECT-6db156",
"SELECT-f49f96",
files <- c("SELECT_-64c4e4",
"SELECT-276cf8",
"SELECT-6db156",
"SELECT-7c7feb",
"SELECT-dfa715",
"SELECT_-ad0113")
"SELECT-f49f96"
)

purrr::map(files,
.f = ~copy_fixture(
Expand All @@ -110,8 +111,7 @@ capture_mockdb(production_db = db_file,
)

# Note: some of these here are now deleted and do not exist anymore.. need to clean up!
files <- c("SELECT-124fb3", "SELECT_-a24ff2")

files <- c("SELECT-124fb3", "SELECT_-052c29")
purrr::map(files,
.f = ~copy_fixture(
origin = mock_origin,
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ library(magutils)
db_file <- db_example("AcademicGraph.sqlite")
conn <- connect_to_db(db_file)
#> The database connection is:
#> src: sqlite 3.38.5 [/tmp/RtmpOOS3Cx/temp_libpath3eff04106586a/magutils/extdata/AcademicGraph.sqlite]
#> src: sqlite 3.39.3 [/tmp/RtmpfnS8S0/temp_libpath1e5445e211e0e/magutils/extdata/AcademicGraph.sqlite]
#> tbls: author_coauthor, author_output, AuthorAffiliation, current_links,
#> current_links_advisors, FieldsOfStudy, FirstNamesGender, pq_advisors,
#> pq_authors, pq_fields_mag, pq_unis
Expand Down
2 changes: 1 addition & 1 deletion data-raw/DATASET.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ purrr::map(idx_cla,
## 2. proquest authors / advisors

qry <- paste0("
SELECT goid, firstname, degree_year, university_id
SELECT goid, firstname, degree_year, degree_level, university_id
FROM pq_authors
WHERE goid IN (",
paste(pq_ids, collapse = ", "), ")"
Expand Down
Binary file modified inst/extdata/AcademicGraph.sqlite
Binary file not shown.
1 change: 0 additions & 1 deletion magutils.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ LineEndingConversion: Posix

BuildType: Package
PackageUseDevtools: Yes
PackageCleanBeforeInstall: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace
190 changes: 128 additions & 62 deletions tests/testthat/mock_db/SELECT-1aa0ce.R

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions tests/testthat/mock_db/SELECT_-052c29.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
structure(list(goid = c(303763395L, 303483090L, 303690188L),
position = c(0L, 0L, 0L), relationship_id = c("303763395_0",
"303483090_0", "303690188_0"), gender = c("Male", "Male",
"Male")), class = "data.frame", row.names = c(NA, -3L))
File renamed without changes.
4 changes: 0 additions & 4 deletions tests/testthat/mock_db/SELECT_-a24ff2.R

This file was deleted.

2 changes: 1 addition & 1 deletion tests/testthat/test-example.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

test_that("db_example() finds right file", {
expect_error(db_example("randomfile"),
regexp = "no file found|No file found")
regexp = "no file found|No file found|Can't find package file")
# R CMD check gives "no file found", test() gives "No file found"
expect_match(db_example("AcademicGraph.sqlite"), "AcademicGraph")
})

0 comments on commit 38616c7

Please sign in to comment.