The script has three main functionalities with regard to a number of target packs: (a) barplot the current number of downloads, (b) add the number of current downloads to a dated tracker file, and (c) plot the information in tracker files.
Opts
user_profile(stoics/options/pack_dnloads.pl)
to provide
extra options (see options_append/4)Modes
% Plot the current number of downloads for packs: bims, prosqlite and real ?- [pack('b_real/scripts/pack_dnloads')]. ?- pack_dnloads([pack(bims),pack(prosqlite),pack(real)]). % produces file: 21.09.01-pack_downloads.pdf % The line below is equivalent to the call above, but ran from linux command line via pack(upsh) > upsh pack_dnloads pack=bims pack=prosqlite pack=real % You can put your packs of interest (and other options) to file user_profile(stoics/options/pack_dnloads.pl) % - see options_append/4 % eg file: pack(bims). pack(prosqlite). pack(real). % then the first example can be reduced to: ?- pack_dnloads([]). % The following ignores any info in user_profile(stoics/options/pack_dnloads.pl) ?- pack_dnloads([pack(bims),pack(prosqlite),pack(stoics_lib),append_profile(false)]).
Update mode
?- pack_dnloads(mode(update)). % Using tracker file: '/home/nicos/.local/share/swi-prolog/stoics/pack_dnloads/pack_dnloads_tracker.csv' % Frequencies: [b_real-35,bims-63,bio_analytics-17,bio_db-77,bio_db_repo-48,by_unix-69,chess_db-34,db_facts-192,debug_call-49,disp_bn-2,gbn-3,lib-33,mlu-61,mtx-41,options-86,os_lib-78,pack_errors-80,pepl-25,pfd_meta-11,prosqlite-655,pub_graph-12,pubmed-35,r_session-16,real-527,spuds-32,stoics_lib-69,svg-3,upsh-21,wgraph-64] true. ?- pack_dnloads(mode(update)). % Using tracker file: '/home/nicos/.local/share/swi-prolog/stoics/pack_dnloads/pack_dnloads_tracker.csv' % Frequencies: [b_real-35,bims-63,bio_analytics-17,bio_db-77,bio_db_repo-48,by_unix-69,chess_db-34,db_facts-192,debug_call-49,disp_bn-2,gbn-3,lib-33,mlu-61,mtx-41,options-86,os_lib-78,pack_errors-80,pepl-25,pfd_meta-11,prosqlite-655,pub_graph-12,pubmed-35,r_session-16,real-527,spuds-32,stoics_lib-69,svg-3,upsh-21,wgraph-64] % Current date existed: 21.09.01, so replacing it. true. > cat /home/nicos/.local/share/swi-prolog/stoics/pack_dnloads/pack_dnloads_tracker.csv ,b_real,bims,bio_analytics,bio_db,bio_db_repo,by_unix,chess_db,db_facts,debug_call,disp_bn,gbn,lib,mlu,mtx,options,os_lib,pack_errors,pepl,pfd_meta,prosqlite,pub_graph,pubmed,r_session,real,spuds,stoics_lib,svg,upsh,wgraph 21.09.01,35,63,17,77,48,69,34,192,49,2,3,33,61,41,86,78,80,25,11,655,12,35,16,527,32,69,3,21,64
You can keep a number of tracker files
> upsh pack_dnloads.pl mode=update tracker=user_app_data=stoics/pack_dnloads/pack_dnloads_daily.csv
These can be kept updated via cron jobs. An example bash script can be found at b_real/scripts/pack_dnloads/pack_dnloads.sh
Finally, tracked mode produces a plot (on screen and saved on file), from a tracker file. Assuming your tracker file has more than one tracking line, eg:
> cat .local/share/swi-prolog/stoics/pack_dnloads/pack_dnloads_tracker.csv date,b_real,bims,bio_analytics,bio_db,bio_db_repo,by_unix,chess_db,db_facts,debug_call,disp_bn,gbn,lib,mlu,mtx,options,os_lib,pack_errors,pepl,pfd_meta,prosqlite,pub_graph,pubmed,r_session,real,spuds,stoics_lib,svg,upsh,wgraph ,b_real,bims,bio_analytics,bio_db,bio_db_repo,by_unix,chess_db,db_facts,debug_call,disp_bn,gbn,lib,mlu,mtx,options,os_lib,pack_errors,pepl,pfd_meta,prosqlite,pub_graph,pubmed,r_session,real,spuds,stoics_lib,svg,upsh,wgraph 21.09.01,35,63,17,77,48,69,34,192,49,2,3,33,61,41,86,78,80,25,11,655,12,35,16,527,32,69,3,21,64 21.09.02,37,64,20,87,50,70,44,210,69,8,6,43,69,43,96,92,83,28,18,755,15,45,19,547,38,77,8,27,69 ?- pack_dnloads(mode(tracked)). ?- pack_dnloads([mode(tracked),pack(bims),pack(prosqlite),pack(real),append_profile(false)]).
To plot only specific packs from a tracker file, while ignoring any packs defined in profile file (user_profile(stoics/options/pack_dnloads.pl)
), use:
?- pack_dnloads( [mode(tracked),pack(bims),pack(prosqlite),pack(real),append_profile(false),plot_all(false)] ).
Dependencies, stoics packs:
pack(lib)
pack(mlu)
pack(mtx)
pack(real)
pack(options)
pack(debug_call)
r_lib(ggplot2)
You only need to install pack(b_real)
, with
?- pack_install(b_real).
This will also install pack(lib)
which is a registered dependency.
The remaining packs will be installed interactively on first loading of library(b_real).