Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function to export logfile #383

Merged
merged 14 commits into from
Aug 12, 2022
Merged

Function to export logfile #383

merged 14 commits into from
Aug 12, 2022

Conversation

joundso
Copy link
Contributor

@joundso joundso commented Feb 10, 2022

Maybe fix #320

@wibeasley
Copy link
Member

@joundso, thanks for adding this. Our server update has hit some snags and we're still not to the version that supports that API call. Once that happens, we'll need to add tests, and then I'll pull it into the main branch.

@wibeasley
Copy link
Member

We've upgraded the server and I'm trying this function. Thanks again for writing it in February.

I tried a few projects and they crashed because the returned size was too big. It worked fine once I limited the size (eg, by date). I'm guessing this is typical for most serious projects --the kind of projects where people care enough to monitor the logs. Are you willing to implement some of the parameters that limit the returned set/ I'm thinking the most important are logtype, beginTime, and endTime.

Ideally REDCapR catches the error and suggests something useful (for example, I wrote this yesterday for large records.) The types of errors fell into these two buckets: The first gives a 504 code. The second was something else.

Also, will you please change the function name from redcap_export_logging() to redcap_log_read() (and the file to "redcap-log-read.R)? I'm trying to have the first term match the API's "content" parameter. And all the other functions are read/write, not import/export.

I'm happy to change it myself, but I kinda like how the whole file in GitHub shows who added the lines. After I renamed the file of your last function (redcap_dag_read()), it is less obvious that you'd done most of the work.

> uri     <- "https://bbmc.ouhsc.edu/redcap/api/"
> token   <- "9A81268476645C4E5F03428B8AC3AA7B"
> REDCapR::redcap_export_logging(redcap_uri=uri, token=token)$data
The REDCapR read/export operation was not successful.  The error message was:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>504 Gateway Timeout</title>
</head><body>
<h1>Gateway Timeout</h1>
<p>The gateway did not receive a timely response
from the upstream server or application.</p>
</body></html>
> uri     <- "https://bbmc.ouhsc.edu/redcap/api/"
> token   <- "BB0D01A2FC524993E42D6104236B1715"
> REDCapR::redcap_export_logging(redcap_uri=uri, token=token)$data
The REDCapR read/export operation was not successful.  The error message was:
				<div class="red" style="margin:20px 0px;max-width:700px;">
					<b>REDCap crashed due to an unexpected PHP fatal error!</b><br><br>
					<b>Error message:</b> Allowed memory size of 2147483648 bytes exhausted (tried to allocate 142066968 bytes)<br>
					<b>File:</b> redcap_v12.5.2/Config/init_functions.php<br>
					<b>Line:</b> 4051<br>
				</div>
				ERROR: REDCap ran out of server memory. The request cannot be processed. Please try importing/exporting a smaller amount of data.
data frame with 0 columns and 0 rows

image

image

@wibeasley wibeasley merged commit 57b46d6 into OuhscBbmc:main Aug 12, 2022
@wibeasley
Copy link
Member

@joundso, I made those changes I suggested above. Thanks for starting the function and doing the hard work!

wibeasley added a commit that referenced this pull request Aug 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Export Logging function
2 participants