Automatically name saved files relative to outfile basename
At present, the use of configuration-activated outputs (like log_file
and unknown_vars_file
) are problematic because the filenames are fixed. In typical use, no one ever executes funpack
once and then is done. Rather, you run iteratively, often wanting to save a succession of outputs, but then you have to remember to rename the suite of outputs that came from the configuration file.
It would be great if funpack
named output like PALM output files, i.e. uses the basename of the output as the basename for all output.
I don't know the best way to action this.
One idea is to change all of the output flags to make them take no arguments. As such, the file
in these options...
-
log_file
,unknown_vars_file
,non_numeric_file
,icd10_map_file
,description_file
,summary_file
... could go, and be replaced by the action that is taking place
-
save_log
,save_unknown_vars
,save_non_numeric
,save_icd10_map
,save_description
,save_summary
Which, to me, is better: when I first saw the --icd10_map_file
option, I assumed it was specifying an input file. Of course this screws up the short options convention of s
standing for skip; so maybe it would be better as
-
write_log
,write_unknown_vars
,write_non_numeric
,write_icd10_map
,write_description
,write_summary
Alternatively, support a format string, so that you could use an option like
log_file %s.txt
... but frankly the first approach seems better.
Anyway...
The end result is that by issuing a command like
funpack --save_log --save_unknown_vars --save_non_numeric \
--save_icd10_map --save_description --save_summary \
outfile.tsv infile.tsv
you'd then get a suite of files like:
outfile.tsv
outfile_log.txt
outfile_unknowns.tsv
outfile_non_numerics.tsv
outfile_icd10_codes.tsv
outfile_descriptions.tsv
outfile_summary.tsv
which is much easier to handle when you then make a small change and then create outfile2, etc.