Skip to content

Add dateRangeBegin and dateRangeEnd parameters#124

Merged
pwildenhain merged 4 commits into
redcap-tools:masterfrom
chgreer:master
Sep 15, 2020
Merged

Add dateRangeBegin and dateRangeEnd parameters#124
pwildenhain merged 4 commits into
redcap-tools:masterfrom
chgreer:master

Conversation

@chgreer
Copy link
Copy Markdown
Contributor

@chgreer chgreer commented Aug 19, 2020

Im relatively new to REDCap and have found this library very helpful. It looks as if work was discontinued on the project before the date range filtering was added to the Export Records call. My use case requires using this, so I went ahead and forked and made the simple change.

I just followed the template in the code and added two new keys to the data payload. I use the dateutil.parser.parse method to make it so the input values for the dates can be a little flexible. This meant updating requirements.txt as well.

I didn't see any appropriate tests to modify.

I'm opening this issue here, and will attach a pull request. This is my first github pull request, so feedback welcome.

Fixes #123

Comment thread redcap/project.py Outdated
export.
filter_logic : string
specify the filterLogic to be sent to the API.
date_begin : string
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than parsing a string to a datetime object (requiring a dependency on python-dateutil and then reformatting it out to a string, these two parameters can be datetimes. So it's on the caller to make datetime objects, but I don't think that's too much to ask.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Easy enough to change. Thanks for your reply.

@chgreer
Copy link
Copy Markdown
Contributor Author

chgreer commented Aug 20, 2020

One thing I don't have access to is older versions of REDCap on which to test this. Right now, both instances I have are 10.0.11. I don't know what happens if a payload with dateRangeBegin and dateRangeEnd are sent to a version of the API that doesn't support these parameters.

The payload won't include the parameters if the user doesn't specify them when calling the method; so hopefully that's within the bounds of not too much to ask.

Copy link
Copy Markdown
Collaborator

@pwildenhain pwildenhain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this in 🥇 😁

@pwildenhain pwildenhain changed the title dateRangeBegin and dateRangeEnd parameters for Export Records call not supported #123 Add dateRangeBegin and dateRangeEnd parameters Sep 15, 2020
@pwildenhain pwildenhain merged commit ece195e into redcap-tools:master Sep 15, 2020
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.

dateRangeBegin and dateRangeEnd parameters for Export Records call not supported

3 participants