Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion redcap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
__author__ = 'Scott Burns <scott.s.burns@gmail.com>'
__license__ = 'MIT'
__copyright__ = '2014, Vanderbilt University'
__version__ = '1.1.1'
__version__ = '1.1.2'

"""
This module exposes the REDCap API through the Project class. Instantiate the
Expand Down
17 changes: 15 additions & 2 deletions redcap/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ def export_records(self, records=None, fields=None, forms=None,
events=None, raw_or_label='raw', event_name='label',
format='json', export_survey_fields=False,
export_data_access_groups=False, df_kwargs=None,
export_checkbox_labels=False, filter_logic=None):
export_checkbox_labels=False, filter_logic=None,
date_begin=None, date_end=None):
"""
Export data from the REDCap project.

Expand Down Expand Up @@ -319,6 +320,10 @@ def export_records(self, records=None, fields=None, forms=None,
export.
filter_logic : string
specify the filterLogic to be sent to the API.
date_begin : datetime
for the dateRangeStart filtering of the API
date_end : datetime
for the dateRangeEnd filtering snet to the API

Returns
-------
Expand All @@ -333,9 +338,11 @@ def export_records(self, records=None, fields=None, forms=None,
keys_to_add = (records, fields, forms, events,
raw_or_label, event_name, export_survey_fields,
export_data_access_groups, export_checkbox_labels)

str_keys = ('records', 'fields', 'forms', 'events', 'rawOrLabel',
'eventName', 'exportSurveyFields', 'exportDataAccessGroups',
'exportCheckboxLabel')

for key, data in zip(str_keys, keys_to_add):
if data:
if key in ('fields', 'records', 'forms', 'events'):
Expand All @@ -344,6 +351,12 @@ def export_records(self, records=None, fields=None, forms=None,
else:
pl[key] = data

if date_begin:
pl["dateRangeBegin"] = date_begin.strftime('%Y-%m-%d %H:%M:%S')

if date_end:
pl["dateRangeEnd"] = date_end.strftime('%Y-%m-%d %H:%M:%S')

if filter_logic:
pl["filterLogic"] = filter_logic
response, _ = self._call_api(pl, 'exp_record')
Expand Down Expand Up @@ -699,7 +712,7 @@ def export_survey_participant_list(self, instrument, event=None, format='json'):
if event:
pl['event'] = event
return self._call_api(pl, 'exp_survey_participant_list')

def generate_next_record_name(self):
pl = self.__basepl(content='generateNextRecordName')

Expand Down