-
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.
Accuracy analysis access status for 200 DOIs (#18)
- Loading branch information
Showing
2 changed files
with
276 additions
and
277 deletions.
There are no files selected for viewing
153 changes: 76 additions & 77 deletions
153
evaluate_library_access_from_output_tsv/facilitate_going_through_dois_manually.R
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,94 +1,93 @@ | ||
# Settings --------------------------------------------------------------------- | ||
|
||
manual_tsv_location <- file.path( | ||
'evaluate_library_access_from_output_tsv', | ||
'manual-doi-checks.tsv' | ||
) | ||
|
||
# Open the tsv ----------------------------------------------------------------- | ||
|
||
dataset_to_go_through <- readr::read_tsv( | ||
manual_tsv_location, | ||
na = '' | ||
) | ||
# View(dataset_to_go_through) | ||
|
||
# Facilitate going through the rows that haven't been filled in ---------------- | ||
|
||
while (TRUE) { | ||
user_location_input <- readline(paste0( | ||
'Are you on the university campus network', | ||
'(y for on-campus, n for off-campus)? [y/n]' | ||
)) | ||
facilitate_going_through_dois <- function( | ||
manual_tsv_location = file.path( | ||
'evaluate_library_access_from_output_tsv', | ||
'manual-doi-checks.tsv' | ||
)){ | ||
# Open the tsv ----------------------------------------------------------------- | ||
|
||
if ( | ||
tolower(user_location_input) == 'y' || | ||
tolower(user_location_input) == 'n' | ||
) { | ||
if (tolower(user_location_input) == 'y') { | ||
column_for_data_entry <- 'full_text_indicator_manual_inside_campus' | ||
column_for_date <- 'date_of_manual_full_text_check_inside_campus' | ||
} else { | ||
column_for_data_entry <- 'full_text_indicator_manual_outside_campus' | ||
column_for_date <- 'date_of_manual_full_text_check_outside_campus' | ||
} | ||
|
||
break # Break out of the loop, and move on. | ||
} else { | ||
message('Please enter y or n. Asking again...') | ||
} | ||
} | ||
|
||
for (row_number in which( | ||
is.na(dataset_to_go_through[, column_for_data_entry]) | ||
)) { | ||
doi_for_row <- dataset_to_go_through[row_number, 'doi'] | ||
|
||
url_to_visit <- paste0( | ||
'https://doi.org/', | ||
doi_for_row | ||
dataset_to_go_through <- readr::read_tsv( | ||
manual_tsv_location, | ||
na = '' | ||
) | ||
# View(dataset_to_go_through) | ||
|
||
message('Opening URL "', url_to_visit, '"...') | ||
|
||
utils::browseURL(url_to_visit) | ||
# Facilitate going through the rows that haven't been filled in ---------------- | ||
|
||
while (TRUE) { | ||
user_full_text_input <- readline( | ||
'Do we have full-text access to this DOI? [y/n/invalid] | ||
("invalid" = invalid DOI)' | ||
) | ||
user_location_input <- readline(paste0( | ||
'Are you on the university campus network', | ||
'(y for on-campus, n for off-campus)? [y/n]' | ||
)) | ||
|
||
if ( | ||
tolower(user_full_text_input) == 'y' || | ||
tolower(user_full_text_input) == 'n' || | ||
tolower(user_full_text_input) == 'invalid' | ||
tolower(user_location_input) == 'y' || | ||
tolower(user_location_input) == 'n' | ||
) { | ||
dataset_to_go_through[ | ||
row_number, | ||
column_for_date | ||
] <- as.character(Sys.Date()) | ||
|
||
if (tolower(user_full_text_input) == 'y') { | ||
dataset_to_go_through[row_number, column_for_data_entry] <- 1 | ||
} else if (tolower(user_full_text_input) == 'n') { | ||
dataset_to_go_through[row_number, column_for_data_entry] <- 0 | ||
if (tolower(user_location_input) == 'y') { | ||
column_for_data_entry <- 'full_text_indicator_manual_inside_campus' | ||
column_for_date <- 'date_of_manual_full_text_check_inside_campus' | ||
} else { | ||
dataset_to_go_through[row_number, column_for_data_entry] <- 'invalid' | ||
column_for_data_entry <- 'full_text_indicator_manual_outside_campus' | ||
column_for_date <- 'date_of_manual_full_text_check_outside_campus' | ||
} | ||
|
||
break # Break out of the loop, and move on. | ||
} else { | ||
message('Please enter y, n, or invalid. Asking again...') | ||
message('Please enter y or n. Asking again...') | ||
} | ||
} | ||
|
||
# Save the changes to the tsv: | ||
write.table( | ||
dataset_to_go_through, | ||
file = manual_tsv_location, | ||
sep = '\t', | ||
na = '', | ||
row.names = FALSE | ||
) | ||
for (row_number in which( | ||
is.na(dataset_to_go_through[, column_for_data_entry]) | ||
)) { | ||
doi_for_row <- dataset_to_go_through[row_number, 'doi'] | ||
|
||
url_to_visit <- paste0( | ||
'https://doi.org/', | ||
doi_for_row | ||
) | ||
|
||
message('Opening URL "', url_to_visit, '"...') | ||
|
||
utils::browseURL(url_to_visit) | ||
|
||
while (TRUE) { | ||
user_full_text_input <- readline( | ||
'Do we have full-text access to this DOI? [y/n/invalid] | ||
("invalid" = invalid DOI)' | ||
) | ||
|
||
if ( | ||
tolower(user_full_text_input) == 'y' || | ||
tolower(user_full_text_input) == 'n' || | ||
tolower(user_full_text_input) == 'invalid' | ||
) { | ||
dataset_to_go_through[ | ||
row_number, | ||
column_for_date | ||
] <- as.character(Sys.Date()) | ||
|
||
if (tolower(user_full_text_input) == 'y') { | ||
dataset_to_go_through[row_number, column_for_data_entry] <- 1 | ||
} else if (tolower(user_full_text_input) == 'n') { | ||
dataset_to_go_through[row_number, column_for_data_entry] <- 0 | ||
} else { | ||
dataset_to_go_through[row_number, column_for_data_entry] <- 'invalid' | ||
} | ||
|
||
break # Break out of the loop, and move on. | ||
} else { | ||
message('Please enter y, n, or invalid. Asking again...') | ||
} | ||
} | ||
|
||
# Save the changes to the tsv: | ||
readr::write_tsv( | ||
dataset_to_go_through, | ||
manual_tsv_location, | ||
na = '' | ||
) | ||
} | ||
} | ||
|
||
facilitate_going_through_dois() |
Oops, something went wrong.