Export reports#91
Conversation
Adding Export_reports to usage guidelines in README
Update valid_data dictionary to include exp_reports
Added export_reports() method
|
Hi @mcarmack, thanks for this Pull-Request! I'm trying to stay away from the computer this holiday break :) I'll be able to give more feedback next week. |
|
Sorry for the delay on this! Overall this looks great, though to be honest I haven't truly studied PyCap in a long time :/ With respect to your specific questions...
Have you been able to run |
|
hi @mcarmack have you been able to look at this anymore? |
|
@sburns - hello and thank you so much for the comments! This all makes sense now. I ended up going right to the redcap API to do export_reports (without the pycap wrapper). Export reports does return a list of records, as if you had done export_records with all the record ids in that report Appreciate all your thoughts! |
Accidentally deleted these when resolving the merge conflicts
|
@mcarmack Hi, do you mind to share how you export reports via API and getting the project info? |
|
Exporting project info: https://pycap.readthedocs.io/en/latest/api.html#redcap.project.Project.export_project_info import redcap
url = "your redcap api url"
token "your project token"
project = redcap.Project(url, token)
project.export_project_info()Once this PR is merged, you'll be able to export reports like so: project.export_reports(report_id="your report id") |
|
@pwildenhain I have attached the screenshoot below, there isn't any export_project_info() in the projects.py file I downloaded |
|
Weird, because it's in the current |
|
@pwildenhain I am sorry but how can I do the re-cloning? and call it? As I am using google collab and not sure how will that works |
|
Ah, I'm not sure how dependency management works with google collab 🤷♂️ |

Hello-
This is my first pull request to this project- I hugely appreciate any feedback or improvements you may have!
I added a method to wrap the redcap API "export reports" method.
Three things I am looking to learn/incorporate into my code before this pull request is considered:
I saw in other methods there is some handling of the format "df" - I assume dataframe? As far as I can see in the RedCap API documentation, the formats data is returned in will only be csv, json, xml, or odm (cdisc odm xml, odm version 1.3.1). So is the handling of the format 'df' unnecessary within this method? I see it is used in 'export_records' pycap method (which has the same format/return format options as export reports, per RedCap API documentation), so I included it in my export_reports method. Please advise.
It is unclear to me from the RedCap API documentation exactly what is returned from the API call. Apparently it is, "Data from the project in the format and type specified ordered by the record (primary key of project) and then by event id". This leads me to believe it will be a list of records from a single report. If so, I'm not sure why the method is called "export reports" instead of "export report". Also, will all fields be returned, or just those of the report?
Testing! I do not understand how to test this method without having it be part of the version of pycap I am using. Also, I would like to write some tests for the test file, but I would also appreciate guidance on best practice for that.
Thank you again for your help!