Closed yjmantilla closed 2 years ago
Hi @yjmantilla, this looks really good!! The API presented covers so much of the use-case while also being straight-forward. I could also imagine the GUI might also have a reset or clear button, but that shouldn't need the API, so no issues there.
Could we separate out apply_rules into
Hi @yjmantilla and all, Very impressive analysis!
I don't have time to get into the bolts and bits of it right now, but I would suggest that you look into some popular APIs (that have multiple GUIs) for inspiration.
The first example that came to my mind is the SSHFS protocol, which has multiple GUIs (some of them are listed in the table here: https://supercomputing.swin.edu.au/docs/1-getting_started/file-transfer.html). This protocol is not for data conversion, but it does involve moving data, etc., which has some commonalities with what we're doing. These are the basic API commands of SSHFS (taken from the help of the sftp utility). I'm sure you would be able to find more info online:
bye Quit sftp
cd path Change remote directory to 'path'
chgrp grp path Change group of file 'path' to 'grp'
chmod mode path Change permissions of file 'path' to 'mode'
chown own path Change owner of file 'path' to 'own'
df [-hi] [path] Display statistics for current directory or
filesystem containing 'path'
exit Quit sftp
get [-afPpRr] remote [local] Download file
reget [-fPpRr] remote [local] Resume download file
reput [-fPpRr] [local] remote Resume upload file
help Display this help text
lcd path Change local directory to 'path'
lls [ls-options [path]] Display local directory listing
lmkdir path Create local directory
ln [-s] oldpath newpath Link remote file (-s for symlink)
lpwd Print local working directory
ls [-1afhlnrSt] [path] Display remote directory listing
lumask umask Set local umask to 'umask'
mkdir path Create remote directory
progress Toggle display of progress meter
put [-afPpRr] local [remote] Upload file
pwd Display remote working directory
quit Quit sftp
rename oldpath newpath Rename remote file
rm path Delete remote file
rmdir path Remove remote directory
symlink oldpath newpath Symlink remote file
version Show SFTP version
!command Execute 'command' in local shell
! Escape to local shell
? Synonym for help
@stebo85 @aswinnarayanan @civier @DavidjWhite33 @TomEmotion Do you have ideas for additional API we can learn from?
@aswinnarayanan
Could we separate out apply_rules into filespaths = get_files(input_dir) mappings = apply_rules(filepaths)
Yeap, I also thought about that but never came through that idea, so I agree with it.
@civier
I would suggest that you look into some popular APIs (that have multiple GUIs) for inspiration.
Yeap I agree. Most direct example is bidscoin so the correspondence of that API to us is basically:
bidscoin | sovabids |
---|---|
is_sourcefile(file: Path) -> str | equivalent to filtering by extension, we don’t have an api explicetly for this though |
get_attribute(dataformat: str, sourcefile: Path, attribute: str, options: dict) -> str | equivalent to the "preview" option of apply_rules_to_single_file |
bidsmapper_plugin(session: Path, bidsmap_new: dict, bidsmap_old: dict, template: dict, store: dict) -> None | equivalent to apply_rules (which applies the rules to each file involved and outputs the mappings for each) |
bidscoiner_plugin(session: Path, bidsmap: dict, bidsfolder: Path) -> None | equivalent to "convert" |
So a strong component component of the sovabids project is having a good API that serves possible third-party GUIs. Nevertheless I find myself struggling with how to best design such API. As of now, I just went along with what I had originally in mind at the proposal and what came to me as I coded.
The current main functions API (the ones more prone to be used by an end-user) are:
Convert Module
More detail here
Rules Module
More detail here
An approach from the "ideal"
To force me to think more on the API I imagined the "ideal GUI" for sovabids, and tried to think about the API it would require from sovabids for it to function. Here is what I got:
I would greatly appreciate help with this since I feel lost on how to do this. @stebo85 @aswinnarayanan @civier @DavidjWhite33 @TomEmotion
TODO: