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

Refactor (deduplicate code) #12

Open
mslw opened this issue Feb 6, 2023 · 0 comments
Open

Refactor (deduplicate code) #12

mslw opened this issue Feb 6, 2023 · 0 comments

Comments

@mslw
Copy link
Collaborator

mslw commented Feb 6, 2023

Currently there are four commands (export-redcap-form, export-redcap-project-xml, export-redcap-report, redcap-query).

  • they all share basically the same structure, that is: a) establish paths & credentials, b) execute API query, c) write the file and datalad save. Of those, only b) is different, but a&c take more space
  • they share most of their parameters (url, outfile, credential, ...) but also have a few context-dependent ones

I think from the interface point of view, it is good to keep the command separate, as they target different uses.

I've been thinking of:

  • moving parameters to a separate file and importing them -- I already do this for save_message_opt and nosave_opt from datalad.interface.common_opts. But the downside is that when looking at the command code, there is less information available immediately (parameter docstrings are also kind of documentation).
  • packaging a) and c) from the description above into utils - but there are many values to be passed around, and I didn't find a neat way to do it
  • doing it the other way round and creating one big class from which other would derive - but again I am not sure how to do it nicely

I would appreciate suggestions from someone more experienced. Looking at any of the commands should be sufficient to get the idea.

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

No branches or pull requests

1 participant