Skip to content

About

OpenBGA Environmental LIMS: free, open-source laboratory information management for US environmental testing laboratories

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

242 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

OpenBGA Environmental LIMS: free, open-source LIMS for environmental laboratories

checks

OpenBGA Environmental LIMS is an environmental laboratory LIMS for one commercial US water, wastewater and soil lab per deployment, and an open-source project of BGASoft Inc. Built with Django, PostgreSQL and Bootstrap/HTMX. AGPL-3.0-only. Source: https://github.com/openbga/environmental-lims.

Use synthetic data while release validation is in progress. This software supports laboratory records; it does not certify compliance or accreditation.

What it covers

  • Setup: laboratory, staff roles, clients and projects, methods, analytes, tests, holding-time rules, QC requirements, limits and qualifiers. These load one record at a time or from spreadsheets saved as CSV, with starter files for common methods that name their public sources.
  • Receipt and custody: chains of custody with several samples, containers, receipt inspection, holds and dispositions, custody events and reasoned corrections.
  • Analytical work: preparation and analytical batches, instrument run lists in standard CSV or template-defined CSV and TSV formats, recorded instrument calibration curves and explicit result/verification links, manual entry and mapped CSV/TSV or XLSX worksheet imports, results calculated from bench readings that are kept with the result and rounded by the laboratory's own rule (dilutions, solids by weight, preparation factors and dry-weight correction for soil, alkalinity and EDTA hardness titrations, BOD bottle worksheets), QC evaluation, independent review, control charts and MDL studies. Staff can download the original CSV, TSV or XLSX from its analytical batch after confirming a result import. Earlier imports retain their recorded provenance. Staff can inspect each calibration standard’s residual and the coefficient of determination (R²) for a linear or quadratic fit with a fitted intercept. An unweighted linear fit also shows Pearson correlation (r), including the sign of the relationship. The worksheet shows whether a quadratic changes direction across the recorded concentrations. When their method calls for a zero intercept, staff can fit a line through the origin using equal, 1/x or 1/x² weights as their procedure allows. For external standards, they can also inspect the mean calibration factor and the variation among standards. Staff can compare each standard’s back-calculated concentration with its recorded concentration and see which standards exceed a maximum absolute percent error they enter. They can use a separate maximum for the lowest concentration. For a quadratic, the worksheet shows the concentration only when the curve has one direction and the observed response falls between its fitted endpoints. Staff can inspect relative standard error across all recorded points for linear fits with a fitted or fixed zero intercept, quadratic fits and average-factor fits. For a quadratic, each standard must have a concentration that can be back-calculated within the recorded range. On an analytical batch, staff can inspect the actual injection order alongside the nearest recorded verification before and after each sample. Staff can count sample injections between verifications and compare each interval with a maximum they enter. Analysts can correct a transcription and retain the earlier version. Each result revision with a linked calibration verification shows the recovery assessment recorded when the QC observation was entered and whether a later observation superseded it. From a calibration record, staff can find revisions whose verification failed its original recovery assessment or whose observation was later corrected. Each link opens the exact revision in its result history. Analysts can open returned results from the dashboard, oldest return first, and see why each needs correction.
  • Reporting: explicit release authorization, versioned immutable PDF reports that print the laboratory's address, logo and certificate numbers, amendments and a client portal where each client can read its issued results and download them as CSV or Excel for the current or an earlier report version. Both formats accept the same CSV template for choosing columns, headings and order. A report package combines that version’s stored PDF and results CSV. When staff request a QC summary on a chain of custody, the package also contains the batch QC for its reported samples. From a reported sampling location, clients can follow results over time within the same project and open the issued PDF behind each result. They can enter an upper limit to compare unqualified numeric results for the same analyte, unit, matrix and reporting basis. For an eligible water or wastewater result on the current report, clients can enter the sampling-day flow and calculate daily mass loading in pounds per day. Clients can also open a monthly concentration worksheet for a project location. When several eligible grabs represent one day, enter the flow at each collection to calculate that day’s concentration. The worksheet shows the mean and highest daily concentration in mg/L and links to the issued PDFs.
  • Operations: price lists and versioned quotes, client-submitted COCs, delivery scheduling, labels, subcontracted results and staff account-hold notices at receipt and report release. When a received sample differs from the client’s declared collection details, intake staff record the reason. The staff submission history shows the declared and received values side by side. Clients and intake staff can download a paper custody sheet for the submitted version they select. Samplers can take it into the field to record collection details and sign container handovers. Internal draft invoices take received tests and an explicitly selected price list or matching accepted quote, preserve billing details and source identities, and keep reasoned edits and cancellations. Accepted quotes also carry their fees and discounts into the draft once, with their source retained. Staff can add fees and discounts with a reason and a distinct manual origin. Staff can enter an agreed due date on the draft or accept a date calculated from its net payment terms at issue. Staff can filter the invoice directory by due date and record externally determined tax amounts as separate lines, with their basis in the description. Project managers and administrators can issue a numbered invoice and download its original PDF for delivery. While the invoice is issued, they can download its lines as a CSV to map into their accounting software. A reasoned void closes the CSV download, preserves the original PDF and allows a replacement draft.
  • Laboratory records: materials, lots and stock movements, equipment, training, nonconformance, and physical sample retention and disposal.

Corrections add a record with a reason. Original observations, custody events and issued reports are never overwritten. The NYSDEC EDD export is exploratory and requires recipient validation; it is not an accepted regulatory submission.

Workflow rules and limits describes each of these in more detail. The product presentation is also served at /about/ on each deployment.

Sample list with search, filters and receipt dispositions

Technical review of a batch beside its QC evidence

Screens show the synthetic demo data.

Hosted demo

Open the OpenBGA Environmental LIMS demo on Render and sign in with one of the demo accounts listed on its sign-in page. The demo presentation is available without signing in. The demo is public and is erased and seeded again every day, so enter synthetic data only.

Try it with Docker

Requires Docker with Compose. This builds the application image and runs it with a local PostgreSQL database in development mode, reachable only from your machine. It is for evaluation, not for real laboratory data.

git clone --branch main https://github.com/openbga/environmental-lims.git
cd environmental-lims
docker compose --profile app up --build -d
# Choose a private password (at least 12 characters) for the synthetic demo accounts.
read -s DEMO_PASSWORD; export DEMO_PASSWORD
# --full loads a synthetic working week; without it you get the accounts and one sample.
docker compose --profile app exec -e DEMO_PASSWORD web python manage.py seed_demo --full

Open http://127.0.0.1:8000 and sign in as demo_custodian, demo_project_manager, demo_analyst, demo_reviewer, demo_approver, demo_admin or demo_client with that password. Stop it with docker compose --profile app down; add --volumes to delete the trial database.

Local development

Requires Python 3.14, uv and PostgreSQL 17. Docker Compose can run the development database. Commands below use the Unix shell:

uv sync --frozen
docker compose up -d db
export DEBUG=true
export DATABASE_URL=postgresql://roots:roots@127.0.0.1:55432/roots
uv run python manage.py migrate
# Supply a private, unique demo password (at least 12 characters) in the environment.
read -s DEMO_PASSWORD; export DEMO_PASSWORD
uv run python manage.py seed_demo
uv run python manage.py runserver 127.0.0.1:8000

Open http://127.0.0.1:8000. Seed accounts are demo_custodian, demo_project_manager, demo_analyst, demo_reviewer, demo_approver, demo_admin, and demo_client, using the supplied password. The seed is explicit and idempotent: it never resets existing passwords or deletes records. It refuses an existing non-demo lab. No seed/reset runs during normal deployment. Add --full for a synthetic working week: two clients, about 50 samples from receipt to report, a batch awaiting review, a QC failure that needs a disposition, control-chart history, an MDL study, and draft, released and amended reports, with the quotes, submissions, inventory, equipment and training records. It takes about 20 seconds and adds nothing when run again. For a public demonstration, seed_demo --announce-accounts also posts an announcement on the sign-in page that lists the demo accounts and DEMO_PASSWORD, where anyone can read them. It leaves out demo_admin, which manages announcements and accounts, and refuses to run while DEMO_PASSWORD opens that account: set a different DEMO_ADMIN_PASSWORD (at least 12 characters) before the first seed. The listed accounts become shared demonstration accounts: whoever signs in cannot change their password, email addresses or two-factor settings. A database that is emptied and seeded again gets the same announcement back; on an existing database the seed leaves an announcement an administrator changed or withdrew as it is. reset_demo erases a demonstration database and seeds it again on a schedule; see Public demonstration. It is never part of a laboratory's deployment. Release requires accounts.authorize_release, which may be granted to a reviewer; nobody may review their own results. Administrator/superuser status alone does not grant release. A newly created demo_approver receives this permission directly; the demo seed does not grant it to groups or restore revoked permissions on rerun. Real-lab setup follows the explicit role policy below.

.env.example documents settings; Django does not automatically load .env. Never commit secrets.

Preview the product presentation alone with python3 -m http.server 8118 --bind 127.0.0.1 --directory website at http://127.0.0.1:8118/about/.

To check a change, see Verify your change.

Set up your laboratory

On a fresh database, configure DATABASE_URL, SECRET_KEY, TIME_ZONE and the production host/ HTTPS settings from .env.example, then run:

uv run python manage.py migrate
uv run python manage.py setup_lab --lab-name "Your Lab Name" \
  --admin-username owner --admin-email owner@yourlab.example

The command prompts privately for the password, or accepts SETUP_ADMIN_PASSWORD from the environment. It creates the laboratory, role groups and first administrator. Reruns retain passwords, existing roles and revoked permissions. --update-lab explicitly renames the lab; --sync-timezone records a changed deployment TIME_ZONE. Use the same deployment time zone for new input and new reports; changing it does not reinterpret stored timestamps or issued reports. Keep demo seeding separate from a real laboratory database.

CI backs up a populated synthetic installation from the distribution branch and restores it into an empty PostgreSQL database. It checks laboratory history and downloads on the restored copy before and after applying the candidate migrations. At both stages, PostgreSQL must reject updates and deletions on a baseline audit event, custody event, issued report version and stored report PDF. It must also reject changes and deletions on a result worksheet and one of the original readings used in its calculation. The rehearsal checks two result revisions: PostgreSQL must reject a change to the observation text on an open revision, a change to the review note on an approved revision, and deletion of either revision. Receipt checks cover orders, samples and containers, including the history of a corrected sample ID and a custody transfer. The rehearsal also compares every baseline method version, analyte and test definition. An approved result must still use its original definition after the method is retired and the replacement version receives a different reporting limit. For quality control (QC), the rehearsal checks that a failed observation, its corrective action and the corrected observation retain their values and links. For subcontracted work, it checks the external laboratory’s original and corrected source PDFs and the transcription cited by each issued report version. It also checks that the owning client can download the original electronic data deliverable (EDD) ZIP for an issued report after restore and again after migration. At both stages, staff must be able to download the original files attached to a synthetic equipment event and training record, plus the files attached when a nonconformance was opened and when a staff member added a note. The rehearsal also checks that a client account is denied access to each attachment. Open the successful GitHub Actions checks run and read the application job summary for the two tested commits, verified record counts, database migrations, changes to locked package versions and technical notes added or revised in the candidate changelog. To keep a copy, download the upgrade rehearsal artifact from that run. The report also lists how many files of each kind passed integrity checks on the migrated copy. A zero identifies a category the synthetic database did not exercise. The downloadable report links to the candidate’s changelog entries, recovery instructions and acceptance checks.

After restoring a backup, run python manage.py verify_stored_files against the restored database to check stored documents, attachments and original result import files. The command checks the database’s migration history before scanning files. Missing or unknown migrations stop the check. Use the application version that created the backup to verify a restore. The command checks all categories as of its first database read. Files committed during the scan appear on the next run. For each issued report version, the command checks the PDF and frozen results against the original release or amendment event. If the version names a laboratory logo, the original image must still be present with the image type and dimensions recorded at issue, even after the laboratory changes its logo. The command also flags an event whose issued version is missing. For issued and voided invoices, it checks the PDF, invoice number, issuer and issue time against the original issue event. A void must preserve that issue time and issuer, and record who voided the invoice and why. A surviving issue or void event can also identify an invoice lost along with its draft. For an electronic data deliverable, it checks that the original export event identifies the same ZIP and issued report version. For subcontracted tests, it checks each original and corrected source PDF against the history of the external result entered by staff. For equipment and staff training attachments, it compares the filename and checksum with the original recording or correction event. A surviving audit entry can identify a missing file even when the restored database has also lost the equipment event or training record. For nonconformance notes, the check compares the attachment checksum, note ID, nonconformance and staff member with the audit entry made when the note was added. New opening and status entries also identify any file attached to that step. For earlier attachments on those steps, use the file inventory saved with the backup. Add --format json to save a machine-readable summary. To detect a file and its record disappearing together, save a file inventory with --format manifest when you take the backup and pass it to --compare-manifest source-files.json on the restored database before upgrading. Use the application version that produced the inventory. Add --format json to save a comparison report for a recovery script. It identifies categories with changed counts or digests and reports when a file failed verification. Only a match exits successfully.

On a backup host with the source application and PostgreSQL 17 client tools installed, run python manage.py backup_with_inventory --output /private/backups/new-directory. Add --jobs 4 to dump tables in parallel to a directory archive. With either archive format, the file inventory, record counts and history trigger inventory match the snapshot used for the dump. After restoring, point DATABASE_URL at the restored copy and run python manage.py verify_paired_restore --inventory-dir /private/backups/new-directory. It verifies the stored files and compares all three inventories in one read-only transaction. If you run pg_dump separately, pass the same exported snapshot ID to pg_dump and all three verification commands with --snapshot. See Taking a backup with a matching file inventory.

After installing, and after each upgrade, run python manage.py run_acceptance --operator "Your Name" --output /path/to/new-directory and keep the evidence package it writes. It checks the first journey on synthetic records in a separate scratch database, never the laboratory's own; see Operations.

Sign in at /accounts/login/. The owner manages users and group membership at /admin/. Signed-in users may optionally enrol an authenticator app from the account menu's "Two-factor authentication" page (/accounts/2fa/). MFA is not enforced; the laboratory chooses its enforcement and account-recovery policy. Assign operational roles to staff; create clients/projects before linking portal accounts. For a portal user, select its client and leave staff/superuser flags, groups and permissions empty. The first owner has the admin role; createsuperuser alone does not assign a laboratory role.

Role Work it enables
admin Configure the lab and perform project-manager, custodian, analyst and reviewer work; independent review and all data-integrity checks still apply
project_manager Maintain clients/projects, receive samples and prepare reports
custodian Receive samples, record custody and resolve dispositions
analyst Perform analytical work and enter results/QC
reviewer Independently review results; never own work
approver Bundle for explicit report-release permission; may also be assigned to a reviewer

Operational admin access applies only to active internal accounts in the admin group. It does not add group memberships or grant accounts.authorize_release. Admins cannot review their own work; release still requires explicit permission. Client-linked accounts never gain internal access.

Before the first receipt:

  1. In Catalog, create method versions and analytes, then tests with their matrix, unit and reporting limit, using your laboratory's approved configuration.
  2. In QC configuration, set holding-time rules, QC requirements, limits and qualifiers for each method version. Creating a new method version does not copy this configuration.
  3. Have a project manager create the client and project, then receive the COC and its samples. Assign independent review and explicit release authority to the appropriate staff first.

Steps 1 to 3 can also be loaded from spreadsheets under Setup → Spreadsheet import: one CSV file per record type, previewed row by row and saved all or nothing through the same checks as manual entry. The page offers starter files for common EPA, Standard Methods and SW-846 entries, read from 40 CFR 136.3, EPA method documents and SW-846 on the date each file states. They are starting points, not laboratory policy: check every row against your methods, permits and current rules, and edit the file before importing it.

Before the first report, an administrator records the laboratory's address, contact details, logo and certificates under Setup → Laboratory profile. New reports print them; a certificate is printed only when it is marked for printing and the report is issued within its recorded validity. The application does not check results against a certificate's scope.

Account administration requires a superuser and is separate from laboratory roles. To add a role to an existing owner from the service shell, use setup_lab --admin-username owner --role admin (or another role); this adds membership without removing other roles or restoring permissions.

Deploy to Render

Deploy to Render

The Blueprint packages a Docker web service and PostgreSQL 17. It creates paid resources: review and accept the current charges in your Render account before deploying. For a private fork, authorize Render's GitHub App to access the source. Distributed instances do not automatically deploy upstream changes.

The Blueprint generates SECRET_KEY and wires DATABASE_URL. The app derives its allowed host and trusted HTTPS origin from Render's RENDER_EXTERNAL_HOSTNAME; no manual origin input is needed for the Render domain. Set comma-separated ALLOWED_HOSTS and CSRF_TRUSTED_ORIGINS for additional custom domains/origins. HTTPS and secure cookies are enabled when DEBUG=false. Set SMTP settings/EMAIL_BACKEND for real invitation/reset mail; the packaged default disables mail delivery until configured. In the service shell, run python manage.py setup_lab --lab-name "Your Lab Name" --admin-username owner --admin-email owner@yourlab.example and follow the laboratory setup steps. Never embed passwords in the image or Blueprint.

Build collects static assets; pre-deploy runs migrations once. Health endpoints are /health/ (process) and /ready/ (database). No user uploads should be written to the ephemeral filesystem. Back up PostgreSQL, retain encrypted off-provider exports, and prove restoration before real use; see Operations. Use compatible staged migrations: redeploying old code does not roll back a changed database.

Authenticated validation, without provisioning: DO_NOT_TRACK=1 render blueprints validate render.yaml after render login and workspace selection. See Render's deploy button documentation.

Documentation

Document What it covers
Workflow rules and limits What each workflow does and the limits to know before relying on it
Product scope What the product must do, the domain rules behind it and their sources
Roadmap What is built, what comes next and what is being explored, without dates
Architecture Stack, integrity and authorization design, deployment shape
Operations Backup, restore, recovery, acceptance runs and logs for a self-hosted deployment; running a public demonstration
UI standards Layout, navigation, table and form conventions
Third-party notices Licences of bundled and required components

Inside the application, the documentation icon at the top right opens help for the current page.

Contributing

Contributions are welcome. Read CONTRIBUTING.md for the ground rules, setup and checks, and the Code of Conduct. Report security problems privately as described in SECURITY.md. AGENTS.md holds the working rules for AI coding agents.

Project and support

OpenBGA Environmental LIMS is part of OpenBGA and an open-source project of BGASoft, a laboratory software company.

Community use. The software is free: there is no licence fee and no per-user or per-module pricing. The source is published under the AGPL-3.0-only licence, so anyone may use, study, change and share it under that licence. It is provided as is, and the project does not include a support commitment: issues and pull requests are welcome and are answered on a best-effort basis.

Enterprise support. BGASoft offers optional paid hosting, support, implementation and validation services for organizations that run this software; see OpenBGA at BGASoft and open-source support. Are you looking for support? Contact bgasoft.com. Please do not use GitHub issues for support requests of that kind.

Licence

Copyright (C) 2026 BGASoft Inc. and OpenBGA contributors.

OpenBGA Environmental LIMS is licensed under the GNU Affero General Public License version 3 only (AGPL-3.0-only); see LICENSE and NOTICE. If you run a modified version for users over a network, AGPL section 13 requires offering them its source: set SOURCE_CODE_URL to your published source so the "Source code" link in the application footer points to it.

OpenBGA, OpenBGA Environmental LIMS and their logos are trademarks of BGASoft Inc. The licence does not grant permission to use them (AGPL-3.0 section 7(e)), except as needed to describe the origin of the software.

Dependency licenses remain their respective owners' terms; preserve notices when distributing (see Third-party notices).

About

OpenBGA Environmental LIMS: free, open-source laboratory information management for US environmental testing laboratories

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages