2 # these metrics are how bogged down we are in to-do type items.
4 # logged historical file where we append our latest report.
5 REPORT_FILE="$HOME/cloud/stats/overload_history.txt"
7 # given a path, this will find how many items are under it, ignoring svn and git files, plus
8 # other patterns we happen to notice are not useful.
9 function calculate_count()
12 local count=$(find "$dir" -type f -exec echo \"{}\" ';' 2>/dev/null | grep -v "\.svn" | grep -v "\.git"| grep -v "\.basket" | grep -v "\.version" | grep -v "\.keep" | wc -l | tr -d ' ')
13 if [ -z "$count" ]; then echo 0; else echo "$count"; fi
16 # calculates the size in kilobytes of all the note files in a hierarchy.
17 # this is just a raw statistic for how much content all those notes make up. since
18 # we have not separated out all the to-dos in some files (most notably the metaverse
19 # backlogs and to-do lists), it's good to also know what kind of girth the notes have.
20 function calculate_weight()
23 local weight=$(find "$dir" -type f -exec echo \"{}\" ';' 2>/dev/null | grep -v "\.svn" | grep -v "\.git"| grep -v "\.basket" | grep -v "\.version" | grep -v "\.keep" | xargs ls -al | awk '{ print $5 }' | paste -sd+ | bc 2>/dev/null)
24 if [ -z "$weight" ]; then echo 0; else echo "$weight"; fi
27 # calculate_complexity gets a very simple metric of how many directory components are
28 # present at the target location and below.
29 function calculate_complexity()
32 local complexity=$(find "$dir" -type d | wc -l)
33 if [ -z "$complexity" ]; then echo 0; else echo "$complexity"; fi
36 # produces a report line in our format.
37 function format_report_line()
39 local count="$1"; shift
40 local weight="$1"; shift
41 weight=$((weight / 1024))
42 local complexity="$1"; shift
43 echo "$count\t${complexity}\t\t${weight}\t\t$*\n"
46 # two parameters are needed: the directory to sum up and the label to use for it in the report.
47 # this will calculate the count and weight for a hierarchy of notes, and then produce a
48 # line of reporting for those.
49 function analyze_hierarchy_and_report()
52 local label="$1"; shift
54 # initial values are all zero.
59 if [ -d "$dir" ]; then
60 count=$(calculate_count "$dir")
61 total_overload=$(($count + $total_overload))
62 weight=$(calculate_weight "$dir")
63 total_weight=$(($total_weight + $weight))
64 complexity=$(calculate_complexity "$dir")
65 total_complexity=$(($total_complexity + $complexity))
67 full_report+=$(format_report_line "$count" "$weight" "$complexity" "$label")
70 # scans through items in the notes folder that begin with a pattern.
71 # each of those is treated as an aggregatable portion of the report.
72 # first parameter is the title in the report, second and so on are
73 # a list of directory patterns to scan and aggregate.
74 function analyze_by_dir_patterns()
76 local title="$1"; shift
79 local hier_complexity=0
81 if [ -d "$folder" ]; then
82 temp_count=$(calculate_count $folder)
83 hier_count=$(($hier_count + $temp_count))
84 temp_weight=$(calculate_weight $folder)
85 hier_weight=$(($hier_weight + $temp_weight))
86 temp_complexity=$(calculate_complexity $folder)
87 hier_complexity=$(($hier_complexity + $temp_complexity))
90 total_overload=$(($hier_count + $total_overload))
91 total_weight=$(($total_weight + $hier_weight))
92 total_complexity=$(($total_complexity + $hier_complexity))
93 full_report+=$(format_report_line "$hier_count" "$hier_weight" "$hier_complexity" "$title")
98 # reset these before we add anything...
102 # start out the report with a header.
105 current information overload consists of:\n\
108 full_report+="count\tcomplexity\tweight (kb)\tcategory\n\
109 ================================================================\n\
112 #hmmm: don't fail if the hierarchy doesn't exist.
114 # high priority stuff would be called urgent.
115 analyze_hierarchy_and_report ~/cloud/urgent "high priority (aieeee!)"
117 # notes are individual files of tasks, usually, although some are combined.
118 analyze_hierarchy_and_report ~/cloud/grunty* "grunty (external facing) notes"
120 # web site development tasks.
121 analyze_hierarchy_and_report ~/cloud/webular "web design (ideas and tasks)"
123 # feisty notes are about feisty meow(r) concerns ltd codebase development.
124 analyze_hierarchy_and_report ~/cloud/feisty_notes "feisty meow notes (mondo coding)"
126 # metaverse notes are about our ongoing simulator development and LSL scripting.
127 analyze_hierarchy_and_report ~/cloud/metaverse "metaverse in cyberspace design and scripting"
129 # home notes are a new top-level category; used to be under the grunty.
130 analyze_hierarchy_and_report ~/cloud/branch_road "hearth and home notes (branch road)"
132 # and then count up the things that we think will be cleaned soon, but one thing we have learned
133 # unsorted files haven't been categorized yet.
134 analyze_hierarchy_and_report ~/cloud/disordered "disordered and maybe deranged files"
136 # we now consider the backlog of things to read to be a relevant fact. this is going to hose
137 # up our weight accounting considerably.
138 analyze_hierarchy_and_report ~/cloud/reading "reading list (for a quiet afternoon)"
142 # vocation is a prefix for anything i consider part of my life's work.
143 analyze_by_dir_patterns "life's work and other oddities" ~/cloud/vocation*
145 # scan all the items declared as active projects.
146 analyze_by_dir_patterns "active issues" ~/cloud/active*
148 # rub alongside all the travel notes to see if any have interesting burrs.
149 analyze_by_dir_patterns "travel plans" ~/cloud/walkabout*
151 # scan across all appropriately named project or research folders that live in the "cloud".
152 analyze_by_dir_patterns "running projects" ~/cloud/project* ~/cloud/research*
154 # look for our mad scientist style efforts.
155 analyze_by_dir_patterns "lab experiments" ~/cloud/experiment*
157 # snag any work related items for that category.
158 analyze_by_dir_patterns "jobby work tasks" ~/cloud/job*
160 # scan all the trivial project folders.
161 analyze_by_dir_patterns "trivialities and back burner items" ~/cloud/trivia* ~/cloud/backburn*
163 full_report+="================================================================\n\
165 full_report+="$(format_report_line "$total_overload" "$total_weight" "$total_complexity" "total overload")"
167 [gathered on $(date)]\n\n\
170 echo -e "$full_report" | tee -a "$REPORT_FILE"