-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ Makefile: variable summary files (for lab.*.tsv)
- Loading branch information
Showing
1 changed file
with
32 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,46 @@ | ||
.SUFFIXES: | ||
.PHONY: .ALWAYS all | ||
.ALWAYS: | ||
.PRECIOUS: lab.info.tsv heroku.info.tsv lab.raw.tsv | ||
.ALWAYS: /Volumes/Hera/Projects/Habit/mr/habit/txt/all_habit.json | ||
|
||
all: summary.csv data_all.tsv | ||
all: lab.summary.csv # prev data_all.tsv, no longer need to update heroku.summary.csv | ||
|
||
#mkifdiff from lncdtools | ||
raw.json: .ALWAYS | ||
psql `./dburl` -A -qtc \ | ||
"select json_agg(json_build_object('id',worker_id,'task',task_name,'created_at', created_at, 'finished_at',finished_at, 'ver', version,'timepoint',timepoint, 'run_number',run_number,'json', json::json)) from run where finished_at is not null;" | \ | ||
mkifdiff $@; | ||
heroku.raw.json: .ALWAYS | ||
echo "heroku no longer used (20221229)" | ||
#psql `./dburl` -A -qtc \ | ||
# "select json_agg(json_build_object('id',worker_id,'task',task_name,'created_at', created_at, 'finished_at',finished_at, 'ver', version,'timepoint',timepoint, 'run_number',run_number,'json', json::json)) from run where finished_at is not null;" | \ | ||
# mkifdiff $@; | ||
|
||
raw.tsv: raw.json | ||
/Volumes/Hera/Projects/Habit/mr/habit/txt/all_habit.json: | ||
make -C /Volumes/Hera/Projects/Habit/mr/habit/ txt/all_habit.json | ||
|
||
lab.raw.json: /Volumes/Hera/Projects/Habit/mr/habit/txt/all_habit.json | ||
cp $< $@ | ||
|
||
|
||
# raw data for R to read: heroku.raw.tsv and lab.raw.tsv | ||
%.raw.tsv: %.raw.json | ||
./dbjsontotsv.jq < $< > $@ | ||
|
||
survey.tsv: raw.json | ||
# separately, get info "survey" and age data | ||
%.info.tsv: %.raw.json | ||
./extra_info.jq < $< > $@ | ||
|
||
# not needed when using .info.tsv and raw.tsv | ||
bea_res_concat.tsv: $(wildcard /Volumes/L/bea_res/Data/Tasks/Habit/MR/1*_2*/*tsv) | ||
cat_skiphead $? > $@ | ||
# tsv from orig json via /Volumes/Hera/Projects/Habit/mr/habit/Makefile | ||
cat_skiphead $^ > $@ | ||
|
||
# previously generated by read.R's fix_and_save | ||
# data_id-hidden.tsv: heroku.data.tsv | ||
|
||
data_id-hidden.tsv: data.tsv | ||
data.tsv: raw.tsv | ||
Rscript -e "source('./read.R'); fix_and_save()" | ||
# data_heroku.tsv, data_lab.tsv | ||
%.data.tsv: %.raw.tsv | ||
Rscript -e "source('./read.R'); fix_and_save(infile='$<',outname='$@')" | ||
|
||
summary.csv: data.tsv survey.tsv | ||
./summary.R | ||
%.summary.csv: %.info.tsv %.data.tsv | ||
./summary.R $^ $@ # order is important: info data output | ||
|
||
data_all.tsv: data.tsv bea_res_concat.tsv | ||
data_all.tsv: heroku.data.tsv lab.data.tsv #bea_res_concat.tsv | ||
cat_skiphead $^ > $@ |