From 4f5b5ed84ef1ce98bfc820d3e3cc9ccd9762e9e6 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Sat, 3 Dec 2022 12:52:35 -0500 Subject: add captions --- ...th-org-mode-and-gnuplot--david-otoole--main.vtt | 1261 ++++++++++++++++++++ 1 file changed, 1261 insertions(+) create mode 100644 2022/captions/emacsconf-2022-health--health-data-journaling-and-visualization-with-org-mode-and-gnuplot--david-otoole--main.vtt (limited to '2022/captions/emacsconf-2022-health--health-data-journaling-and-visualization-with-org-mode-and-gnuplot--david-otoole--main.vtt') diff --git a/2022/captions/emacsconf-2022-health--health-data-journaling-and-visualization-with-org-mode-and-gnuplot--david-otoole--main.vtt b/2022/captions/emacsconf-2022-health--health-data-journaling-and-visualization-with-org-mode-and-gnuplot--david-otoole--main.vtt new file mode 100644 index 00000000..d785b36e --- /dev/null +++ b/2022/captions/emacsconf-2022-health--health-data-journaling-and-visualization-with-org-mode-and-gnuplot--david-otoole--main.vtt @@ -0,0 +1,1261 @@ +WEBVTT captioned by sachac + +NOTE Introduction + +00:00:00.000 --> 00:00:03.999 +Hi, this is Dave O'Toole, and today + +00:00:04.000 --> 00:00:07.799 +I'll be giving a presentation on tracking health data + +00:00:07.800 --> 00:00:12.759 +with Emacs, Org Mode, and Gnuplot. + +00:00:12.760 --> 00:00:16.079 +So Gnuplot is the well-known scientific + +00:00:16.080 --> 00:00:19.039 +and mathematical plotting application. + +00:00:19.040 --> 00:00:24.639 +You feed it text files full of names, dates, numbers, + +00:00:24.640 --> 00:00:27.199 +data points, and you get out a nice graph. + +00:00:27.200 --> 00:00:31.119 +You can spit out SVG. You can spit out PNG graphics. + +00:00:31.120 --> 00:00:33.639 +In this case, we're using an SVG. + +NOTE How to take daily health journal items + +00:00:33.640 --> 00:00:36.839 +What I'm going to show you today + +00:00:36.840 --> 00:00:39.839 +is how to take daily health journal items: + +00:00:39.840 --> 00:00:42.119 +in other words, things like I exercised + +00:00:42.120 --> 00:00:44.319 +such and such number of minutes today, + +00:00:44.320 --> 00:00:47.399 +I got X hours of sleep last night, + +00:00:47.400 --> 00:00:51.479 +I used such and such number of pieces of nicotine gum, + +00:00:51.480 --> 00:00:54.559 +say five pieces. So let's see, + +00:00:54.560 --> 00:00:58.439 +we've got this whole picture here, all right, + +00:00:58.440 --> 00:00:59.359 +and I've tracked here... + +00:00:59.360 --> 00:01:02.319 +This is a month of data from my life. + +00:01:02.320 --> 00:01:05.159 +This is... I'm not showing all the variables, + +00:01:05.160 --> 00:01:08.519 +but this is what I felt comfortable sharing + +00:01:08.520 --> 00:01:14.239 +in order to help people who might have a need to track, + +00:01:14.240 --> 00:01:15.919 +either because of a chronic condition, + +00:01:15.920 --> 00:01:18.599 +or just because of a health improvement goal + +00:01:18.600 --> 00:01:20.959 +or what have you, people who might need to + +00:01:20.960 --> 00:01:23.319 +track health data in a way + +00:01:23.320 --> 00:01:24.959 +that's a little bit more robust + +00:01:24.960 --> 00:01:26.599 +than just one or two variables + +00:01:26.600 --> 00:01:29.839 +and just weight or just blood pressure. + +00:01:29.840 --> 00:01:33.079 +So in this case, I've got exercise, + +00:01:33.080 --> 00:01:36.399 +I've got the number of hours of sleep, + +00:01:36.400 --> 00:01:38.559 +the number of doses of nicotine, + +00:01:38.560 --> 00:01:40.799 +(that's the yellow line here), + +00:01:40.800 --> 00:01:44.199 +and this is referring to nicotine gum. + +00:01:44.240 --> 00:01:45.559 +What we're going to be talking about + +00:01:45.560 --> 00:01:47.839 +is looking at connections, the idea + +00:01:47.840 --> 00:01:49.879 +that plotting your data can actually + +00:01:49.880 --> 00:01:52.119 +help you figure out what's going on. + +00:01:52.120 --> 00:01:53.079 +This is just one month. + +00:01:53.080 --> 00:01:55.439 +I've been doing this for a couple of months now, + +00:01:55.440 --> 00:01:57.559 +but I felt comfortable showing one month + +00:01:57.560 --> 00:01:59.439 +with a limited subset of the variables. + +NOTE How to set up your org templates + +00:01:59.440 --> 00:02:02.239 +What I'm going to be doing in this presentation + +00:02:02.240 --> 00:02:05.279 +is showing you how to set up your org templates + +00:02:05.280 --> 00:02:08.799 +so that you can, you know, hit a hotkey + +00:02:08.800 --> 00:02:11.839 +to capture today's data with an org template-- + +00:02:11.840 --> 00:02:14.199 +or in this case yesterday's. Usually I'm saying, okay, + +00:02:14.200 --> 00:02:15.639 +yesterday this happened, + +00:02:15.640 --> 00:02:17.479 +because you don't know until the day's over + +00:02:17.480 --> 00:02:19.719 +how many pieces of nicotine gum you ate + +00:02:19.720 --> 00:02:21.439 +or how many hours you slept. + +00:02:21.440 --> 00:02:25.959 +So usually we're recording data for the previous day. + +00:02:25.960 --> 00:02:28.079 +We can set up a capture template + +00:02:28.080 --> 00:02:30.919 +so that it fills a little org entry. One for exercise, + +00:02:30.920 --> 00:02:34.279 +one for sleep, one for nicotine, one for distress. + +00:02:34.280 --> 00:02:36.919 +Here distress is just 1 to 10: + +00:02:36.920 --> 00:02:38.559 +how bad do you feel today? + +00:02:38.560 --> 00:02:41.639 +It's not a scientific measure, but you know, + +00:02:41.640 --> 00:02:43.359 +many, many things ask you to rate + +00:02:43.360 --> 00:02:47.119 +on a scale of 1 to 10, how bad is the anxiety, + +00:02:47.120 --> 00:02:49.639 +how bad is the general level of stress, + +00:02:49.640 --> 00:02:51.679 +and so without a lot of complication, + +00:02:51.680 --> 00:02:53.159 +I just rate that one to ten. + +00:02:53.160 --> 00:02:58.799 +Pain, okay, we won't have to get into any details, + +00:02:58.800 --> 00:03:00.959 +but if there is a level of chronic pain, well, + +00:03:00.960 --> 00:03:04.239 +I put that between 1 and 10. As we can see here, + +00:03:04.240 --> 00:03:07.319 +during the period that I've shown you, it's pretty low. + +00:03:07.320 --> 00:03:11.919 +There's some. If you miss a dose of medication, + +00:03:11.920 --> 00:03:13.599 +you can track that, in this case + +00:03:13.600 --> 00:03:17.639 +with a big ugly red triangle, you know. + +00:03:17.640 --> 00:03:24.279 +You can see, I can see here that in mid-, in late September, + +00:03:24.280 --> 00:03:29.199 +sorry, in early to mid-October, + +00:03:29.200 --> 00:03:30.999 +I stopped using the nicotine gum + +00:03:31.000 --> 00:03:32.959 +and probably should have cut down more gradually + +00:03:32.960 --> 00:03:34.759 +because my sleep suffered. Look at this. + +00:03:34.760 --> 00:03:37.199 +The sleep line is down here, okay? + +NOTE How to do it in GNU Emacs + +00:03:38.320 --> 00:03:39.519 +What I'm going to do now, + +00:03:39.520 --> 00:03:40.879 +now that I've shown you the graph + +00:03:40.880 --> 00:03:44.799 +and some of the things that are useful about it, + +00:03:44.800 --> 00:03:46.639 +I'm going to actually take a step back + +00:03:46.640 --> 00:03:50.319 +and show you from start to finish how you can do this + +00:03:50.320 --> 00:03:53.319 +in GNU Emacs, and I have a little template generator + +00:03:53.320 --> 00:03:56.279 +that you can use if you'd like. + +00:03:56.280 --> 00:03:59.919 +All right, so let's go back. + +00:03:59.920 --> 00:04:01.479 +Let's step back from this file. + +00:04:01.480 --> 00:04:07.599 +We're going to split the screen, and on the left side, + +00:04:07.600 --> 00:04:09.839 +I'm going to put the underlying Org file + +00:04:09.840 --> 00:04:10.919 +that generates this graph. + +00:04:10.920 --> 00:04:16.839 +Let me shrink that a little bit. + +NOTE Overview of the presentation + +00:04:16.840 --> 00:04:22.759 +All right, I'm going to work my way backwards + +00:04:22.760 --> 00:04:26.519 +from the template to the template generator, + +00:04:26.520 --> 00:04:28.439 +meaning that you'll be able to spit out, + +00:04:28.440 --> 00:04:31.839 +given your own specification of health variables, + +00:04:31.840 --> 00:04:33.519 +you'll be able to have it spit out + +00:04:33.520 --> 00:04:38.159 +a custom Gnuplot script like this + +00:04:38.160 --> 00:04:41.319 +that's preset up with the definitions + +00:04:41.320 --> 00:04:43.159 +for the column view in Org mode. + +00:04:43.160 --> 00:04:45.399 +I'm assuming a little bit of familiarity + +00:04:45.400 --> 00:04:47.199 +with Org mode and Gnuplotting, + +00:04:47.200 --> 00:04:51.959 +but I'll try to explain as much as I can as I go along. + +NOTE The journal + +00:04:51.960 --> 00:04:59.039 +The journal here is where... okay, okay, one moment. + +00:04:59.040 --> 00:05:03.519 +So as you can see, there's a sub-entry here + +00:05:03.520 --> 00:05:06.279 +for each day that I've included from my data set + +00:05:06.280 --> 00:05:08.559 +starting on September 13th of this year + +00:05:08.560 --> 00:05:10.399 +and ending on October 17th. + +00:05:10.400 --> 00:05:16.959 +And there's an Org property drawer with + +00:05:16.960 --> 00:05:22.999 +the corresponding names of each field and the value. + +00:05:29.800 --> 00:05:36.759 +Now the idea here is that the columns specify... + +00:05:36.760 --> 00:05:40.639 +if you know a little bit about Org mode, + +00:05:40.640 --> 00:05:43.479 +what happens is that you... + +00:05:43.480 --> 00:05:50.919 +let's say that I hit the key for my journal template, + +00:05:50.920 --> 00:05:52.799 +which... Mine is very similar. + +NOTE The capture buffer + +00:05:52.800 --> 00:06:00.879 +This is the capture buffer for today's date, + +00:06:00.880 --> 00:06:02.679 +and if you're recording yesterday's date, + +00:06:02.680 --> 00:06:04.519 +you can just flip it like that if you need to. + +00:06:04.520 --> 00:06:08.639 +Then I say, yesterday, I remember + +00:06:08.640 --> 00:06:11.159 +I went for about a one-mile walk, + +00:06:11.160 --> 00:06:14.119 +so that's probably about 20 minutes, + +00:06:14.120 --> 00:06:16.519 +and that I had such and such, + +00:06:16.520 --> 00:06:19.079 +I had eight and a half hours of sleep, let's say. + +00:06:19.080 --> 00:06:22.479 +I estimate how many pieces of nicotine gum I have. + +00:06:22.480 --> 00:06:25.799 +I try to count as closely as I can, how much distress, + +00:06:25.800 --> 00:06:26.359 +you know what I mean, + +00:06:26.360 --> 00:06:28.279 +whether or not I missed a dose of medication. + +00:06:28.280 --> 00:06:32.399 +Then when you hit C-c C-c, + +00:06:32.400 --> 00:06:39.799 +it captures that to the end of your Org file. + +00:06:39.800 --> 00:06:46.679 +Now what this shows is that... I cut and paste it in. + +00:06:46.680 --> 00:06:48.159 +I've been keeping these entries every day for months, + +00:06:48.160 --> 00:06:51.319 +and that I cut and pasted in a month of data. + +NOTE The columnview table + +00:06:51.320 --> 00:07:00.799 +Now I'm going to dig in a little bit to the Gnuplot script. + +00:07:00.800 --> 00:07:07.759 +This here, all this stuff, is one component of the graph, + +00:07:07.760 --> 00:07:11.359 +and I'll go over how it works. + +00:07:11.360 --> 00:07:19.319 +First, the items through this column declaration here, + +00:07:19.320 --> 00:07:30.199 +and the id:myid, this columnview table here, + +00:07:30.200 --> 00:07:34.919 +#+BEGIN: columnview, this whole bit here, + +00:07:34.920 --> 00:07:39.879 +is going to get filled in with the corresponding columns, + +00:07:39.880 --> 00:07:43.039 +exercise minutes, sleep hours, nicotine doses. + +00:07:43.040 --> 00:07:53.559 +And then it gets pumped out by Org mode into a file + +00:07:53.560 --> 00:07:59.840 +that looks like this: tab-separated values + +00:07:59.841 --> 00:08:03.479 +with an ISO-style date at the beginning. + +NOTE Gnuplot + +00:08:03.480 --> 00:08:10.359 +So what we're going to do is we're going to go through + +00:08:10.360 --> 00:08:14.479 +the Gnuplot portion of this, + +00:08:14.480 --> 00:08:16.359 +and I'm going to enlarge the font a little. + +00:08:21.280 --> 00:08:23.719 +I'm going to go line by line through the Gnuplot portion. + +00:08:23.720 --> 00:08:30.639 +Now, my template generator will give you one like this. + +00:08:30.640 --> 00:08:33.119 +You don't have to write this from scratch. + +00:08:33.120 --> 00:08:35.679 +But I'm going to go through it line by line + +00:08:35.680 --> 00:08:37.479 +because if you do use the template, + +00:08:37.480 --> 00:08:42.199 +then it'll help to have gone through it line by line, + +00:08:42.200 --> 00:08:46.679 +because you're probably going to have to modify it. + +00:08:46.680 --> 00:08:49.119 +So first, we're going to clear the graphics + +00:08:49.120 --> 00:08:50.199 +from any previous runs + +00:08:50.200 --> 00:08:53.799 +so that if we reuse the same Gnuplot process, + +00:08:53.800 --> 00:08:57.759 +we're not overwriting the old-- + +00:08:57.760 --> 00:09:00.719 +that we are completely overwriting the old image. + +00:09:00.720 --> 00:09:03.319 +So that's the purpose of this line here. + +NOTE Output parameters + +00:09:03.320 --> 00:09:08.559 +The output parameters: we want to put out an SVG file. + +00:09:08.560 --> 00:09:13.639 +Font Arial, that's funny, + +00:09:13.640 --> 00:09:16.119 +but I don't know what font it's actually ending up choosing, + +00:09:16.120 --> 00:09:16.879 +but it looks fine. + +00:09:16.880 --> 00:09:19.639 +Then we want it to be square, + +00:09:19.640 --> 00:09:21.919 +so I'm giving it 900 by 900 pixels, + +00:09:21.920 --> 00:09:23.719 +even though it is a scalable vector graphic. + +00:09:23.720 --> 00:09:29.159 +We're putting it in the same folder as the org file, + +00:09:29.160 --> 00:09:30.799 +example.svg. + +00:09:30.800 --> 00:09:39.519 +These lines here set it up to use the Org mode format + +00:09:39.520 --> 00:09:42.679 +that we showed in the other file over here. + +00:09:42.680 --> 00:09:48.359 +The time format is four-digit year, two-digit month, + +00:09:48.360 --> 00:09:50.359 +two-digit day. + +00:09:50.360 --> 00:09:56.479 +The time format doesn't specify here the time, + +00:09:56.480 --> 00:09:59.599 +but that doesn't seem to mess it up. + +00:09:59.600 --> 00:10:02.439 +This line "set datafile separator" means that + +00:10:02.440 --> 00:10:04.239 +the separators between that + +00:10:04.240 --> 00:10:06.959 +and between all the other fields are tabs, + +00:10:06.960 --> 00:10:08.919 +which is what Org mode does + +00:10:08.920 --> 00:10:10.999 +when it spits out a table by default. + +00:10:11.000 --> 00:10:15.479 +Okay, along to the next lines. + +NOTE Time series data + +00:10:15.480 --> 00:10:18.119 +We're going to set up for time series data, + +00:10:18.120 --> 00:10:22.807 +meaning that the x-axis is going to be time, + +00:10:22.808 --> 00:10:26.119 +x2tics 1 format. + +00:10:26.120 --> 00:10:30.399 +I believe this means that every day has one tick + +00:10:30.400 --> 00:10:32.879 +and that this tells it that the first-- + +00:10:32.880 --> 00:10:39.359 +unfortunately, I forget the exact meaning of this one line. + +00:10:39.360 --> 00:10:44.959 +I'm just going to move on. We want one X tick per day, + +00:10:44.960 --> 00:10:46.519 +and because X is in seconds, + +00:10:46.520 --> 00:10:50.319 +it's 24 hours times 60 minutes times 60 seconds. + +00:10:50.320 --> 00:10:55.639 +This line "set grid xtics" gives us + +00:10:55.640 --> 00:10:57.279 +a vertical line on each day of the graph. + +00:10:57.280 --> 00:10:58.319 +I'll pull up the graph + +00:10:58.320 --> 00:11:00.039 +just so that it's a little easier to see. + +00:11:00.040 --> 00:11:03.919 +All these vertical lines, one on each day, + +00:11:03.920 --> 00:11:06.199 +that's given to you by "set grid xtics". + +00:11:06.200 --> 00:11:10.159 +One Y tick every five points. + +00:11:10.160 --> 00:11:13.719 +So here at five pieces of nicotine, + +00:11:13.720 --> 00:11:15.959 +we've got a five, at ten pieces – well, + +00:11:15.960 --> 00:11:19.679 +we don't want to eat ten pieces, but ten, fifteen, twenty. + +00:11:19.680 --> 00:11:25.479 +Rotating the labels to make them fit a little bit better, + +00:11:25.480 --> 00:11:28.039 +that's this part here where the labels are sideways, + +00:11:28.040 --> 00:11:30.639 +and even with just one month of data, + +00:11:30.640 --> 00:11:35.159 +they're getting a little crowded. + +00:11:35.160 --> 00:11:41.399 +This "set key box lc" just makes the line around the key, + +00:11:41.400 --> 00:11:44.039 +the legend here, a little bit less severe. + +00:11:44.040 --> 00:11:51.079 +set xtics format: this makes it so that, for example, + +00:11:51.080 --> 00:11:53.479 +I've done a United-States-style date here + +00:11:53.480 --> 00:11:55.279 +with the month and then the day. + +00:11:55.280 --> 00:11:58.839 +You don't necessarily have to do that. + +00:11:58.840 --> 00:12:01.959 +You can have whatever you want. + +00:12:01.960 --> 00:12:03.079 +This xtics format, + +00:12:03.080 --> 00:12:06.319 +that relates to how the dates are printed. + +00:12:06.320 --> 00:12:12.519 +Remember that over here, this set timefmt, + +00:12:12.520 --> 00:12:15.159 +that relates to how the dates are formatted + +00:12:15.160 --> 00:12:16.999 +in the Org mode output. + +00:12:17.000 --> 00:12:18.319 +So remember, those are two... + +00:12:18.320 --> 00:12:19.519 +You don't want to mix those up. + +00:12:19.520 --> 00:12:23.799 +All right, "yrange [0:40]". + +00:12:23.800 --> 00:12:28.719 +Thus far, my exercise sessions have all been + +00:12:28.720 --> 00:12:31.479 +less than 30 minutes, and nothing's gone over 30. + +00:12:31.480 --> 00:12:35.839 +If you have a health variable + +00:12:35.840 --> 00:12:38.119 +that is in a significantly different range, + +00:12:38.120 --> 00:12:41.639 +you may need to get a slightly more complicated + +00:12:41.640 --> 00:12:43.719 +Gnuplot script because it is possible to plot + +00:12:43.720 --> 00:12:46.479 +multiple yranges in one plot + +00:12:46.480 --> 00:12:48.719 +if you have a variable that uses a different range. + +00:12:48.720 --> 00:12:49.759 +It's just a little trickier. + +00:12:49.760 --> 00:12:55.919 +These parts here, aside from the fact + +00:12:55.920 --> 00:12:59.079 +that you might make some changes that relate to + +00:12:59.080 --> 00:13:01.319 +the date and your country format, + +00:13:01.320 --> 00:13:03.239 +are going to be the same. + +00:13:03.240 --> 00:13:05.919 +This is like boilerplate for almost anything. + +NOTE Health variables + +00:13:05.920 --> 00:13:09.799 +Now here are the parts that are going to vary + +00:13:09.800 --> 00:13:13.399 +depending on what health variables you want to store. + +00:13:13.400 --> 00:13:18.039 +There are three main sections here. + +00:13:18.040 --> 00:13:28.719 +One is setting the different line types that are used. + +00:13:28.720 --> 00:13:32.479 +Setting linetype 1 with line width 2, line color RGB. + +00:13:32.480 --> 00:13:34.959 +Unfortunately, Gnuplot is a little bit cryptic, + +00:13:34.960 --> 00:13:36.879 +which is why I've made this template generator + +00:13:36.880 --> 00:13:37.999 +that I'll show you in a moment. + +00:13:38.000 --> 00:13:43.039 +I pick a color. So this is exercise, forest green. + +00:13:43.040 --> 00:13:49.279 +Point size 1, meaning you get + +00:13:49.280 --> 00:13:51.599 +these little green triangles about that size. + +00:13:51.600 --> 00:13:54.719 +But the point type 9 is the pointing up triangle. + +00:13:54.720 --> 00:13:59.519 +Line type 2, purple. So that's the sleep line. + +00:13:59.520 --> 00:14:02.999 +So we're just establishing these different line types + +00:14:03.000 --> 00:14:04.719 +that we've given arbitrary numbers. + +00:14:04.720 --> 00:14:08.959 +Now onto the next section. + +00:14:08.960 --> 00:14:12.919 +Oh, before I move on here, + +00:14:12.920 --> 00:14:16.119 +you can see point type 11 for line 5, which is red. + +00:14:16.120 --> 00:14:18.079 +And that's the missed medications line, + +00:14:18.080 --> 00:14:20.639 +so you get a triangle that's upside down + +00:14:20.640 --> 00:14:22.679 +because that's point shape 11. + +NOTE Goal lines + +00:14:22.680 --> 00:14:27.879 +All right. The next section here is the goal lines. + +00:14:27.880 --> 00:14:33.440 +There are horizontal dashed lines here + +00:14:33.441 --> 00:14:37.359 +at 8 purple hours of sleep, because 8 hours is the goal. + +00:14:37.360 --> 00:14:41.519 +So there's a horizontal line at Y = 8. + +00:14:41.520 --> 00:14:43.879 +For pieces of nicotine gum, + +00:14:43.880 --> 00:14:46.959 +I'm trying to keep it to around 5 right now. + +00:14:46.960 --> 00:14:52.519 +So my goal line is at 5. So these... + +00:14:52.520 --> 00:14:56.759 +Here, a goal of at least 20 minutes of exercise. + +00:14:56.760 --> 00:14:59.079 +Sometimes I get more, sometimes I get less. + +00:14:59.080 --> 00:15:02.199 +There's a green line and a 20, showing that that's the goal. + +00:15:02.200 --> 00:15:06.479 +These lines here are actually the goal lines. + +00:15:06.480 --> 00:15:09.119 +You can specify the goal for each one + +00:15:09.120 --> 00:15:11.999 +in the template generator that I'll show you. + +NOTE The Gnuplot command + +00:15:12.000 --> 00:15:28.079 +The last part is the actual plot command. + +00:15:28.080 --> 00:15:30.199 +So the dependent... So okay, + +00:15:30.200 --> 00:15:34.919 +these all start with 1, "using 1" against this variable. + +00:15:34.920 --> 00:15:41.599 +So $2... This is a ternary operator here + +00:15:41.600 --> 00:15:49.199 +that says if the value of the second column is zero, + +00:15:49.200 --> 00:15:52.359 +then don't plot a point. In other words, + +00:15:52.360 --> 00:15:56.079 +not a number means it won't plot a point. + +00:15:56.080 --> 00:15:58.919 +The template generator lets you skip over + +00:15:58.920 --> 00:16:02.119 +the details of that. It sticks this in there. + +00:16:02.120 --> 00:16:02.759 +I'll show you. + +00:16:02.760 --> 00:16:09.399 +So we only want to plot a point when the value is non-zero. + +00:16:09.400 --> 00:16:12.479 +If there was no exercise, we're not plotting a point. + +00:16:12.480 --> 00:16:15.759 +The with construct means we'll plot data + +00:16:15.760 --> 00:16:21.340 +using date against exercise with points, + +00:16:21.341 --> 00:16:25.519 +the title is "exercise (minutes)", line type 1. + +00:16:25.520 --> 00:16:29.839 +Remember, we established line type 1 up here + +00:16:29.840 --> 00:16:35.079 +as being forest green, point style 1, + +00:16:35.080 --> 00:16:37.599 +point type 9, green triangles. + +00:16:37.600 --> 00:16:42.399 +Now I'm going to show 1 against column 3, + +00:16:42.400 --> 00:16:43.919 +which is "hours of sleep". + +00:16:43.920 --> 00:16:46.039 +This one is plotted with lines, + +00:16:46.040 --> 00:16:48.599 +so we don't specify a point type or point size, + +00:16:48.600 --> 00:16:51.719 +just a line type 2. And remember, you can see + +00:16:51.720 --> 00:16:55.240 +that line type 2 is defined as purple + +00:16:55.241 --> 00:16:57.359 +with point type 1, point size 1. + +00:16:57.360 --> 00:16:59.959 +Okay, so I did specify point size and point type, + +00:16:59.960 --> 00:17:01.479 +but because I'm not plotting with points, + +00:17:01.480 --> 00:17:02.279 +those are ignored. + +00:17:02.280 --> 00:17:08.799 +Here we come to the line with nicotine. + +00:17:08.800 --> 00:17:11.559 +The fourth column is the nicotine number, + +00:17:11.560 --> 00:17:13.199 +the fourth column from the Org mode file. + +00:17:13.200 --> 00:17:16.007 +So here you can see how we're telling Gnuplot + +00:17:16.008 --> 00:17:19.799 +to take each column of the tab-separated Org mode file + +00:17:19.800 --> 00:17:21.119 +and put it into the graph. + +00:17:21.120 --> 00:17:25.959 +The line types are set up here. + +00:17:25.960 --> 00:17:30.799 +The goal lines are set up here. + +00:17:30.800 --> 00:17:35.559 +And then the actual plot command is set up here. + +NOTE The template generator + +00:17:35.560 --> 00:17:41.319 +So now we're going to work further backwards + +00:17:41.320 --> 00:17:42.959 +from this Gnuplot template + +00:17:42.960 --> 00:17:46.559 +to the template generator that I used to make it. + +00:17:46.560 --> 00:18:01.959 +Now I'm not going to go into + +00:18:01.960 --> 00:18:03.759 +all of the details of the code, + +00:18:03.760 --> 00:18:06.159 +but what I am going to show you is that + +00:18:06.160 --> 00:18:10.679 +there's a variable called `health-factors'. + +00:18:10.680 --> 00:18:15.839 +And what this does, this `health-factors-from-list' + +00:18:15.840 --> 00:18:20.919 +lets you specify, with a property list + +00:18:20.920 --> 00:18:22.679 +of keyword and value pairs + +00:18:22.680 --> 00:18:24.799 +(here's the keyword name and the value is exercise), + +00:18:24.800 --> 00:18:28.199 +the goal that I want 20 minutes of exercise, + +00:18:28.200 --> 00:18:30.199 +that the unit is minutes, + +00:18:30.200 --> 00:18:36.159 +that the color is forest green, and so on. + +00:18:36.160 --> 00:18:39.439 +The aspects of the Gnuplot setup + +00:18:39.440 --> 00:18:43.559 +have been abstracted here. + +00:18:43.560 --> 00:18:49.279 +Eight hours of sleep is the goal here. + +00:18:49.280 --> 00:18:54.039 +The hours are units. What color, + +00:18:54.040 --> 00:18:55.119 +what thickness of the line. + +00:18:55.120 --> 00:19:00.079 +Here we specify the number of points. + +00:19:00.080 --> 00:19:01.279 +There's references online + +00:19:01.280 --> 00:19:05.199 +that show you what point types are what shapes in Gnuplot, + +00:19:05.200 --> 00:19:11.479 +and so on and so forth. + +NOTE The code that creates a template + +00:19:11.480 --> 00:19:17.399 +I'll walk through the code a little bit that does this, + +00:19:17.400 --> 00:19:20.439 +that actually takes these pieces, + +00:19:20.440 --> 00:19:24.399 +that takes this specification of what your variables are + +00:19:24.400 --> 00:19:30.439 +and turns it into a template. + +00:19:30.440 --> 00:19:37.959 +First, I'm using EIEIO, + +00:19:37.960 --> 00:19:41.719 +the object system that's included with GNU Emacs. + +00:19:41.720 --> 00:19:45.119 +It's a reasonable facsimile + +00:19:45.120 --> 00:19:47.319 +of the Common Lisp Object System. + +00:19:47.320 --> 00:19:51.239 +What I'm going to be doing here + +00:19:51.240 --> 00:19:56.199 +is defining a class with each of those items, + +00:19:56.200 --> 00:19:58.479 +those properties that we talked about in that list + +00:19:58.480 --> 00:20:01.319 +that lets you specify name, what the goal is, + +00:20:01.320 --> 00:20:04.239 +what the units are, and the Gnuplot things + +00:20:04.240 --> 00:20:06.559 +(the Gnuplot parameters like thickness, + +00:20:06.560 --> 00:20:13.239 +plot type, and all that) into a class that will then + +00:20:13.240 --> 00:20:16.519 +spit out the template once you feed it + +00:20:16.520 --> 00:20:27.759 +some of these health factor objects. So just a moment. + +00:20:27.760 --> 00:20:34.479 +For example, you can see that this template + +00:20:34.480 --> 00:20:46.319 +originally came from being generated by this code here. + +00:20:46.320 --> 00:20:52.959 +To use the template, + +00:20:52.960 --> 00:20:55.399 +to use this little template generator... + +00:20:55.400 --> 00:21:06.279 +See, here's where it spits out the line type + +00:21:06.280 --> 00:21:07.439 +given the pieces. + +00:21:07.440 --> 00:21:09.679 +This is all just text formatting. + +00:21:09.680 --> 00:21:11.319 +This is one of the things that Emacs Lisp + +00:21:11.320 --> 00:21:13.159 +just really excels at. + +00:21:13.160 --> 00:21:19.519 +I need to take a piece of data + +00:21:19.520 --> 00:21:22.639 +like a list of health information, + +00:21:22.640 --> 00:21:25.679 +a list of health variables, what their units are, + +00:21:25.680 --> 00:21:28.119 +and how they're supposed to be formatted in Gnuplot, + +00:21:28.120 --> 00:21:30.199 +and go from that to the nice template. + +00:21:30.200 --> 00:21:31.719 +So that's pretty much the whole thing. + +00:21:31.720 --> 00:21:40.999 +I want to see if there's anything I missed. + +NOTE The power of the chart + +00:21:41.000 --> 00:21:51.519 +Bring up the chart. + +00:21:51.520 --> 00:21:54.279 +This has been really useful + +00:21:54.280 --> 00:21:59.599 +for communicating with healthcare professionals + +00:21:59.600 --> 00:22:04.399 +because you are both on the same page + +00:22:04.400 --> 00:22:05.879 +about exactly what is happening, + +00:22:05.880 --> 00:22:10.679 +what's been happening because if... Let's say + +00:22:10.680 --> 00:22:15.239 +that you're tired when you talk to your care provider. + +00:22:15.240 --> 00:22:17.559 +Well, if you have objective information + +00:22:17.560 --> 00:22:18.839 +that you've been recording every day, + +00:22:18.840 --> 00:22:22.399 +that you're ahead of the game, really, + +00:22:22.400 --> 00:22:25.119 +because you don't need, necessarily, the presence of mind + +00:22:25.120 --> 00:22:27.679 +to be able to give your care provider + +00:22:27.680 --> 00:22:30.039 +a complete picture of what's going on in your world. + +00:22:30.040 --> 00:22:33.039 +If you can find those few minutes a day to enter-- + +00:22:33.040 --> 00:22:34.399 +not even a few minutes, + +00:22:34.400 --> 00:22:37.759 +really just a minute to enter the data + +00:22:37.760 --> 00:22:39.839 +and say what happened yesterday... + +00:22:39.840 --> 00:22:42.759 +I'm finding over these months + +00:22:42.760 --> 00:22:45.039 +that I've been more in touch with my health when I can-- + +00:22:45.040 --> 00:22:49.919 +not forced, but when I have the habit, + +00:22:49.920 --> 00:22:52.159 +the consistent habit every single day + +00:22:52.160 --> 00:22:55.839 +of recording that data--I'm accountable to myself. + +00:22:55.840 --> 00:22:57.359 +It's interesting. + +00:22:57.360 --> 00:23:01.039 +I guess it gets into a little bit of ideas + +00:23:01.040 --> 00:23:02.439 +about the Quantified Self + +00:23:02.440 --> 00:23:05.239 +and how holding yourself accountable + +00:23:05.240 --> 00:23:09.919 +can change what you do and what the outcomes are. + +00:23:09.920 --> 00:23:14.159 +Just look at this here. + +00:23:14.160 --> 00:23:17.279 +Without getting into too much detail, + +00:23:17.280 --> 00:23:19.679 +one of the reasons I track my sleep is because, + +00:23:19.680 --> 00:23:22.039 +as you can see, my sleep + +00:23:22.040 --> 00:23:26.759 +is not as well-regulated as most people, + +00:23:26.760 --> 00:23:31.439 +and that's why I need to do that. + +00:23:31.440 --> 00:23:34.440 +This was a time... 10, 12, + +00:23:34.441 --> 00:23:36.639 +here's 14 hours of sleep, that's depression. + +00:23:36.640 --> 00:23:43.519 +It oscillates a little bit. But then below the goal line, + +00:23:43.520 --> 00:23:45.639 +the things are a little more normal here. + +00:23:45.640 --> 00:23:46.919 +This is a little more normal. + +00:23:46.920 --> 00:23:52.079 +But then, really, without thinking about it too much, + +00:23:52.080 --> 00:23:56.239 +I cut out the nicotine, and my sleep suffered. + +00:23:56.240 --> 00:24:00.199 +Just the fact that I'm able to look and see that connection + +00:24:00.200 --> 00:24:01.359 +is really amazing to me. + +00:24:01.360 --> 00:24:02.759 +Maybe I would have anyway, + +00:24:02.760 --> 00:24:05.239 +but looking at the whole months of data, + +00:24:05.240 --> 00:24:07.399 +there have been many things to discuss + +00:24:07.400 --> 00:24:09.919 +and many things to think about. + +NOTE Thanks + +00:24:09.920 --> 00:24:12.159 +Because this is a short presentation, + +00:24:12.160 --> 00:24:13.839 +I probably should wrap up. + +00:24:13.840 --> 00:24:18.239 +I just want to thank the whole Emacs community + +00:24:18.240 --> 00:24:23.319 +for being there and for including me in the conference + +00:24:23.320 --> 00:24:27.079 +and I hope to participate next year as well. + +00:24:27.080 --> 00:24:29.240 +Thank you so much. -- cgit v1.2.3