Thursday, February 26, 2009

A Wanderer @ CubeSpace

I'm calling myself a Wanderer since ISEPP's Terry Bristol said I could represent ISEPP in Chicago. I've made a career working with nonprofits in Portland, so feel pretty comfortable in this role, even though my 4D Solutions isn't itself a 501(c)(3).

I've invited some coworkers in health care to join me tonight. It's no secret that I see a bright future for FOSS in health care, especially around clinical research and medical records management, two separate infrastructures, yet coming together in many ways. You'll find I'm in plenty of good company in thinking this way.

OHSU is here, a guy from the research applications group.

Governments like FOSS, as do academics. Thanks to free and open source software, powers once only available in the private sector (like truly serious SQL), are now available to any kid with a laptop, any professor with eager students, basically any government department with computing needs (which is all of them).

If the taxpayers fund the development, saving results in "the commons" makes perfect sense, even if some of the pieces stay in private silos (especially data, some of which is highly confidential, obviously). A bank using FOSS isn't thereby divulging anything.

Portland JavaScript Admirers have convened for a second time. There's a mailing list, a web site, plus you can follow on Calagator. We meet at CubeSpace, Portland's geek HQS (for software -- not competing with Free Geek). Ad: Women's Networking Group meets in Roman on second Tuesdays.

Our main focus tonight is Apache CouchDB, a document database, written in Erlang. Merlin Albery-Speyer is our first speaker.

We're getting a recap of how ORM takes SQL to/from objects (like what Python likes). We're thinking differently here, with documents much coarser grained than objects. JSON, not SQL, will be your API of choice. As an RDBMS guy, I'm a little freaked out (I'll get over it).

Whereas the SQL model uses JDBC or ODBC (say), the persistence layer for CouchDB uses HTTP as the connection, with a host/database/document looking API -- which is how Django looks to a client as well, thanks to Python.

I asked about ACID compliance, which started a cascading conversation, enlightening I thought, really high caliber.

There's no schema, just JSON maps. Use GET, PUT (create or update), DELETE, POST (for bulk operations i.e. batch).

A map function emits (key, value) pairs, a map, sorted by the key. This is equivalent to SELECT (with filters). Because sorted, it's easy to do ranges.

The web interface makes this easy to play with. The optional reduce function then works with this map. Basically: get your ducks in a row (map), then do something with those ducks (reduce).

J. Chris Anderson of Apache is our second speaker. He's a world class expert on CouchDB, a principal developer. He's working on Sofa as a test application (a blog -- are blog and chat sort of the "hello world" of web apps?).

The delivered Peer-Based Replication feature is how local offices sync with HQS, basically Couch yakking with itself over HTTP. Geeks are geeking out over this topic, about 25-30 of us, all males at the moment (Audrey joins later).

There's a _show and _list being demonstrated, which render the JSON as HTML -- these are Javascript functions, that run on the server, and show up in the URLs. I'm not accustomed to thinking of JavaScript as server side, but that's how CouchDB is designed, around Spidermonkey.

Design documents store application level stuff, like validation and rendering. I guess I'm seeing why this is for JavaScript Admirers, even though there's Erlang involved.

This is all cutting edge stuff. I don't see us diving into it right away in a production setting. I could see using it for medical devices, other inventory management tasks, where local workstations sync to a back office. I get the impression it's blindingly fast if used efficiently i.e. speed is a real benefit, and small changes to data, requeries, won't require moving mountains.

Actually what occurs to me later, is this key-value pairs approach maybe is the future of the medical record, mined with map-reduce to get clinical research views, perhaps for feeding to more traditional SQL engines. The patient-centric, individualized "whole enchilada" i.e. the document "atom", is precisely that unit of storage for which CouchDB is best suited. Note to self: explore in more depth.

Our third speaker, Adam DuVander is presenting about Mapstraction. Adam is with the Legion of Tech, Portland Web Innovators. He's writing a book about mapping APIs for New Starch Press. Mapstraction takes 11 map APIs, like Google's, Yahoo's. This makes it easy to switch around between back ends.

This is something students could be playing with in PPS, just need some latitude and longitude coordinates. Geography and FOSS are like peas in a pod. The Javascript looks something like this:
      function londonJavascriptNight(map) {
// create a lat/lon object
var myPoint = new LatLonPoint(51.520832, -0.140133);
// display the map centered on a latitude and longitude (Google zoom levels)
map.setCenterAndZoom(myPoint, 12);
This reminds me of Cities At Night.

Next I'll grab a couple brews at Lucky Lab -- no wait, cell phone, need to head home.

Hey Derek, sorry I missed you at Fine Grind today, got sucked in to my own soap opera. Best wishes on your trade fair gig, other projects! Kim & Jimmy, many thanks for the bouillabaisse, definitely "brain food" like you said. I wrote up a storm.