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

Add support for exportFieldNames call #125

Merged

Conversation

chgreer
Copy link
Contributor

@chgreer chgreer commented Sep 16, 2020

Sometime after this project stopped updating, REDCap added a call to export a list of field names via the API. This pull request adds this into PyCap.

In particular, the API has different behavior around *_form_completed fields. These fields are not present in the metadata export used by PyCap to determine the field names for a project. At the same time, the export_field_names fields don't include some field names in the metadata. As such, I simply implement this method and let the user decide what they want to do with it.

import redcap

project = redcap.Project(<URL>, <TOKENHERE>)
project.export_field_names()

Returns a list of dicts like:

[{'original_field_name': 'participant_id',
  'choice_value': '',
  'export_field_name': 'participant_id'},
 {'original_field_name': 'survey_respondent',
  'choice_value': '',
  'export_field_name': 'survey_respondent'}]

Copy link
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! Just a few small suggestions

redcap/project.py Outdated Show resolved Hide resolved
Co-authored-by: pwildenhain <35195136+pwildenhain@users.noreply.github.com>
@chgreer
Copy link
Contributor Author

chgreer commented Sep 17, 2020

Ah. I just clicked 'accept suggestion'. I've never used this feature of github. So hopefully that worked. Let me know if it didn't take.

@pwildenhain pwildenhain self-requested a review September 18, 2020 14:01
@pwildenhain pwildenhain merged commit 7303cc0 into redcap-tools:master Sep 18, 2020
This pull request was closed.
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.

2 participants