<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Samuel Chan</title>
    <description>The latest articles on DEV Community by Samuel Chan (@onlyphantom).</description>
    <link>https://dev.to/onlyphantom</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F189820%2F60729a40-2c6e-4d65-8cc9-18421fc9626e.jpg</url>
      <title>DEV Community: Samuel Chan</title>
      <link>https://dev.to/onlyphantom</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/onlyphantom"/>
    <language>en</language>
    <item>
      <title>My journey in data visualization, and how it took me to Altair</title>
      <dc:creator>Samuel Chan</dc:creator>
      <pubDate>Thu, 27 Oct 2022 10:44:16 +0000</pubDate>
      <link>https://dev.to/onlyphantom/my-journey-in-data-visualization-and-how-it-took-me-to-altair-3p3p</link>
      <guid>https://dev.to/onlyphantom/my-journey-in-data-visualization-and-how-it-took-me-to-altair-3p3p</guid>
      <description>&lt;p&gt;It is remarkable how far we've come in terms of python tooling for charting and visualization. I came into the python scientific computing ecosystem from R (user since 2015) and Matlab (user since 2013), and my experience has been largely pleasant. I wish I could say I've never looked back since, but the truth is that I have. For all the envy of Python's enormous ecosystem, scientific graphing in Matplotlib never felt as natural as it is with Matlab. This is a cruel irony as Matplotlib borrows heavily from the syntax of Matlab, a fact that isn't exactly subtle when you learn that the "Mat" in "Matplotlib" refers to Matlab and the library retains many of Matlab's plotting terminologies (i.e "markers").&lt;/p&gt;

&lt;h2&gt;
  
  
  My introduction to &lt;code&gt;ggplot2&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NeMTAMYD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qmipem445ae2dxce2cw6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NeMTAMYD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qmipem445ae2dxce2cw6.jpg" alt="Some plots I've created with ggplot" width="880" height="693"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--I4rqv6G_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i516m7iqzcig2yshrfv6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I4rqv6G_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i516m7iqzcig2yshrfv6.jpg" alt="Plots I've created with ggplot" width="880" height="642"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Attached above are some of the images I've created in R, with the trusty &lt;code&gt;ggplot2&lt;/code&gt; library.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I remember how I came across Hadley Wickham's &lt;code&gt;ggplot2&lt;/code&gt;. I was relatively new to R and similar to Matlab, R has a rich feature set of built-in graphing utilities, catering to scientific computing users who needed to model complex simulations to statistical user who want a one-liner to produce a faceted plot (R users fondly call them "trellis plot"). Similar to Matlab, one didn't have to bother with importing external packages as R's core plotting library offers a lot out of the box.&lt;/p&gt;

&lt;p&gt;Then I came across a &lt;a href="https://github.com/onlyphantom/rgraphics"&gt;challenge by Harvard's IQSS&lt;/a&gt; and I was rather intrigued. The challenge was about reproducing &lt;a href="http://www.economist.com/node/21541178"&gt;this plot on the Economist&lt;/a&gt; and the materials presented an introduction to ggplot2. I completed the challenge that weekend, and went ahead to reproduce a few more plots I found from the Economist as practice exercise, including &lt;a href="https://github.com/onlyphantom/safeskies"&gt;this one&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0mP1FN55--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z0crwgjd22oiurfy1k7i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0mP1FN55--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z0crwgjd22oiurfy1k7i.png" alt="More images I created with ggplot" width="880" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ggplot2&lt;/code&gt; is fantastic. It is ergonomic, natural, and intuitive. It is all of the above because it is an implementation of the &lt;a href="https://vita.had.co.nz/papers/layered-grammar.html"&gt;grammar of graphics&lt;/a&gt;, which aims to bring a set of grammar to the art of the visualization. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;ggplot2&lt;/code&gt; was great, and I duly put my newfound skills to use by combining it with the &lt;code&gt;shiny&lt;/code&gt; framework to produce visualization-heavy web dashboards like &lt;a href="https://samuelc.shinyapps.io/Quadrant"&gt;this one&lt;/a&gt;. When I taught data visualization, I &lt;a href="https://github.com/onlyphantom/darkershiny"&gt;only&lt;/a&gt; &lt;a href="https://github.com/onlyphantom/coronavirus"&gt;wanted&lt;/a&gt; &lt;a href="https://github.com/onlyphantom/textcomplete"&gt;to&lt;/a&gt; &lt;a href="https://github.com/onlyphantom/covidRT"&gt;teach&lt;/a&gt; the ggplot system because it felt methodical, logical and highly organized. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QvJvRklm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/copbokgt3j8dedxxa5uc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QvJvRklm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/copbokgt3j8dedxxa5uc.jpg" alt="Some plots I've created with ggplot" width="880" height="697"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The teaching experience never quite translate equally to the python universe. It wasn't just because &lt;code&gt;ggplot2&lt;/code&gt; is highly declarative -- the user is concerned only with "what" she wants to achieve, not "how" she wants it achieved. It wasn't just because &lt;code&gt;ggplot2&lt;/code&gt; adheres to a coherent system, known as the grammar of graphics. It wasn't just because &lt;code&gt;ggplot2&lt;/code&gt; is highly instructive -- it picks default values in ways that are seemingly minor but when compounded over many decisions, can mean the difference between an abhorrent mess and a convincing medium of message.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--q38q-D9y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o4tye10dg8ruzcgtu4g0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--q38q-D9y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o4tye10dg8ruzcgtu4g0.jpg" alt="ggplot images" width="880" height="726"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Altair
&lt;/h2&gt;

&lt;p&gt;I know many Python developers, myself included, begrudgingly switch between the different ecosystems to get the best of what R and Python offer. Then I stumbled upon Altair in 2018, when Altair was in its early days (last few releases before the v2.0; current version is 3.x). I created my first &lt;a href="https://github.com/onlyphantom/pedagogy"&gt;web app with Altair&lt;/a&gt; and it is a project that I still maintain as it is &lt;a href="http://pedagogyapp.com"&gt;actively used&lt;/a&gt; among our teaching staffs at &lt;a href="https://algorit.ma"&gt;Algoritma Data Science Education Center&lt;/a&gt;, a company I co-founded 6 years ago. &lt;/p&gt;

&lt;p&gt;Altair is Jake Vanderplas's attempt to provide a Python wrapper over Vega-Lite / Vega.js (which in turn, is built on D3.js). &lt;/p&gt;

&lt;p&gt;It adheres to the same grammar of graphics system. It is declarative. It is extensible and customizable. &lt;/p&gt;

&lt;p&gt;On top of that, it does something that &lt;code&gt;ggplot2&lt;/code&gt; library couldn't: it emits JavaScript code, which means your graphics can be embedded in just about any HTML file. It runs in the browser and can support browser events like &lt;code&gt;onMouseOver&lt;/code&gt;, &lt;code&gt;onMouseOut&lt;/code&gt;, &lt;code&gt;onClick&lt;/code&gt; etc, so charts created with Vega have that added interactivity and event binding that R plots couldn't. &lt;/p&gt;

&lt;p&gt;This year, when Anaconda announced PyScript, I started a playlist that I initially named &lt;a href="https://www.youtube.com/playlist?list=PLXsFtK46HZxXS9yBHkQXvaw1eLSIS5Mb-"&gt;build with PyScript&lt;/a&gt; in which I build one web app per video, showcasing the different possibilities that come with it. In many of the interactive web dashboards throughout the PyScript series I have relied on the trusty Altair library:&lt;br&gt;
    - &lt;a href="https://youtu.be/3mfqTGs05cE"&gt;Visualizing MiBand runs&lt;/a&gt;&lt;br&gt;
    - &lt;a href="https://youtu.be/ugSBaOT0rVI"&gt;Building an interactive data visualization dashboard&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These videos demonstrates the utility of PyScript along with Altair to create user-friendly front-ends that are truly interactive and fun-to-use. Viewers love them, but I started to get comments that request for a separate series that cast the light on Altair. One that more centrally focus on the building blocks of Altair as a data visualization library. &lt;/p&gt;

&lt;p&gt;With this, I spent the last two months conceptualizing and developing a video series that goes into the art and science of data visualization in Python, adopted from the data visualization curriculum developed by the University of Washington. The series will consist of 5 to 8 long-form videos, each focusing on a key aspect of data visualization and the accompanying mental models that go with it. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/playlist?list=PLXsFtK46HZxXBddVC0FqmbGdlvbDbaqzx"&gt;Data Visualization in Python (2022)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's part 1 of the video:&lt;br&gt;
&lt;a href="https://youtu.be/umTwkgQoo_E"&gt;Data Visualization in Python: Altair 4.2 (altair-viz) Tutorial&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Teaching visualization with Altair has been highly satisfying, and the data scientists &lt;a href="https://supertype.ai"&gt;where I work at&lt;/a&gt; are in agreement of its versatility; documenting my journey here so there is a point of reference and book-keeping for my future self has been equally refreshing. &lt;/p&gt;

&lt;p&gt;Now, readers, if you'd love sharing with me, how do you decide on your data visualization / charting toolkit and how does it look like?&lt;/p&gt;

</description>
      <category>python</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Interactive Visualization of my Mi Band ⌚️ runs w/ PyScript</title>
      <dc:creator>Samuel Chan</dc:creator>
      <pubDate>Fri, 15 Jul 2022 13:24:18 +0000</pubDate>
      <link>https://dev.to/onlyphantom/interactive-visualization-of-my-mi-band-runs-w-pyscript-23ke</link>
      <guid>https://dev.to/onlyphantom/interactive-visualization-of-my-mi-band-runs-w-pyscript-23ke</guid>
      <description>&lt;p&gt;I’ve heard this fantastic quote from a podcast that goes something alone the lines of &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Covid, it’s safe to say, will be here temporarily and then goes away completely. But some of the damages it causes, will stay with us probably permanently, certainly with far longer consequences, long after covid has moved on.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It could have been Balaji Srinivasan, it could have been somebody else.&lt;/p&gt;

&lt;p&gt;But it was the wake up call I needed. Being in this line of work as the rest of you, I am quite used to being glued to my chair working away for up to 10 hours a day. Then the pandemic struck.&lt;/p&gt;

&lt;p&gt;I transported my work machines from office to home second week into the pandemic. This is promptly followed by 14-hour work days, and a complete obliteration of my health. I put on weight, and my already pitiful fitness level tanked to virtually non-existent. &lt;/p&gt;

&lt;p&gt;Hearing that line, the thought that covid would take a few years off my lifespan sounds completely logical, and even inevitable. &lt;/p&gt;

&lt;p&gt;So I started running. And my best friend and co-founder at work bought me Mi Band, a fitness tracker. "A form of encouragement" is how he calls it. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vJeDXe_r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/srilrytfjf88979wqnb4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJeDXe_r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/srilrytfjf88979wqnb4.png" alt="mi band transparent bg" width="500" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I kept at it for more than a year, and this week I thought to export the data and visualize my runs. The goal is to develop a responsive, mobile friendly dashboard that summarizes my running progress, milestones and personal best(s). &lt;/p&gt;

&lt;p&gt;I chose to do it in PyScript and deployed the web app using GitHub pages. Since I have a video series on building apps with PyScript, I naturally recorded the whole development process and wanted to share this with my audience. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--veCYlnlL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fbu2v3vbkmwqkye4uda9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--veCYlnlL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fbu2v3vbkmwqkye4uda9.png" alt="Export Mi Fit Data to Dashboard" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The tutorial features data wrangling and cleaning process using the &lt;code&gt;pandas&lt;/code&gt; library, before delegating the visualization to &lt;code&gt;altair&lt;/code&gt;, which is a wrapper over the popular &lt;code&gt;vega-lite&lt;/code&gt; (vega) charting library. As with all videos in the PyScript tutorial series, we deploy it through GitHub Pages. &lt;/p&gt;

&lt;p&gt;Here's the live dashboard:&lt;br&gt;
onlyphantom.github.io/miband/&lt;/p&gt;

&lt;p&gt;Here's all the code and data:&lt;br&gt;
&lt;a href="https://github.com/onlyphantom/miband"&gt;https://github.com/onlyphantom/miband&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here's each video in the PyScript tutorial series:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Part 1 &lt;a href="https://youtu.be/Qo8dXyKXyME"&gt;PyScript Demo / Tutorial&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Part 2 &lt;a href="https://youtu.be/oH_rTTDjMvM"&gt;Deploying a PyScript App w/GitHub&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Part 3 &lt;a href="https://youtu.be/ugSBaOT0rVI"&gt;Build a PyScript interactive dashboard w/Altair&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Part 4 &lt;a href="https://youtu.be/H6rNzQeryQo"&gt;Build a PyScript guestbook webapp, CRUD&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Part 5 &lt;a href="https://youtu.be/eqyN8_diCAY"&gt;Building an interactive map w/ Folium &amp;amp; PyScript&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Part 6 &lt;a href="https://youtu.be/3mfqTGs05cE"&gt;Dashboard to visualize Mi Fit runs with PyScript + Altair (⌚ -🏃)&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So if also use a fitness tracker / wristband, and don't mind picking up &lt;code&gt;pandas&lt;/code&gt; or &lt;code&gt;altair&lt;/code&gt; for some personal dashboard-ing, follow along the tutorial! It's extremely satisfying to have a longer-term perspective on your run performances and I hope it helps, even if just a little bit, in helping you stay in shape. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Part 6 &lt;a href="https://youtu.be/3mfqTGs05cE"&gt;Dashboard to visualize Mi Fit runs with PyScript + Altair (⌚ -🏃)&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;See you on YouTube!&lt;/p&gt;

</description>
      <category>python</category>
      <category>webdev</category>
      <category>datascience</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Todo + gamification with Taskwarrior &amp; Taskquant</title>
      <dc:creator>Samuel Chan</dc:creator>
      <pubDate>Wed, 06 Apr 2022 13:59:21 +0000</pubDate>
      <link>https://dev.to/onlyphantom/todo-gamification-with-taskwarrior-taskquant-3e38</link>
      <guid>https://dev.to/onlyphantom/todo-gamification-with-taskwarrior-taskquant-3e38</guid>
      <description>&lt;p&gt;If you live and breathe in the terminal, you want as little context switching as possible. For many things (like web browsing and spreadsheet editing) a graphical user interface seems inevitable no matter how great the alternative is (i.e &lt;em&gt;lynx browser&lt;/em&gt;). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuw46pu3croz6yj7hfmjf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuw46pu3croz6yj7hfmjf.png" alt="gui and terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For everything else, there is almost always a better option, one that allows you to stay within the terminal and &lt;em&gt;gasp&lt;/em&gt; optionally works with VIM bindings. As I review my current work and processes, it strikes me that a task manager (todo app) is one such use-case. &lt;/p&gt;

&lt;p&gt;A good todo app is stunning, aesthetically pleasing, and joyous to use. &lt;/p&gt;

&lt;p&gt;But a &lt;strong&gt;great&lt;/strong&gt; todo app should be almost the entirely opposite of a good todo app. It shouldn't even be joyous to use, lest you spend too much time in it. I want a todo app that is so minimal, so unobtrusive that it's &lt;em&gt;barely there&lt;/em&gt;. If I find the todo app enjoyable, I'm spending too much time in it instead of doing the task.&lt;/p&gt;

&lt;h4&gt;
  
  
  Taskwarrior
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frb7mzdesmdw8wav8h3gn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frb7mzdesmdw8wav8h3gn.png" alt="taskwarrior"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Taskwarrior is a free, open source TUI that puts your TODO in the terminal and is as unobtrusive as to-do apps get. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=cDYIes9avW4" rel="noopener noreferrer"&gt;Taskwarrior video introduction&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It has built-in reporting features (&lt;code&gt;task burndown.weekly&lt;/code&gt;), a tagging system (&lt;code&gt;+meeting +report&lt;/code&gt;), a context switcher (&lt;code&gt;task context office&lt;/code&gt;), project hierarchies (&lt;code&gt;task project:Startup&lt;/code&gt;), a &lt;a href="https://taskwarrior.org/docs/using_dates.html" rel="noopener noreferrer"&gt;robust date system&lt;/a&gt; that blows anything, free or proprietary, out of the water, and a &lt;em&gt;scriptable&lt;/em&gt; urgency formula for each task.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;There are many other real-life examples of algorithms that are used to approximate qualities: the Apgar Score that assesses the health of newborns, Google's Page Rank that measures the importance of a web link, or credit ratings. These examples all approximate, but cannot perfectly represent, a complex concept.&lt;/p&gt;

&lt;p&gt;Taskwarrior uses a polynomial expression to calculate urgency. This is a simple sum of terms, where each term represents some measurable quality of a task. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Custom Attributes
&lt;/h4&gt;

&lt;p&gt;The best part of Taskwarrior is its support for user-defined attributes (UDA) beyond what it offers out of the box. No matter what productivity system (e.g GTD system) I choose, I &lt;em&gt;can make it work&lt;/em&gt; the way I want to with a bit of customization. &lt;/p&gt;

&lt;p&gt;One theme of my productivity system over the past many years is a way to quantitatively measure my productivity with a &lt;code&gt;score&lt;/code&gt; attribute. Different apps may come and go, but to make it work for me, I need the &lt;code&gt;score&lt;/code&gt; attribute as it's integral to how I manage my periodic reviews and longer-term reflections. It also pushes me to work on large projects since they come with bigger rewards (at least psychologically). &lt;/p&gt;

&lt;p&gt;How do I add that to Taskwarrior? Simple. Add the following lines to the end of your &lt;code&gt;.taskrc&lt;/code&gt; file:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

uda.score.type=numeric
uda.score.label=Score 🏆 
urgency.uda.score.coefficient=2


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now all your task has an extra, optional &lt;code&gt;score&lt;/code&gt; field (🏆)!&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6np2dlrq4zxt5e4xxdh5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6np2dlrq4zxt5e4xxdh5.png" alt="taskwarrior score"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Productivity Scoresheet
&lt;/h4&gt;

&lt;p&gt;One thing I often do in my periodic review is to collect data-points on  my activities over the last period. This includes data from my work machines, my Mi Band, and Apple Health. &lt;/p&gt;

&lt;p&gt;For example, I know how many hours and minutes I've spent on one specific app, or task, over the last calendar year.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F39paphp708zgeg85lais.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F39paphp708zgeg85lais.jpg" alt="timing app"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For Taskwarrior, all that is left to do is to roll out a Python app that I can install and run. This package weighs less than 8kb (which is really &lt;em&gt;nothing&lt;/em&gt;) and is available on PyPI. It installs under one second:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

pip install taskquant


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;After which you can issue &lt;code&gt;tq&lt;/code&gt; to get a productivity breakdown. Add the &lt;code&gt;-w&lt;/code&gt; flag to have it grouped by week, in a rolling sum fashion:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

tq -w 
+-------+-------+------------+
| Week# | Score | Cumulative |
+-------+-------+------------+
|  10   |  56   |     56     |
|  11   |  33   |     89     |
|  12   |  26   |    115     |
|  13   |  12   |    127     |
+-------+-------+------------+


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F34tv82rng75kce1qwo2n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F34tv82rng75kce1qwo2n.png" alt="taskquant"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to hack away at your productivity system, the project is available on my GitHub:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/onlyphantom/taskquant" rel="noopener noreferrer"&gt;TaskQuant&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Bonus: Watch the whole process in action
&lt;/h4&gt;

&lt;p&gt;I thought it'd be interesting to show how I build out the CLI tool so I've uploaded a recording of that on YouTube as well. If you're a data analyst from the &lt;code&gt;pandas&lt;/code&gt; world, you may learn a thing or two about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;group by&lt;/li&gt;
&lt;li&gt;aggregation&lt;/li&gt;
&lt;li&gt;filling missing dates (padding)&lt;/li&gt;
&lt;li&gt;tabular summary&lt;/li&gt;
&lt;li&gt;&lt;p&gt;colorful CLI &lt;br&gt;
All without any dependencies except tasklib (the Taskwarrior libary itself). This brings the package down to 6.8kb of code, and with its 1 second installation time, is similarly unobtrusive. Gets you your productivity scores, and get out of the way. If you'd like to watch it, here are the links:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=lT2jqmhRkxo" rel="noopener noreferrer"&gt;Building Taskquant ep.1&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://youtube.com/playlist?list=PLXsFtK46HZxXIVE4tRjwMjwKFVaQSdT5W" rel="noopener noreferrer"&gt;Building Taskquant, full playlist&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  What's next
&lt;/h4&gt;

&lt;p&gt;We'll add terminal-based graphs and charts, and maybe more variety in terms of reporting format. &lt;strong&gt;No, there can never be too many ways to see how you're not doing enough&lt;/strong&gt;. If you want to follow along the journey, drop by and 👋 on YouTube. &lt;/p&gt;

&lt;p&gt;If you're feeling more driven than that, go ahead and install Taskwarrior and Taskquant and start knocking out some to-do! Collaborators welcomed!&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>python</category>
      <category>opensource</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
