Skip to content

Commit

Permalink
further changes to formatting of file names from CTIS
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralf Herold committed May 3, 2024
1 parent bde4251 commit ef9936b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ctrdata 1.17.2.9000

## Possibly breaking change
- File names for documents downloaded from `CTIS` now start with the document type (e.g., "SbjctInfaICF - ..." as abbreviation of "Subject information and informed consent form (for publication)" and instead of the previous "parts2auth_...")
- File names for documents downloaded from `CTIS` now include the document type and use different separators (e.g., "parts2auth - SbjctInfaICF - ..." as abbreviation of "Subject information and informed consent form (for publication)", was previously "parts2auth_...")

## Improvements
- Add retrieval of historic versions of trial records from CTGOV2 (for CTIS, they are automatically retrieved)
Expand Down
15 changes: 10 additions & 5 deletions R/ctrLoadQueryIntoDbCtis.R
Original file line number Diff line number Diff line change
Expand Up @@ -682,9 +682,10 @@ ctrLoadQueryIntoDbCtis <- function(
rl <- unlist(sapply(rl$lengths, function(i) c(TRUE, rep(FALSE, i - 1L))))
dlFiles <- dlFiles[rl, , drop = FALSE]

# add destination file name
dlFiles$filename <- paste0(
# type in CTIS dlFiles$part
# calculate prefix for document type
dlFiles$prefix <- paste0(
# type in CTIS
dlFiles$part, " - ",
# type of document
abbreviate(
tools::toTitleCase(
Expand All @@ -693,11 +694,15 @@ ctrLoadQueryIntoDbCtis <- function(
c(" - Final", ": ", " (SmPC)", "(EU) ",
" (for publication)", ":", "\"", "/", "."),
"", vectorize_all = FALSE)),
minlength = 12L, named = FALSE), " - ",
minlength = 12L, named = FALSE))

# add destination file name
dlFiles$filename <- paste0(
dlFiles$prefix, " - ",
# robustly sanitised file name
gsub("[^[:alnum:] ._-]", "", dlFiles$title),
".", dlFiles$fileTypeLabel)

#### api_11: urls ####

# calculate url
Expand Down
2 changes: 1 addition & 1 deletion docs/news/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/search.json

Large diffs are not rendered by default.

0 comments on commit ef9936b

Please sign in to comment.