← Reference system

Making it reproducible

How the database is built, and how two people get the same one.

A carefully produced database is one undocumented edit away from being stale if it cannot be rebuilt from its source.

Why it matters

A carefully produced database is one undocumented edit away from being stale or defective if it cannot be rebuilt from its source. And if two people cannot easily get their system into the same starting state, there is no shared reference to speak of.

What a release is

Not a database on its own: a database, a pinned Open mSupply version and a pinned Grafana version, tested together and handed over as one thing. Somebody presses go and gets a working system rather than a set of parts to assemble.

How the build works

Everything comes from a source workbook and a set of scripts. Master data is imported first, then three years of stock and transactions are generated on top of it — far too much to enter by hand.

Fixed inputs, fixed ordering, and dates derived from a single anchor rather than from the clock. The test is not that it looks right: it is that building twice from the same inputs produces the same database, checked by comparing the two.

What counts as done

Anyone can get a working system with no steps beyond pressing go. The snapshot can be regenerated by someone other than the person who built it. Two builds from the same inputs match. And nothing in the build depends on a person remembering to do something.

  1. Fixed inputs. One source workbook, one set of scripts, no hand edits along the way.
  2. Fixed ordering. Where the order of rows could vary, it is pinned - otherwise two builds hold the same stock in a different order and quietly diverge.
  3. Dates from one anchor. Every date derives backwards from a single fixed day, so nothing in the build reads the clock.
  4. Prove it, do not assume it. Build twice and compare. The check covers thirteen tables at every stage, because the parts it did not cover are exactly where the differences hid.
Read the full document: Make it reproducible →How the database is built from source data, and how a release is assembled.
What this isWhy the reference system exists, and what it is trying not to become.Making it relevantHow the contents were decided — and why relevance is the easiest thing to fake.