While the core of p3k is not open source, many components are. Below is a list of the components used in p3k.
I am working to pull out more parts of p3k into libraries and will keep this list up to date as I progress.
Publishing Other Content
I've had the best luck with the Jawbone UP for tracking my sleep. I have logs now since November 2011 of how much I've slept every night.
The Jawbone app has an interface for adding a note to a sleep record. Here is a screenshot showing an example of adding a note to a sleep record.
I use the Withings scale to track my weight. Through a series of convoluted steps, the data eventually ends up on p3k and is published here.
Currently every time there is a new measurement it results in a post on my site. I may change this to post once a week showing a small graph instead.
I wrote a simple simple pushup-tracking app which makes POST requests directly to my server, creating these posts.
Notes vs Articles
Storing External Content
When displaying external content on my site for reply-context and comments, p3k stores both the raw HTML and the parsed JSON for external pages on disk. Below is a screenshot showing how the folder structure maps to the URLs.
When writing a note, I often want to address people by a nickname rather than by full name or full domain name. (I don't think "@aaronparecki.com" looks particularly good in a post.)
I have a file called
@aaronpk http://aaronparecki.com http://aaronparecki.com/images/aaronpk.png Aaron Parecki @caseorganic http://caseorganic.com https://twimg0-a.akamaihd.net/profile_images/1788860814/kk-caseorganic_reasonably_small.jpg Amber Case @tantek http://tantek.com http://tantek.com/photo.jpg Tantek Çelik @t http://tantek.com http://tantek.com/photo.jpg Tantek Çelik @snarfed http://snarfed.org/ https://pbs.twimg.com/profile_images/2812992290/be21b6e4df4b499a98e87413b355c657_bigger.jpeg Ryan Barrett
Note that in the case of @snarfed, his twitter account is actually different.
p3k uses a database as a cache and to quickly query lists of posts by category, tag, date or by other meta data. No actual post content is stored in the database, the post content is read from disk when needed. The database can be regenerated from the raw files on disk with a script, so there is no worry if the database is suddenly deleted or corrupted.
The posts table holds the primary meta-data for all posts on the site.
Each tag has an ID and is stored in the tags table.
This table links posts to tags.
The clients table holds a list of all micropub clients that have created posts.
The syndications table contains syndication URLs for posts.
This can be used to find the canonical URL of a syndicated post given its URL on Twitter or Instagram.
All content in p3k is stored as files on disk.
There is a top-level folder for each post type, articles, notes, replies, events, metrics, travel, presentations. (If I had to do this from scratch, I wouldn't have made this distinction at this level).
Each folder contains subfolders for the year and month.
For everything except metrics, the structure is:
For metrics, the filenames are the full timestamp:
If there are any associated photos or files for a post, they go into a subfolder with the same name as the base name of the file. In the "notes" example above, the photo attached to the "08-4.md" note lives in a folder named "08-4".
Here is an example .md file for one of my notes.
--- date: "2013-12-03T23:21:49-08:00" place-name: Portland, OR, USA timezone: America/Los_Angeles latitude: 45.506659 longitude: -122.654230 slug: homebrew-website-club tags: - hwc - indieweb syndication: - https://twitter.com/aaronpk/408134030979108864 ... Next Homebrew Website Club mtg Wed 18:30 at @EsriPDX & @MozSF (with remote video) http://calagator.org/events/1250465273 Notes from last meeting: http://tantek.com/2013/332/b1/homebrew-website-club-newsletter All are welcome, whether or not you currently have your own website!
--- title: IndieWeb Dinner at 21st Amendment slug: indieweb-dinner-at-21st-amendment date: "2013-09-30T18:00:00-07:00" timezone: America/Los_Angeles type: event tags: indieweb event: start: "2013-09-30T18:00:00-07:00" location: org: 21st Amendment street-address: 563 2nd St locality: San Francisco region: CA country: US country-abbr: US postal-code: 94107 url: http://21st-amendment.com/ ...
The things I am currently implementing in p3k:
Error retrieving content from GitHub. Malformed JSON was returned from the API.
These are a collection of annoyances that have respective features / improvements. As their annoyance level bubbles to the top, they're likely to become concrete "Working On" tasks.
... and automatically generate a png thumbnail of the song
When I'm replying to something that contains a photo, the reply context should include that photo
Mocked up here http://indiewebcamp.com/reply-context-examples#reply_to_a_photo
Occasionally I find myself posting a note and afterwards wishing I had clicked the "POSSE to Facebook" checkbox in my interface.
When viewing a note, I should have a button I can press to POSSE to any of my POSSE destinations. I guess this will involve an intermediate interface element so that I can edit the text that will be sent to the POSSE destination.
Need Further Thought
I have been using Foursquare consistently for a number of years now, and it is the authoritative source of every venue I've been. I know that if I have never checked in somewhere before on Foursquare, I actually have never been there before.
While my Foursquare feed is currently public, I'm reconsidering whether I want my "IndieSquare" feed to be completely public. I may end up being more selective about the checkins I make public instead, and keep my full checkin history private.
Examples of public checkins often include a short note from me along with the venue for things like checking in to a venue for a public event, or checking in somewhere to say I'm going to be hacking there for a while inviting people to join me. When I check in to lunch two blocks away from my office, it's not that I don't want anyone to know I'm there, it's just that probably nobody cares and there usually isn't anything actionable that would come from them knowing anyway. Usually I'm getting something to go and don't have time to stay and talk anyway.
Really getting annoyed that when Foursquare venues are renamed, merged or deleted, my own history is changed.
Since I carry an active GPS tracker at all times, I collect a large amount of location data. It is not automatically organized into "trips" or anything, it's just a raw stream. I've been considering various ways of publishing this for some time.
Currently I publish my current city as well as time zone of wherever I am on my home page. I do not yet have a feed available.
I'm considering publishing a new "location" post any time I change cities (or possibly also large neighborhood). Here is an example of publishing my city automatically to Facebook: http://www.flickr.com/photos/aaronpk/6962452588/
There are other non-venue locations I may want to publish, such as when I get into a neighborhood I haven't been to in a while. Ideally my phone would detect automatically when I've entered a new area or an area I haven't been to in a while. Probably I would want it to prompt me before publishing anything publicly. I could receive a push notification saying something like "It looks like you're in NW Portland for the first time since August! Publish this?"
While the entire p3k stack is not open source, I have open-sourced many of the components. I've chosen to provide components of the stack rather than the whole thing because in reality nobody is going to want to use the exact same workflow I have built. Instead, components of my site can be re-used by others in their own way.
See #Source Code above.