TLDR: Iām using HPI (Human Programming Interface) package as a means of unifying, accessing and interacting with all of my personal data.
Itās a Python library (named my
), a collection of modules for:
- social networks: posts, comments, favorites
- reading: e-books and pdfs
- annotations: highlights and comments
- todos and notes
- health data: sleep, exercise, weight, heart rate, and other body metrics
- location
- photos & videos
- browser history
- instant messaging
The package hides the gory details of locating data, parsing, error handling and caching. You simply āimportā your data and get to work with familiar Python types and data structures.
- Hereās a short example to give you an idea: āwhich subreddits I find the most interesting?ā
import my.reddit from collections import Counter return Counter(s.subreddit for s in my.reddit.saved()).most_common(4)
orgmode | 62 |
emacs | 60 |
selfhosted | 51 |
QuantifiedSelf | 46 |
I consider my digital trace an important part of my identity. (#extendedmind) The fact that the data is siloed, and accessing it is inconvenient and borderline frustrating feels very wrong.
Once the data is available as Python objects, I can easily plug it into existing tools, libraries and frameworks. It makes building new tools considerably easier and allows creating new ways of interacting with the data.
I tried different things over the years and I think Iām getting to the point where other people can also benefit from my code by ājustā plugging in their data, and thatās why Iām sharing this.
Imagine if all your life was reflected digitally and available at your fingertips. This library is my attempt to achieve this vision.
If youāre in a hurry, feel free to jump straight to the demos.
For installation/configuration/development guide, see SETUP.org.
Table of contents:- Why?
- How does a Python package help?
- Why donāt you just put everything in a massive database?
- Whatās inside?
- How do you use it?
- Ad-hoc and interactive
- What were my music listening stats for 2018?
- What are the most interesting Slate Star Codex posts Iāve read?
- Accessing exercise data
- Book reading progress
- Messenger stats
- How does it get input data?
- Q & A
- Why Python?
- Can anyone use it?
- How easy is it to use?
- What about privacy?
- But should I use it?
- Would it suit me?
- What it isnāt?
- Related links
- ā
The main reason that led me to develop this is the dissatisfaction of the current situation:
- Our personal data is siloed and trapped across cloud services and various devices
Even when itās possible to access it via the API, itās hardly useful, unless youāre an experienced programmer, willing to invest your time and infrastructure.
- We have insane amounts of data scattered across the cloud, yet weāre left at the mercy of those who collect it to provide something useful based on it
Integrations of data across silo boundaries are almost non-existent. There is so much potential and itās all wasted.
- Iām not willing to wait till some vaporwave project reinvents the whole computing model from scratch
As a programmer, I am in capacity to do something right now, even though itās not necessarily perfect and consistent.
Iāve written a lot about it here, so allow me to simply quote:
- search and information access
- Why canāt I search over all of my personal chat history with a friend, whether itās ICQ logs from 2005 or Whatsapp logs from 2019?
- Why canāt I have incremental search over my tweets? Or browser bookmarks? Or over everything Iāve ever typed/read on the Internet?
- Why canāt I search across my watched youtube videos, even though most of them have subtitles hence allowing for full text search?
- Why canāt I see the places my friends recommended me on Google maps (or any other maps app)?
- productivity
- Why canāt my Google Home add shopping list items to Google Keep? Let alone other todo-list apps.
- Why canāt I create a task in my todo list or calendar from a conversation on Facebook Messenger/Whatsapp/VK.com/Telegram?
- journaling and history
- Why do I have to lose all my browser history if I decide to switch browsers?
- Why canāt I see all the places I traveled to on a single map and photos alongside?
- Why canāt I see what my heart rate (i.e. excitement) and speed were side by side with the video I recorded on GoPro while skiing?
- Why canāt I easily transfer all my books and metadata if I decide to switch from Kindle to PocketBook or vice versa?
- consuming digital content
- Why canāt I see stuff I highlighted on Instapaper as an overlay on top of web page?
- Why canāt I have single āread it laterā list, unifying all things saved on Reddit/Hackernews/Pocket?
- Why canāt I use my todo app instead of āWatch laterā playlist on youtube?
- Why canāt I āfollowā some user on Hackernews?
- Why canāt I see if Iāve run across a Youtube video because my friend sent me a link months ago?
- Why canāt I have uniform music listening stats based on my Last.fm/iTunes/Bandcamp/Spotify/Youtube?
- Why am I forced to use Spotifyās music recommendation algorithm and donāt have an option to try something else?
- Why canāt I easily see what were the books/music/art recommended by my friends or some specific Twitter/Reddit/Hackernews users?
- Why my otherwise perfect hackernews app for Android doesnāt share saved posts/comments with the website?
- health and body maintenance
- Why canāt I tell if I was more sedentary than usual during the past week and whether I need to compensate by doing a bit more exercise?
- Why canāt I see whatās the impact of aerobic exercise on my resting HR?
- Why canāt I have a dashboard for all of my health: food, exercise and sleep to see baselines and trends?
- Why canāt I see the impact of temperature or CO2 concentration in room on my sleep?
- Why canāt I see how holidays (as in, not going to work) impact my stress levels?
- Why canāt I take my Headspace app data and see how/if meditation impacts my sleep?
- Why canāt I run a short snippet of code and check some random health advice on the Internet against my health data.
- personal finance
- Why am I forced to manually copy transactions from different banking apps into a spreadsheet?
- Why canāt I easily match my Amazon/Ebay orders with my bank transactions?
- why I canāt do anything when Iām offline or have a wonky connection?
- tools for thinking and learning
- Why when something like āmind palaceā is literally possible with VR technology, we donāt see any in use?
- Why canāt I easily convert select Instapaper highlights or new foreign words I encountered on my Kindle into Anki flashcards?
- mediocre interfaces
- Why do I have to suffer from poor management and design decisions in UI changes, even if the interface is not the main reason Iām using the product?
- Why canāt I leave priorities and notes on my saved Reddit/Hackernews items?
- Why canāt I leave private notes on Deliveroo restaurants/dishes, so Iād remember what to order/not to order next time?
- Why do people have to suffer from Google Inbox shutdown?
- communication and collaboration
- Why canāt I easily share my web or book highlights with a friend? Or just make highlights in select books public?
- Why canāt I easily find out other personās expertise without interrogating them, just by looking what they read instead?
- backups
- Why do I have to think about it and actively invest time and effort?
- Iām tired of having to use multiple different messengers and social networks
- Iām tired of shitty bloated interfaces
Why do we have to be at mercy of their developers, designers and product managers? If we had our data at hand, we could fine-tune interfaces for our needs.
- Iām tired of mediocre search experience
Text search is something computers do exceptionally well. Yet, often itās not available offline, itās not incremental, everyone reinvents their own query language, and so on.
- Iām frustrated by poor information exploring and processing experience
While for many people, services like Reddit or Twitter are simply time killers (and I donāt judge), some want to use them efficiently, as a source of information/research. Modern bookmarking experience makes it far from perfect.
You can dismiss this as a list of first-world problems, and you would be right, they are. But the major reason I want to solve these problems is to be better at learning and working with knowledge, so I could be better at solving the real problems.
When I started solving some of these problems for myself, Iāve noticed a common pattern: the hardest bit is actually getting your data in the first place. Itās inherently error-prone and frustrating.
But once you have the data in a convenient representation, working with it is pleasant ā you get to explore and build instead of fighting with yet another stupid REST API.
This python package knows how to find data, deserialize it and normalize it to the convenient representation. You have the full power of the programming language to transform the data and do whatever comes to your mind.
Glad youāve asked! I wrote a whole post about it.
In short: while databases are efficient and easy to read from, often they arenāt flexible enough to fit your data. Youāre probably going to end up writing code anyway.
While working with your data, youāll inevitably notice common patterns and code repetition, which youāll probably want to extract somewhere. Thatās where a Python package comes in.
Hereās an (incomplete) list of the modules in the public package:
my.bluemaestro | Bluemaestro temperature/humidity/pressure monitor |
my.body.blood | Blood tracking |
my.body.weight | Weight data (manually logged) |
my.books.kobo | Kobo e-ink reader: annotations and reading stats |
my.calendar.holidays | Provides data on days off work (based on public holidays + manual inputs) |
my.coding.commits | Git commits data: crawls filesystem |
my.coding.github | Github events and their metadata: comments/issues/pull requests |
my.emfit | Emfit QS sleep tracker |
my.fbmessenger | Module for Facebook Messenger messages |
my.feedbin | Module for Feedbin RSS reader |
my.feedly | Module for Feedly RSS reader |
my.hypothesis | Hypothes.is highlights and annotations |
my.instapaper | Instapaper bookmarks, highlights and annotations |
my.location.takeout | Module for Google Takeout data |
my.materialistic | Module for Materialistic app for Hackernews |
my.notes.orgmode | Programmatic access and queries to org-mode files on the filesystem |
my.photos | Module for accessing photos and videos, with their GPS and timestamps |
my.pinboard | Module for pinboard.in bookmarks |
my.reading.polar | Module for Polar articles and highlights |
my.reddit | Module for Reddit data: saved items/comments/upvotes etc |
my.rtm | Remember The Milk tasks and notes |
my.smscalls | Phone calls and SMS messages |
my.twitter | Module for Twitter (uses official twitter archive export) |
Some modules are private, and need a bit of cleanup before merging:
my.workouts | Exercise activity, from Endomondo and manual logs |
my.sleep.manual | Subjective sleep data, manually logged |
my.nutrition | Food and drink consumption data, logged manually from different sources |
my.money | Expenses and shopping data |
my.webhistory | Browsing history (part of promnesia) |
Mainly I use it as a data provider for my scripts, tools, and dashboards.
Also, check out my infrastructure map. Itās a draft at the moment, but it might be helpful for understanding whatās my vision on HPI.
Typical search interfaces make me unhappy as they are siloed, slow, awkward to use and donāt work offline. So I built my own ways around it! I write about it in detail here.
In essence, Iām mirroring most of my online data like chat logs, comments, etc., as plaintext. I can overview it in any text editor, and incrementally search over all of it in a single keypress.
orger is a tool and set of modules for accessing data via org-mode. It allows searching and overviewing, and in addition, Iām using it for creating tasks straight from native app interfaces (e.g. Reddit/Telegram) and spaced repetition via org-drill.
I write about it in detail here and here.
promnesia is a browser extension Iām working on to escape silos by unifying annotations and browsing history from different data sources.
Iāve been using it for more than a year now and working on final touches to properly release it for other people.
As a big fan of #quantified-self, Iām working on personal health, sleep and exercise dashboard, built from various data sources.
Iām working on making it public, you can see some screenshots here.
Timeline is a #lifelogging project Iām working on.
I want to see all my digital history, search in it, filter, easily jump at a specific point in time and see the context when it happened. That way it works as a sort of external memory.
Ideally, it would look similar to Andrew Louisās Memex, or might even reuse his interface if he open sources it. I highly recommend watching his talk for inspiration.
Single import away from getting tracks you listened to:
from my.lastfm import get_scrobbles
scrobbles = get_scrobbles()
scrobbles[200: 205]
[Scrobble(raw={'album': 'Nevermind', 'artist': 'Nirvana', 'date': '1282488504', 'name': 'Drain You'}), Scrobble(raw={'album': 'Dirt', 'artist': 'Alice in Chains', 'date': '1282489764', 'name': 'Would?'}), Scrobble(raw={'album': 'Bob Dylan: The Collection', 'artist': 'Bob Dylan', 'date': '1282493517', 'name': 'Like a Rolling Stone'}), Scrobble(raw={'album': 'Dark Passion Play', 'artist': 'Nightwish', 'date': '1282493819', 'name': 'Amaranth'}), Scrobble(raw={'album': 'Rolled Gold +', 'artist': 'The Rolling Stones', 'date': '1282494161', 'name': "You Can't Always Get What You Want"})]
Or, as a pandas frame to make it pretty:
import pandas as pd
df = pd.DataFrame([{
'dt': s.dt,
'track': s.track,
} for s in scrobbles])
cdf = df.set_index('dt')
cdf[200: 205]
track dt 2010-08-22 14:48:24+00:00 Nirvana ā Drain You 2010-08-22 15:09:24+00:00 Alice in Chains ā Would? 2010-08-22 16:11:57+00:00 Bob Dylan ā Like a Rolling Stone 2010-08-22 16:16:59+00:00 Nightwish ā Amaranth 2010-08-22 16:22:41+00:00 The Rolling Stones ā You Can't Always Get What...
We can use calmap library to plot a github-style music listening activity heatmap:
import matplotlib.pyplot as plt
plt.figure(figsize=(10, 2.3))
import calmap
cdf = cdf.set_index(cdf.index.tz_localize(None)) # calmap expects tz-unaware dates
calmap.yearplot(cdf['track'], how='count', year=2018)
plt.tight_layout()
plt.title('My music listening activity for 2018')
plot_file = 'lastfm_2018.png'
plt.savefig(plot_file)
plot_file
This isnāt necessarily very insightful data, but fun to look at now and then!
My friend asked me if I could recommend them posts I found interesting on Slate Star Codex. With few lines of Python I can quickly recommend them posts I engaged most with, i.e. the ones I annotated most on Hypothesis.
from my.hypothesis import get_pages
from collections import Counter
cc = Counter({p.url: len(p.highlights) for p in get_pages() if 'slatestarcodex' in p.url})
return cc.most_common(10)
E.g. see use of my.workouts
here.
I publish my reading stats on Goodreads so other people can see what Iām reading/have read, but Kobo lacks integration with Goodreads. Iām using kobuddy to access my my Kobo data, and Iāve got a regular task that reminds me to sync my progress once a month.
The task looks like this:
* TODO [#C] sync [[https://goodreads.com][reading progress]] with kobo
DEADLINE: <2019-11-24 Sun .+4w -0d>
[[eshell: with_my python3 -c 'import my.books.kobo as kobo; kobo.print_progress()']]
With a single Enter keypress on the inlined eshell:
command I can print the progress and fill in the completed books on Goodreads, e.g.:
A_Mathematician's_Apology by G. H. Hardy Started : 21 Aug 2018 11:44 Finished: 22 Aug 2018 12:32 Fear and Loathing in Las Vegas: A Savage Journey to the Heart of the American Dream (Vintage) by Thompson, Hunter S. Started : 06 Sep 2018 05:54 Finished: 09 Sep 2018 12:21 Sapiens: A Brief History of Humankind by Yuval Noah Harari Started : 09 Sep 2018 12:22 Finished: 16 Sep 2018 07:25 Inadequate Equilibria: Where and How Civilizations Get Stuck by Eliezer Yudkowsky Started : 31 Jul 2018 22:54 Finished: 16 Sep 2018 07:25 Albion Dreaming by Andy Roberts Started : 20 Aug 2018 21:16 Finished: 16 Sep 2018 07:26
How much do I chat on Facebook Messenger?
from my.fbmessenger import messages
import pandas as pd
import matplotlib.pyplot as plt
df = pd.DataFrame({'dt': m.dt, 'messages': 1} for m in messages())
df.set_index('dt', inplace=True)
df = df.resample('M').sum() # by month
df = df.loc['2016-01-01':'2019-01-01'] # past subset for determinism
fig, ax = plt.subplots(figsize=(15, 5))
df.plot(kind='bar', ax=ax)
# todo wonder if that vvv can be less verbose...
x_labels = df.index.strftime('%Y %b')
ax.set_xticklabels(x_labels)
plot_file = 'messenger_2016_to_2019.png'
plt.tight_layout()
plt.savefig(plot_file)
return plot_file
If youāre curious about any specific data sources Iām using, Iāve written it up in detail.
In short:
- The data is periodically synchronized from the services (cloud or not) locally, on the filesystem
As a result, you get JSONs/sqlite (or other formats, depending on the service) on your disk.
Once you have it, itās trivial to back it up and synchronize to other computers/phones, if necessary.
To schedule periodic sync, Iām using cron.
my.
package only accesses the data on the filesystemThat makes it extremely fast, reliable, and fully offline capable.
As you can see, in such a setup, the data is lagging behind the ārealtimeā. I consider it a necessary sacrifice to make everything fast and resilient.
In theory, itās possible to make the system almost realtime by having a service that sucks in data continuously (rather than periodically), but itās harder as well.
I donāt consider Python unique as a language suitable for such a project. It just happens to be the one Iām most comfortable with. I do have some reasons that I think make it specifically good, but explaining them is out of this postās scope.
In addition, Python offers a very rich ecosystem for data analysis, which we can use to our benefit.
That said, Iāve never seen anything similar in other programming languages, and I would be really interested in, so please send me links if you know some. Iāve heard LISPs are great for data? ;)
Overall, I wish FFIs were a bit more mature, so we didnāt have to think about specific programming languages at all.
Yes!
- you can plug in your own data
- most modules are isolated, so you can only use the ones that you want to
- everything is easily extensible
Starting from simply adding new modules to any dynamic hackery you can possibly imagine within Python.
The whole setup requires some basic programmer literacy:
- installing/running and potentially modifying Python code
- using symlinks
- potentially running Cron jobs
If you have any ideas on making the setup simpler, please let me know!
The modules contain no data, only code to operate on the data.
Everything is local fist, the input data is on your filesystem. If youāre truly paranoid, you can even wrap it in a Docker container.
There is still a question of whether you trust yourself at even keeping all the data on your disk, but it is out of the scope of this post.
If youād rather keep some code private too, itās also trivial to achieve with a private subpackage.
Sure, maybe you can achieve a perfect system where you can instantly find and recall anything that youāve done. Do you really want it? Wouldnāt that, like, make you less human?
Iām not a gatekeeper of what it means to be human, but I donāt think that the shortcomings of the human brain are what makes us such.
So I canāt answer that for you. I certainly want it though. Iām quite open about my goals ā Iād happily get merged/augmented with a computer to enhance my thinking and analytical abilities.
While at the moment we donāt even remotely understand what would such merging or āmind uploadingā entail exactly, I can clearly delegate some tasks, like long term memory, information lookup, and data processing to a computer. They can already handle it really well.
What about these people who have perfect recall and wish they hadnāt.
Sure, maybe it sucks. At the moment though, I donāt anything close to it and this only annoys me. I want to have a choice at least, and digital tools give me this choice.
Probably, at least to some extent.
First, our lives are different, so our APIs might be different too. This is more of a demonstration of whatās Iām using, although I did spend effort towards making it as modular and extensible as possible, so other people could use it too. Itās easy to modify code, add extra methods and modules. You can even keep all your modifications private.
But after all, weāve all sharing many similar activities and using the same products, so there is a huge overlap. Iām not sure how far we can stretch it and keep modules generic enough to be used by multiple people. But letās give it a try perhaps? :)
Second, interacting with your data through the code is the central idea of the project. That kind of cuts off people without technical skills, and even many people capable of coding, who dislike the idea of writing code outside of work.
It might be possible to expose some no-code interfaces, but I still feel that wouldnāt be enough.
Iām not sure whether itās a solvable problem at this point, but happy to hear any suggestions!
- Itās not vaporwave
The project is a little crude, but itās real and working. Iāve been using it for a long time now, and find it fairly sustainable to keep using for the foreseeable future.
- Itās not going to be another silo
While I donāt have anything against commercial use (and I believe any work in this area will benefit all of us), Iām not planning to build a product out of it.
I really hope it can grow into or inspire some mature open source system.
Please take my ideas and code and build something cool from it!
Similar projects:
- Memacs by Karl Voit
- Me API - turn yourself into an open API (HN)
- QS ledger from Mark Koester
- tehmantra/my: directly inspired by this package
- bcongdon/bolero
- Solid project: personal data pod, which websites pull data from
Other links:
- NetOpWibby: A Personal API (HN)
- The sad state of personal data and infrastructure: here I am going into motivation and difficulties arising in the implementation
Open to any feedback and thoughts!
Also, donāt hesitate to raise an issue, or reach me personally if you want to try using it, and find the instructions confusing. Your questions would help me to make it simpler!
In some near future I will write more about:
- specific technical decisions and patterns
- challenges I had so solve
- more use-cases and demos ā itās impossible to fit everything in one post!
, but happy to answer any questions on these topics now!