Skip to content

Refactor (deduplicate code) #12

@mslw

Description

@mslw

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions