Systems and records
Testing laboratory sample custody: keeping the chain in a dataset
By SourceX Editorial · Reviewed by Noah Loul ·
9 sections
Short answer
Each laboratory sample record in a dataset should carry a stable pseudonymous sample key, the sample's matrix and collection time, every custody transfer with who, when and condition, the receipt check, the method and version used, links to results and the audit trail, and a rights basis showing the client allows the use. A validator rejects records with gaps in custody, missing receipt condition or no rights basis.
License terms
Testing laboratory sample
Key takeaways
- A result without its custody history cannot show the sample was the one collected, held correctly and tested in time, which is the context a model needs to learn laboratory work.
- Laboratories already record most custody evidence on chain-of-custody forms, receiving logs and LIMS audit trails; the job is to carry it into each record.
- Keep identity and custody fields separate from rights fields, and require both before a record enters a dataset.
- Run validator checks in a fixed order and keep a failing fixture that trips each check once.
- Records with a broken chain are not deleted; they are flagged and kept out of the default training split.
What chain-of-custody evidence should accompany laboratory sample records?
Each record should carry enough evidence to answer four questions without opening the lab's systems: which physical sample this was, who held it from collection to analysis, what condition it arrived in, and whether the client's terms allow the record to be used. If a record cannot answer one of them, it is either flagged or left out.
In practice that means a sample identity block (pseudonymous key, matrix, collection time, container and preservation), an ordered list of custody events (relinquished by, received by, date and time, condition notes), a receipt check (seal, temperature, container count, hold time), a method block (method identifier and version, analysis time), links to result records and the audit trail, and a rights block (client agreement reference, permitted use, confidentiality treatment).
This page covers nonclinical testing administration: environmental, materials, food, product and industrial testing. Clinical specimens and tests on individuals, such as workplace drug tests, carry health and personal data rules that need their own review and are outside this manifest.
Why a results table without custody makes a weak training example
A results table tells a model what was measured; the custody record tells it whether the measurement can be trusted. Laboratory staff reject or qualify results every day because a seal was broken, a cooler arrived warm, a hold time was exceeded or a signature is missing. A generic example that pairs a sample ID with a number misses the operating constraint that drives those decisions.
ASTM's guide on sample chain-of-custody procedures frames the purpose as accountability for and documentation of sample integrity from collection until disposal, and presents a list of possible program elements rather than one fixed program. That matches what a dataset needs: not one standard form, but enough elements per record to show integrity was kept or show where it was lost.
The custody fields are also what make the records useful for AI work beyond prediction of results. Tasks such as checking a chain-of-custody form for gaps, deciding whether a sample may be analyzed on receipt, or drafting a qualifier for a late sample all depend on the custody evidence, not on the result value.
Which custody events does a laboratory already record?
Most of the evidence already exists, spread across paper or scanned chain-of-custody forms, receiving logs and the laboratory information management system. The manifest's job is to collect it per sample, not to create new records.
EPA's quality assurance handbook for ambient air monitoring recommends a chain-of-custody form that tracks samples through storage, processing and analysis, signed by each person who relinquishes or receives them, and EPA's sample receiving guidance asks the receiver to print and sign their name and record the date and time of receipt. For nonclinical studies under FDA's Good Laboratory Practice rule, specimens must be identified by test system, study, nature and date of collection, on the container or accompanying it. Where records are electronic and covered by FDA's Part 11, audit trails must be secure, computer-generated and time-stamped, and changes must not obscure what was recorded before.
Two practical points decide how much of this can be carried. First, scanned custody forms are evidence even when their fields are not transcribed: reference each scan by file name and a SHA-256 digest from the record, so a reviewer can open the original. Second, transcribe only the fields the validator needs, with role labels in place of names, and keep the scans inside the laboratory unless the rights review allows them to travel with the dataset.
| Custody event | Where it is usually recorded | Fields to carry | Why it matters |
|---|---|---|---|
| Collection | Field chain-of-custody form, sampling log | Collector, date and time, location code, matrix, container, preservative | Starts the chain and the hold time clock |
| Each transfer | Relinquished by and received by blocks on the form | Both parties, date and time, seal number | Shows no unaccounted gap between holders |
| Receipt at the lab | Receiving log or sample receipt checklist | Receiver, date and time, temperature, seal intact, container count | Decides whether the sample may be analyzed |
| Login | LIMS sample registration | Lab sample ID, client project, requested tests | Links the physical sample to its digital record |
| Storage and internal moves | LIMS location history or internal custody log | Location, date and time, person | Shows correct storage between receipt and analysis |
| Analysis | Instrument run log and LIMS result entry | Method and version, analyst, run date and time | Ties the result to a method and the hold time |
| Edits and approvals | LIMS audit trail | Who changed what, when, with reason | Shows results were not silently altered |
| Disposal | Disposal log | Date, method, person | Closes the chain |
The sample identity and custody fields
These ten fields make up the identity and custody half of the manifest. Values shown are illustrative. Use a pseudonymous sample key generated for the dataset rather than the lab's own sample ID, and keep the mapping inside the laboratory.
At a glance
The sample identity and custody fields
Identification follows the same logic as laboratory reporting: ISO/IEC 17025 expects reports to give a description and unambiguous identification of the item and, when necessary, its condition. The manifest simply makes that identification and condition machine-checkable for every record.
| Field | Definition | Illustrative value | Validation rule |
|---|---|---|---|
| sample_key | Pseudonymous, stable key for the sample in this dataset | SK-000481 | Unique; not equal to the lab sample ID |
| matrix | Sample type from a controlled list | groundwater | Value in the controlled list |
| collected_at | Collection date and time with time zone | 2025-03-04T09:15-05:00 | Present; earlier than every custody event |
| container_preservation | Container type and preservative | amber glass, HCl, 4 C | Present; consistent with the method's requirement |
| custody_events | Ordered list of transfers: from, to, timestamp, seal | 2 transfers, roles only | Each receiver equals the next relinquisher; times increase |
| receipt_check | Receiver role, time, temperature, seal, container count | 4.1 C, seal intact, 3 of 3 | All parts present; out-of-range values flagged |
| hold_time_status | Whether analysis began within the method hold time | within | Computed from collected_at and analyzed_at |
| method_ref | Method identifier and version used | Method 8260, rev D (illustrative) | Present; version recorded |
| result_refs | Keys of the result records produced | R-11902, R-11903 | Each key resolves to a result record |
| audit_trail_ref | Pointer to the LIMS audit entries for this sample | AT-SK-000481 | Resolves; no edit without a reason |
Which rights and confidentiality fields keep the manifest licensable?
Custody proves the record is trustworthy; it says nothing about whether it may be licensed. Laboratory results usually belong to a client relationship, and ISO/IEC 17025:2017 added language on confidentiality of customer information and laboratory data. The rights half of the manifest records, per sample, which agreement governs it and what that agreement allows.
These fields are filled in after a rights review of the client agreements, not guessed from the data. A record with no rights basis does not enter the dataset, however complete its custody.
- client_agreement_ref: the master services agreement or terms template that governed the work, by reference, never the client's name.
- permitted_use: what that agreement allows for the laboratory's own use of results and records, as confirmed by the reviewer.
- client_identifiers_removed: confirmation that client names, project names, sampling addresses and sampler names are removed or replaced by role labels.
- location_generalization: how precisely location is kept, for example a region rather than coordinates, since a site can identify a client.
- regulatory_program: whether the work was done under a regulatory program whose records carry their own retention or disclosure rules.
- exclusion_flags: clinical, personal or otherwise out-of-scope samples, which are excluded before export.
- rights_reviewed_by and rights_reviewed_on: the role that confirmed the rights fields and the date.
Validator checks: the order a record must pass
Run the checks in this order, and stop the record at the first failure so the error message points to one cause. Keep a failing fixture, a small file of records that each break one check, and confirm the validator rejects every one before trusting it on real data.
Steps
Validator checks: the order a record must pass
- V1 Schema: every required field is present and typed correctly.
- V2 Identity: sample_key is unique and does not equal or embed the lab sample ID.
- V3 Rights: client_agreement_ref, permitted_use and rights_reviewed_on are present, and no exclusion flag is set.
- V4 De-identification: no client name, address, sampler name or free-text field with those values remains.
- V5 Custody order: collected_at precedes the first custody event, timestamps increase, and each receiver is the next relinquisher.
- V6 Receipt: receipt_check is complete; temperature or seal problems set a condition flag rather than failing silently.
- V7 Hold time: hold_time_status is computed and matches collected_at and the analysis time.
- V8 Links: every result_ref and the audit_trail_ref resolve within the package.
- V9 Audit: no result edit in the linked audit trail lacks a reason or an approver.
One sample that passes and one that fails, side by side (illustrative)
Both records below are constructed; they show how the same structure passes or fails. The failing record has three defects, and the validator reports the first one it meets in order, V3, so the fixture should also include single-defect versions to test V5 and V6 separately.
Read the failing record the way a reviewer at the lab would. The courier never signing as relinquisher is the kind of gap that a receiving clerk notices only if the form is checked line by line, and a missing temperature is often a blank cell rather than a bad value. Both are common in real custody records, which is why the fixture should mirror them rather than use invented edge cases.
| Field | Valid record | Failing record | Check that catches it |
|---|---|---|---|
| sample_key | SK-000481 | SK-000522 | Passes V2 in both |
| client_agreement_ref | MSA template 2023 | missing | V3 Rights fails |
| custody_events | Sampler to courier 11:40, courier to receiver 15:05 | Sampler to courier 11:40, receiver signs 15:05, courier never relinquishes | V5 Custody order fails: receiver is not the next relinquisher |
| receipt_check | 4.1 C, seal intact, 3 of 3 | temperature blank, seal intact, 2 of 3 | V6 Receipt fails: incomplete check and missing container |
| hold_time_status | within | within | Passes V7 in both |
| result_refs | R-11902, R-11903 | R-12011 | Passes V8 in both |
Broken chains: flag, separate or exclude?
A record with a broken chain should be flagged and kept out of the default training split, not deleted. Laboratories see broken chains for ordinary reasons, and records that show how staff handled them, with qualifiers, re-sampling requests or rejection, are valuable examples of the specialist judgment a generic dataset lacks.
Use three states. Intact records pass every check and go into the main split. Qualified records have a documented problem, such as a warm cooler or a late analysis, and a recorded lab decision; they go into a separate split with the condition flag and the decision. Broken records have an unexplained gap, such as a missing transfer; they are excluded from training splits and may be kept only as labeled negative examples if the rights basis allows.
Never repair a chain inside the dataset. If the laboratory finds the missing signature in a scanned form, the correction belongs in the lab's own records with its audit trail, and the dataset is regenerated from there.
Laboratory records in a licensing assessment
A laboratory that can produce this manifest for even one matrix and one year of work has done most of the preparation a licensing review asks for. For laboratories that take it further, SourceX covers sourcing, rights review, contracting, preparation, delivery and payment, and the opening step is a brief assessment with no uploads.
The laboratory approves the scope and terms and signs before any records are delivered. Large packages, such as scanned custody forms and instrument files, can stay in the laboratory's own storage or ship on encrypted drives rather than being hosted by SourceX.
Frequently asked questions
What fields should a chain-of-custody record for a lab sample include?
At minimum: sample identity, collection date and time, container and preservation, each transfer with who relinquished, who received and when, and the receipt condition. For a dataset, add the method and version, links to results and the audit trail, and a rights basis.
Can laboratory test results be used in an AI training dataset?
Only when the client agreements and any program rules allow it and the records are de-identified. Results usually sit inside a client relationship, so a rights review of the governing agreements comes before any export. Clinical specimens and tests on individuals need separate review.
How do you show a chain of custody in a LIMS export?
Export the sample's location and custody history and the audit trail alongside the results, and link them by a stable sample key. Scanned custody forms can be referenced by file and digest. The validator then checks that transfers are complete and in order.
Should samples with a broken chain of custody be removed from the dataset?
Not deleted. Flag them, keep qualified samples with a documented lab decision in a separate split, and exclude unexplained gaps from training splits. Corrections belong in the laboratory's own records, not in the dataset.
Why use a pseudonymous sample key instead of the lab's sample ID?
The lab sample ID can often be traced back to a client, a project or a site. A key generated for the dataset keeps records linkable inside the package while the mapping stays with the laboratory.
Sources
- FDA's Good Laboratory Practice rule requires specimens to be identified by test system, study, nature and date of collection, on or accompanying the container. Source
- FDA's Part 11 requires secure, computer-generated, time-stamped audit trails, and record changes must not obscure earlier entries. Source
- EPA's QA handbook recommends a chain-of-custody form tracking samples through storage, processing and analysis, signed by each person who relinquishes or receives them. Source
- EPA sample receiving guidance asks the receiver to print and sign the custody form and record the date and time of receipt. Source
- ASTM D4840 describes chain-of-custody procedures that document sample integrity from collection to disposal and lists possible program elements. Source
- A NIST crosswalk of ISO/IEC 17025 lists unambiguous identification of the item and, when necessary, its condition as a reporting element. Source
- NIST notes ISO/IEC 17025:2017 added language on confidentiality of customer information and laboratory data. Source
See if your company qualifies
A short company assessment. No data uploads are needed.