Engineering and data curation notes from Ptree, a tree of life explorer: DOM-as-state layout, modern CSS, read-only SQLite, cross-kingdom classification, and executable tours. See also the revision history or subscribe via Atom.
Press Nocturnal on Aves under Mass, drag the mass slider on Mammalia under Conservation, or sweep your pointer across the sidebar world map, and every other property's readout and legend box-whisker plot glide in real time to summarize only the filtered subset, computed entirely in the browser from the tiles already on screen.
Open a whole class of organisms in Ptree, and you sometimes spot a razor-thin sliver of color that has no business being there: a flicker of metamorphosis inside mammals, a stripe of photosynthesis inside land snails, or live birth inside a shell-bearing snail genus. Those slivers do not come from an audit script. They jump out of the interface on sight and send us straight back to the identity graph to figure out which two organisms were fused by mistake.
A taxonomic path from Life to a species commonly crosses fifteen to twenty ranks, while a readable screen holds three or four columns of names. Panning a wide canvas horizontally hides the ancestors that explain where you are; wrapping or indenting a vertical list destroys the horizontal tree structure. Ptree keeps the active columns readable and folds every older generation into one narrow strip along the left edge.
Ptree’s question box answers with a guided tour on the visitor’s screen instead of a chat log. A quick opener speaks and classifies the question while the main guide inspects the tree, streams short stretches of UI moves paired with captions, and rehearses every stop against the live viewer code in a worker thread before a word reaches the browser.
In physics, a path integral sums over every trajectory a system might take, and the path that survives is the one where the action is stationary: nudge it slightly in any direction and the cost barely moves. Software works the same way across time. Every structural decision in a codebase (a table key, a coordinate system, who owns a piece of state, or what a concept is named) shapes every future version of the app that will pass through it: features you have not imagined yet, data sources you have not captured yet, and views you have not drawn.
Do mammals that live in groups live longer than solitary ones? In January 2023, a paper in Nature Communications answered that question using nearly a thousand species, a Bayesian phylogenetic analysis, and brain transcriptomes from 94 of them. The answer was yes, and the paper has already drawn dozens of citations.
Most nature guides show only what survived to the present day. Looking only at two living beavers, a handful of solitary mud worms, or 26 living crocodilians makes those remnants look typical of their lineages. In Ptree, fossils sit behind one live toggle (Fossils) on every property and tree, so one click restores what extinction cut away from every branch of life.
Conservation lore says big animals disappear first: whales, tigers, sharks, elephants. Filter Conservation to threatened species across the five major vertebrate classes in Ptree, and that rule holds sharply across sharks, mammals, and birds, then flips completely upside down the moment you step into lizards, snakes, frogs, and salamanders.
Front-end engineering spent the last fifteen years treating the CSS cascade like a toxic spill that had to be contained inside isolated components, shadow trees, CSS-in-JS hashes, and BEM naming schemes (card__header--highlighted). Every one of those tools exists to solve one organizational problem: keeping a large team of developers from accidentally breaking each other's styles.
Every branch line in Ptree's Tree view bends smoothly when a clade expands, collapses, pages, or folds into the left gutter. There is no requestAnimationFrame loop anywhere in the viewer. The browser's own CSS transition engine interpolates SVG d paths, group translations, and camera motion from one DOM write per layout.
Field guides organize local wildlife as flat lists of species, while global phylogenies strip away geography. Ptree keeps both dimensions live at once. Drop a pin on your neighborhood or select any country, state, mountain range, or sea, and every branch that does not live there dims out while all 42 property overlays and every legend filter stay active. One global tree of life turns into a local ecological instrument with zero extra views.
Textbooks usually mention convergent evolution with two stock examples: bat wings beside bird wings, or dolphins beside sharks. When every trait sits on one cross-kingdom scale with live filtering, you do not have to take anyone’s word for it. Lock one category at the top of the tree, and every independent branch that invented that solution stays lit while the rest of life dims.
Trait databases usually keep every source’s own words in separate columns or raw strings. Each row is easy to defend, and the table has hundreds of siloed labels that leave most of the tree blank and block any comparison between a fern, a coral, a bacterium, and a bird. Ptree puts 11.1 million records across 42 properties (24 categorical and 18 numerical, with up to 82 sources feeding one property and 12 contributing to a single organism) into five to nine cross-kingdom bins per property, while keeping every source’s original word, scope, and citation underneath.
People usually invoke "taste" as an unarguable vibe, either as a polite way of saying "I like this" or as a status badge that they award themselves while failing to spot slop. Neither meaning helps when you are building software or directing AI agents.
Static mockups hide almost everything that determines whether software works. When you draw a screen in Figma and hand it off to be "implemented," the drawing strips away unknown text lengths, overflow, resizing, keyboard focus, scrolling, network latency, interrupted transitions, and state combinations. A screenshot records one frozen pose filled with curated fake data. It cannot specify a live system.
Most data visualizations pick colors by eye on a clean white slide, or grab a stock rainbow or Viridis ramp and call it accessible. Neither approach holds up on a tree of life.
In Ptree, the authored HTML controls, <data> elements, aria-* attributes, and :checked states are the state store and the registry. JavaScript reads from them, writes a few custom properties in place, and never rebuilds a subtree to reflect a change.
When a latest browser lacks a CSS or DOM subfeature, or ships a rendering bug, Ptree keeps the native platform path canonical, isolates the smallest removable workaround at the engine boundary, and files a minimal reproduction upstream. Every active workaround and issue report is listed publicly at Browser issues.
Clicking an expandable taxon in Ptree fans out its children immediately, before the HTTP request for that level returns. The placeholder fan already has the exact number of rows, the exact vertical layout, and the exact fossil filter state the real children will occupy. When the JSON arrives, the placeholders swap their text and property colors in place without moving a single tile or connector.
Almost every charting library and data pipeline treats floating-point numbers as disposable display strings: run toFixed(1) or round the JSON response to three significant digits and move on. On biological data that spans fourteen orders of magnitude, blanket rounding destroys real information while inventing fake precision at the same time.
Ptree can dim every clade on screen that does not occur near your browser's coordinates or inside any country, state, sea, or basin you pick on the world map. Click Madagascar on the primates and five families light up, every one of them a lemur; switch to the Amazon basin and five completely different monkey families answer, with zero overlap. Adding that entire feature took under 200 lines of client JavaScript and required no new database table, no spatial index on the server, and no polygon clipping library.
Most data visualizations hide empty cells. They fill gaps with defaults, impute family averages silently, or draw missing data the same pale shade as zero. In Ptree, gray has one strict meaning across all 42 properties: nobody has measured that branch yet. Keeping missingness visible across all of life exposes a live map of human scientific bias right beside the biology.
Ptree displays eleven taxonomic trees side by side (GBIF, Catalogue of Life, ITIS, Open Tree of Life, Encyclopedia of Life, NCBI, World Flora Online, the Paleobiology Database, GTDB, ICTV, and SILVA) and lets you switch trees while staying on the same organism. Joining those trees sounds like a string join on scientific names until you look at how biological nomenclature actually works.
Hovering across taxa in Ptree while a numeric overlay like Mass, Longevity, or Temperature is active glides the legend's box-whisker plot smoothly from one clade's distribution to the next. Whiskers, interquartile box, median tick, geometric-mean diamond, and endpoint labels all move together, yet the legend code contains no tweening, no timers, and no layout measurement.
Richard Gabriel's classic essay Worse is Better framed software design as a choice between two schools. The MIT approach fixes a complete, consistent interface first and lets the implementation absorb whatever complexity that demands. The New Jersey approach fixes implementation simplicity first and lets the interface carry the rough edges.
Every taxon card in Ptree includes a Wikipedia article tab inside a sandboxed <iframe>. Fetching live Wikipedia pages directly in the browser would break cross-origin theming, leak visitor requests to third-party servers, fail when upstream HTML structure shifts, and leave dead links to non-biological topics outside the tree. Instead, Ptree builds a taxon-only ZIM archive offline, serves it through a local Kiwix instance, and lets Apache inject the viewer's stylesheet into every proxied article on the fly.
When an automated test catches a real upstream data bug or an unresolved edge case, teams usually take one of two paths: delete or test.skip() the assertion so CI turns green, or leave the suite red until everyone stops reading the output. Skipping a test hides whether it ever got fixed; ignoring a red suite hides real regressions; softening the assertion to match broken data Goodharts the suite into lying about reality.
Ptree serves eleven taxonomic backbones totaling 13.6 million taxon records, along with rolled-up properties, photos, sounds, biotic interactions, range maps, and full-text search, directly from local SQLite files. There is no external database server. One Node cluster handles HTTP traffic using Node's built-in node:sqlite (DatabaseSync), keeping memory predictable and cold lookups down to a few milliseconds.
Mainstream software culture treats optional chaining (?.), || default, var(--x, fallback), and try/catch around internal data as signs of maturity. In Ptree they are treated like carpet over dirt: a way to let dirt fall below the standing surface so you do not have to look at it until the floor rots through.
Early versions of Ptree drove whole-page state with root-anchored :has() rules and called getAnimations() to tell when a navigation hop had settled. Chrome profiles showed both burning hundreds of milliseconds per interaction. Moving state onto container classes and counting native transition events cut frame times roughly fivefold.
Clicking the audio icon on a species or clade in Ptree should play that organism within half a second. It should not play twelve seconds of rustling microphone fabric, an inaudible 250 kHz bat-detector file, or a hiker saying "here is a nice woodlouse on a log." Combining xeno-canto and iNaturalist into one recording per species required solving three separate problems: deciding which clades actually make sound, measuring the audio files directly, and filtering out human speech.
Ptree's pipeline maintains dozens of long-lived acquisition and cache SQLite stores that accumulate scraped iNaturalist reception, acoustic measurements, photo scores, and fetched metadata over months. Numbered migration scripts (001_init.sql, 002_add_col.sql, 003_fix_index.sql) rot quickly in a single-developer codebase: every schema tweak adds another file, branches conflict on version numbers, and nobody can tell what a table actually looks like without replaying twenty files in their head.
A Voronoi diagram partitions a plane around seed points so every location belongs to whichever seed sits closest to it. Naming in software and data curation works the same way: every word you choose (a trait category, a column name, a UI label, or a line in a prompt) is a seed in meaning-space. A strong name claims a large, sharply bounded cell. A weak name sits on a blurry border and leaks into its neighbors.
Almost every rule that gets taught as software engineering "best practice" was invented to manage large teams, not to make software good. Micro-frontends, strict component isolation, parallel data-testid attributes beside aria-*, verbose abstraction layers, Jira tickets, stakeholder sign-offs, and focus-group UX testing all exist so forty people with competing incentives can ship without colliding or getting blamed when something slips.
Large parts of Ptree's pipeline, tests, viewer refinements, and this blog were written with AI coding agents. Pretending otherwise would be dishonest, and pretending it works out of the box would be just as dishonest.
An AI coding agent searches well inside the frame that you give it, yet rarely steps outside that frame on its own. Asking a model to refine its own output only searches the old frame harder, because the prior that produced the code is the same prior that judges it. Good steering is not about micromanaging syntax or reading every line. It is about changing the frame: what the problem is an instance of, what the work is for, what scale it lives at, what sibling it matches, and what counts as true.
Most biodiversity databases display one species at a time on a text page. Under that interface, a 9-kilometer leatherback turtle or a glass frog with 45,925 eggs can sit unnoticed inside a 30,000-row CSV for years, because nobody happens to open that species page and read that cell. Ptree paints every trait onto one cross-kingdom scale and rolls every value up eleven taxonomic trees into clade extremes, distributions, and proportions. A single corrupted record stops hiding in a table and skews an entire family, order, or class on sight.