-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from jubilee2/report
Report
- Loading branch information
Showing
3 changed files
with
19 additions
and
10 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,3 +1,4 @@ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ | ||
^LICENSE\.md$ | ||
.github |
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 |
---|---|---|
|
@@ -5,7 +5,7 @@ Version: 0.4.0 | |
Author: Jubilee | ||
Maintainer: Jubilee<[email protected]> | ||
Description: A collection of reusable functions to streamline and enhance the functionality of REDCap projects. This package includes functions for parsing logging strings, converting data types, and more. | ||
License: MIT | ||
License: MIT + file LICENSE | ||
Encoding: UTF-8 | ||
LazyData: true | ||
Suggests: | ||
|
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,13 +1,21 @@ | ||
queryLogSummary <- function(logs) { | ||
# Function implementation | ||
o <- logDetailsParseDQ(logs$details) | ||
logs$Action <- sapply(o, function(x) if (is.null(x$Action)) NA else x$Action) | ||
logs$Record <- sapply(o, function(x) if (is.null(x$Record)) NA else x$Record) | ||
logs$Event <- sapply(o, function(x) if (is.null(x$Event)) NA else x$Event) | ||
logs$Field <- sapply(o, function(x) if (is.null(x$Field)) NA else x$Field) | ||
logs$Comment <- sapply(o, function(x) if (is.null(x$Comment)) NA else x$Comment) | ||
logs$`Data Quality Rule` <- sapply(o, function(x) if (is.null(x$`Data Quality Rule`)) NA else x$`Data Quality Rule`) | ||
# Parse the log details for data quality | ||
parsedDetails <- logDetailsParseDQ(logs$details) | ||
|
||
selector <- sapply(o, length) > 0 | ||
# Function to extract a specific field from a list of details | ||
# details: list of parsed log details | ||
# field: the field to extract from each detail | ||
applyExtractField <- function(details, field) { | ||
vapply(details, function(x) ifelse(is.null(x[[field]]), NA_character_, x[[field]]), FUN.VALUE = character(1)) | ||
} | ||
|
||
logs$Action <- applyExtractField(parsedDetails, "Action") | ||
logs$Record <- applyExtractField(parsedDetails, "Record") | ||
logs$Event <- applyExtractField(parsedDetails, "Event") | ||
logs$Field <- applyExtractField(parsedDetails, "Field") | ||
logs$Comment <- applyExtractField(parsedDetails, "Comment") | ||
logs$`Data Quality Rule` <- applyExtractField(parsedDetails, "Data Quality Rule") | ||
|
||
selector <- sapply(parsedDetails, length) > 0 | ||
logs[selector,c("timestamp", "username", "Action","Record","Event","Field","Data Quality Rule","Comment")] | ||
} |