Baseline: 2026-11-08. Product policy: docs/product.md; installed versions: manifests/lockfiles.
Confirmed: commercial US water/wastewater and soil lab, one lab organization per deployment.
Modest volume and online operation are assumptions. No shared tenancy. The one planned offline
part is the field chain of custody app (docs/product.md, Next): an installable web app served by
this application that sends append-only records; the server stays the system of record.
Use a Django monolith with server-rendered pages and PostgreSQL. Python is a good fit for exact decimal data handling and laboratory integrations; Django supplies mature forms, authentication, transactions, migrations and an ORM in one conventional application.
| Area | Selected baseline | Reason |
|---|---|---|
| Runtime/framework | Python 3.14.10; Django 5.2.19 LTS | Supported combination; Django security support through April 2028 |
| Database | PostgreSQL 17; Psycopg 3.3.8 | Exact numerics, constraints, row locks and managed backups |
| Identity | Django sessions/auth/groups + django-allauth 65.21.1 | Standard account lifecycle, rate limits and MFA capability |
| UI | Django templates/forms, Bootstrap 5.3.8, HTMX 2.0.11, DataTables 3.1.5 | Mature components and progressive enhancement without a separate SPA |
| Serving | Gunicorn 26.2.0, WhiteNoise 6.12.0 | One web service; locally served versioned static assets |
| Documents | WeasyPrint 70.0; python-barcode 0.16.1 | Reports and identity-label PDFs; standard Code 128 SVG generation |
| Statistics | SciPy 1.18.1 / NumPy | Standard distributions; retain exact source observations and validate numerical conversion boundaries |
| Tooling | uv lockfile; Ruff; pytest-django; Playwright | Reproducible environment and focused server/browser verification |
Versions were checked against publisher documentation and package registries on the baseline
date; uv.lock pins the resolved transitive dependencies and CI builds and checks the container.
Use current compatible security patches. PostgreSQL's managed minor patch is provider-controlled.
See Django support,
Python compatibility,
allauth requirements,
Bootstrap,
HTMX and WeasyPrint dependencies.
| Credible alternative | Strength | Why not selected |
|---|---|---|
| Rails 8.1 + Hotwire + PostgreSQL | Equally conventional full-stack app, strong CRUD conventions | Django's explicit forms/auth and Python integration ecosystem fit this project better; Rails remains viable |
| ASP.NET Core 10 LTS + Razor Pages + EF Core/Npgsql | Strong typing, mature identity/ORM, long support window | More framework surface for a small greenfield project; no existing .NET integration constraint |
This is a judgment about this project, not a framework benchmark. Evidence: Rails maintenance, .NET support. A React/API split adds contracts and deployment/testing surface without a demonstrated need. Use DataTables with its Bootstrap adapter and ColReorder for column presentation only. Keep Django-rendered rows, full-queryset filtering/sort links and pagination; disable client sorting, search and paging. Browser preferences store column IDs/order/visibility only, with keyboard controls and reset. No Ajax row API, server preference model, or second table/query framework.
Keep a few Django apps for accounts, receipt/custody, analytical work and reporting, within
one project and database. Views/forms handle transport and validation; small explicit domain
functions handle multi-record transitions in transaction.atomic. Ordinary ORM queries need
no repository wrapper. Use constraints and selective row locks/version checks for concurrency.
The setup import (dataimport) depends on receipt, catalog and analytical and writes only through
their services; none of them depends on it.
Do not encode release policy in signals or spread it across UI handlers.
Client pre-login records planned work; acceptance may create an empty order, never fabricated receipt/custody. Delivery targets are explicit, audited order commitments and remain separate from analytical holding times. Printable labels identify records without changing their state. External results keep immutable source provenance and independent source acceptance; never manufacture internal batches/QC. Physical disposal preserves electronic history and holds.
Use Django's user model extensibility from the first migration. Staff permissions use groups and explicit capabilities. Client access additionally scopes every query/download to authorized client records; one lab deployment still has multiple mutually isolated clients. Account administration and explicit release permission are distinct; a reviewer may also authorize release. Invitation-only access is the initial assumption; never commit bootstrap credentials. Allauth supplies login, reset, verification and MFA mechanisms; lab roles and record authorization remain application policy. Use CSRF protection, secure sessions, HTTPS and explicit trusted hosts/origins.
Store Decimal values with declared scale/precision, original supplied text, units, qualifiers,
limits and method version as distinct data. Typed and imported values are stored as supplied and
never rounded. A value calculated from bench readings is carried at full precision and rounded
once by the test's calculation rule, which the laboratory sets; its readings, the version of the
calculation (code in analytical/calculations.py, never changed once registered) and the rounding
applied are stored with the result, so the reported value can be worked out again. A reporting
limit that a calculation works out from the amounts prepared is rounded by the same rule and kept
before rounding beside the value.
Do not infer nondetects from zero or overwrite observations; preservation limits are per method.
XLSX result import reads a bounded SpreadsheetML table with zipfile and defusedxml, retaining
the numeric XML text before any numeric conversion. General workbook readers that expose floats
cannot preserve this evidence. No formula evaluation, display-format interpretation or Excel
serial-date conversion is performed. Package/XML limits and explicit worksheet selection bound
the synchronous import; existing mapping, authorization and atomic result-entry services apply.
Format and parser references checked 2026-11-15: SpreadsheetML sheets,
defusedxml and Python ZIP handling.
Custody and result corrections retain actor, timestamp, reason and prior linkage. Mutations
write an attributed audit event in the same transaction; background/system actions have an
explicit identity. Prevent update/delete of audit and released records by the runtime DB role
where practical. Separate migration credentials. Application append-only records alone do not
prove resistance to database administrators; stronger tamper evidence is a future policy choice.
Release checks operate on a consistent revision of results, required QC and permissions.
Use deployment TIME_ZONE for new forms/CSV and report snapshots; Lab.timezone is a recorded
setup copy only. Freeze the chosen zone/offsets in issued snapshots; never reinterpret old records.
Capture an immutable report snapshot and render its PDF; before committing release, lock and
recheck that the underlying revision is unchanged. Store snapshot, PDF bytes/hash, version,
actor and amendment linkage atomically. A render failure leaves no released report. Downloads
return stored bytes, never a regeneration from today's mutable records or template. Amendment
creates a new version and preserves the old one. No email delivery is part of a release transaction.
Initially store bounded PDFs/attachments in separate PostgreSQL binary columns with metadata and checksums; list queries must not fetch their bytes. Provisional 10 MiB per-file limit and bounded request/report sizes keep this practical for a small demo. This buys transactional consistency and one backup set at the expense of DB storage, memory and backup growth. Revisit before real instrument files or substantial volume; use Django storage + private S3-compatible object storage then, with staged writes, reconciliation and coordinated restore. Never put persistent files on Render's ephemeral filesystem. Product must confirm volumes and retention.
Report rendering accepts only application templates and escaped data, with local approved assets; deny arbitrary network/file fetching. The one stored asset a report loads is the laboratory logo its snapshot names by content hash; uploaded logos are validated by decoding them and are then kept unchanged. Serve uploaded documents as authorized downloads. Start with bounded synchronous work and explicit retryable failures. Add a standard durable queue only when measured job duration/concurrency requires it; do not build an ad hoc scheduler.
Bootstrap supplies standard controls; a coherent theme and task-oriented shell must deliver a professional operational workspace. Tables need readable density, aligned numbers/units, useful columns, server-side sorting/filtering/pagination and clear identity/status. Forms need logical groups, explicit units, inline errors, preserved input and keyboard focus. Verify realistic receipt/batch/review screens and PDF previews visually. HTMX preserves feedback/focus and CSRF; serve pinned assets locally. Django admin is restricted maintenance tooling only.
Page help is versioned plain-text content selected from the authorized response's resolved route, including distinct form variants. It introduces no record API or database state. The browser keeps per-account panel visibility and width preferences, as it does table presentation preferences. Route-coverage checks require help for every HTML page; downloads and transitions are documented on their invoking pages. The document-page skill defines the authoring and maintenance standard.
What's new is versioned content too: one entry file per observable change in changelog.d/,
read by the staff What's new page and by manage.py changelog, which generates CHANGELOG.md
(checked in CI). Deployments have no version tags, so both group by calendar month. Entries ship
with the release, with no network request. Which entries a user has seen is a per-user
presentation preference (whats_new.seen), so the unread count follows the account across shared
workstations without a migration. An account without one has nothing unread: its first page
records the current entries as seen. The client portal has no What's new.
One Docker web service on Render plus managed PostgreSQL in the same US region is the initial
shape. Docker pins Python, PDF system libraries and fonts; Gunicorn serves the app, WhiteNoise
serves collected static assets. No Redis, worker, separate frontend host or persistent disk.
The public presentation at /about/ ships with the same service. Only its static HTML and
assets live under the dedicated WhiteNoise root;
the workspace stays at / behind sign-in. The project also publishes those files to
GitHub Pages at https://openbga.github.io/environmental-lims/; its links are relative so both addresses work.
Only that published copy adds Plausible analytics, inserted by the Pages workflow; deployments load no analytics.
Build assets and collectstatic during image build; migrate once in a serialized pre-deploy step.
Use backward-compatible migrations while old/new instances overlap; destructive changes need
a staged migration and verified restore path. Rollback of code does not undo a database migration.
Health checks should distinguish process health from database readiness. Send structured logs
with request/record identifiers and errors, not scientific payloads or credentials. Configure
timeouts, connection limits and size limits against actual service capacity. Provide a deliberate
synthetic demo seed/reset operation; never run reset automatically on normal deployments.
reset_demo is that operation: it runs only where ALLOW_DEMO_RESET=true, only against the
seed's demonstration laboratory and only when the schema matches the release, and it erases and
seeds in one transaction. Its schedule lives in render.demo.yaml, a separate Blueprint that the
deploy button never uses (see Operations).
Managed database recovery plus periodic encrypted off-provider exports are the minimum planned backup approach. Prove restore to a separate database and compare custody/audit/report versions before relying on it. Retention, RPO/RTO, region and the responsible operator remain decisions. Report PDFs in the DB participate in the same recovery point. Real-data use needs an operational runbook and tested recovery, not merely a successful demo deployment.
The Render Blueprint describes the web service, database, generated secret and required inputs.
The README button targets https://render.com/deploy?repo=https://github.com/openbga/environmental-lims/tree/main.
It names main because Render otherwise deploys the repository's default branch, which is develop.
A private fork is supported after granting the Render GitHub App access to it;
the deployer still reviews/approves resources. Set autoDeployTrigger: off for distributed button
instances. See button requirements.
Identifiers kept from the former name, Smart Roots LIMS (renamed 2026-11-16 to OpenBGA Environmental
LIMS; repository openbga/smart-roots-lims is now openbga/environmental-lims). They name existing
deployed resources, so renaming them would create new resources or strand data: the Render services,
database and demo-reset job smart-roots-lims, smart-roots-lims-db and smart-roots-lims-demo-reset
(the hosted demo stays at smart-roots-lims.onrender.com), the database name and user vibe_roots,
the roots.* logger names that log filters match, and the internal seed of the acceptance run's
advisory-lock key in core/acceptance/scratch.py.
The old GitHub address redirects to the new one; GitHub Pages does not redirect, so the presentation
is published only at the new address.
CLI v2.36.0 documentation uses render login, workspace selection and
render blueprints validate render.yaml; platform validation needs authenticated workspace
context. Automation uses RENDER_API_KEY; validation does not create deployment resources.
See CLI and Blueprint reference.
The Blueprint creates paid web and PostgreSQL resources; check Render pricing before deployment. Storage, outbound bandwidth, build usage and any paid workspace are charged separately, and a deployment also needs an email provider, off-provider backup storage and a domain. PDF rendering may need the larger web tier; measure memory. Free Postgres expires after 30 days and lacks managed recovery, so it is not a durable overnight/multi-day demo baseline. Paid recovery windows are plan-dependent; backup docs specified 3 days on Hobby and 7 days on Pro+ when checked on 2026-11-08. Budget, credentials, backup destination, demo access and reset policy are the deployer's decisions. Deployers review and approve their own paid resources.
Keep work in complete vertical slices: receipt/custody, analytical work, and reporting/client access. Shared schema, migrations, routing and dependencies change in one place at a time.
The combined gate covers: locked install/lint, PostgreSQL tests for roles/client isolation,
custody/history, decimal results, QC/release concurrency and report amendments; migration from
empty and prior schema plus restore; and a browser journey from receipt through review/release
and authorized client download. Inspect professional layout, keyboard navigation and PDF page
output. Verify the container and Blueprint before deploying. Run the checks a change affects;
don't add tests that simply restate templates. Passing synthetic tests is not laboratory
validation. A laboratory's own acceptance run (run_acceptance) works only in a separate scratch
database and records what passed there; it is evidence for the laboratory to weigh, not a
validation either. Commands are in CONTRIBUTING.
| Decision | Current assumption / who decides |
|---|---|
| Regulatory programs, methods, QC and release authority | The laboratory; no invented acceptance thresholds |
| Scale, uploads, retention and recovery objectives | Small bounded demo; the operator must confirm before real data |
| Hosting budget and demo access/reset policy | The deployer approves budget and defines access/reset policy |
| Email delivery, MFA enforcement and account recovery | Allauth mechanisms selected; operating policy and provider are the laboratory's choice |
| License | AGPL-3.0-only; canonical GNU LICENSE and dependency notices included; published 2026-11-11 |
| Instrument imports | Operator-mapped CSV/TSV and bounded XLSX worksheets; vendor validation awaits representative exports |