# Methods: sample-stability 1.0.0

This file says how the dataset was built, in enough detail to rebuild it and get the same numbers.
All searches and downloads were made on 2026-11-25.

Raw files are not distributed. The scripts keep them in a directory named `_raw/` that sits next to
this repository (`../_raw/` from the repository root); paths below of the form `_raw/...` refer to it.

## 1. Question

How long is a given analyte stable in a given specimen and tube, under a given processing state, at
room temperature, 2–8 °C, −20 °C, −80 °C, after freeze–thaw cycles, and with delayed centrifugation?
One row in the dataset is one published finding that answers part of that question.

## 2. Search

Source: the Europe PMC REST API (`https://www.ebi.ac.uk/europepmc/webservices/rest/search`,
`resultType=core`). Script: `scripts/search_europepmc.py`. Raw responses are cached in
`_raw/europepmc/search/` (one JSON file per query, named by the SHA-1 of the query).

Queries (all restricted to `OPEN_ACCESS:y AND HAS_FT:y` unless the journal is fully open access):

1. `TITLE:"stability" AND (TITLE:"analytes" OR TITLE:"biochemical")`
2. `TITLE:"stability" AND JOURNAL:"Biochem Med (Zagreb)"`
3. `TITLE:"freeze-thaw" AND (TITLE:serum OR TITLE:plasma)`
4. stability or storage AND complete blood count / haematological / full blood count (title)
5. delayed centrifugation / delayed separation / delay in centrifugation / time to centrifugation / delayed processing (title)
6. long-term AND stability AND serum / plasma / biobank (title)
7. dried blood spot AND stability (title); and dried blood spot with HbA1c, 25-hydroxyvitamin D, CRP,
   cholesterol, TSH, ferritin or testosterone (any field, DBS in title)
8. stability or storage AND HbA1c, vitamin D, PTH, insulin, cortisol, ferritin, B12, homocysteine,
   troponin, NT-proBNP or glucose (title)
9. stability or storage AND coagulation, prothrombin, APTT, fibrinogen or D-dimer (title)
10. stability or storage AND hormone, immunoassay or endocrine (title)
11. stability AND thyroid, lipids, lipoproteins, ammonia, bilirubin, electrolytes, potassium, folate,
    iron, AMH, testosterone, estradiol or prolactin (title)
12. stability, stable or storage (title) in laboratory-medicine journals (J Clin Lab Anal, Ann Lab Med,
    Pract Lab Med, Clin Chem Lab Med, Clin Biochem, Scand J Clin Lab Invest, J Lab Physicians,
    Ann Clin Biochem, EJIFCC, Lab Med, Clin Chim Acta, J Med Biochem, Diagnostics, Clin Lab)

The exact query strings are in the cached JSON file names' source: rerun
`python3 -I scripts/search_europepmc.py '<query>'` to reproduce a listing.

Titles were screened by hand. Kept: human blood (or urine) specimens, a storage, freeze–thaw or
delayed-centrifugation design, and a clinical-laboratory analyte. Dropped at title stage: animal
studies, drug assays, blood products for transfusion, non-blood fluids, and unrelated uses of the word
"stability". Papers that were downloaded and read but gave no rows, or whose rows were left out after
the checks in §4, are listed with the reason in `data/excluded_sources.csv`. Title-stage drops are not listed one by one;
the cached search responses let anyone repeat the screen.

PubMed and Crossref were not used for discovery in this version: Europe PMC indexes PubMed records, and
only papers with readable open-access full text could be used (see §3). Crossref is used to verify
every DOI (§6).

## 3. Full text

For each candidate, the Europe PMC full-text XML
(`https://www.ebi.ac.uk/europepmc/webservices/rest/<PMCID>/fullTextXML`) was downloaded to
`_raw/europepmc/fulltext/` and rendered to plain text by `scripts/fetch_fulltext.py`. The renderer
keeps the section headings, paragraphs, and every table row (cells joined by ` | `), including tables
in `<floats-group>`. Tables that exist only as images are marked and were not used.

No value was taken from an abstract alone. No value was read off a chart.

## 4. Extraction

Each paper was read in full (Methods for the criterion, n, tubes and temperatures; Results and all
tables). Findings were entered into one curated sheet per paper, `extraction/<PMCID>.csv`, following
`extraction/EXTRACTION_PROTOCOL.md`. In the distributed sheets, quotes are blank for sources not
licensed CC BY or CC0 (see `LICENSE`). The protocol fixes:

- the allowed values for specimen, processing, condition, temperature category, result and
  criterion type;
- how to record the longest stable duration (`stable_for`), the first failing duration
  (`unstable_at`) and the longest duration tested (`max_tested`);
- that the paper's own criterion is used; where a paper prints per-time-point deviations and a limit
  but no verdict for an analyte, the limit is applied to the printed numbers and the row says so in
  `notes`;
- that a deviation which crosses the limit and later returns within it still counts as the first
  failure;
- `result = stated-limit` when the paper states a limit (from a regression, or as a claimed
  stability) but not the measured time point at which the criterion failed. These rows have no
  `unstable_at`. No failing time point was made up to fill that gap.

Every curated row carries `evidence_quote`, a verbatim substring of the rendered full text (usually a table
row). The build fails if any quote is not found in the text after Unicode NFKC normalisation,
whitespace collapsing, lower-casing, and mapping of the minus sign and dashes to "-". All quotes,
including those later withheld for licence reasons, passed this check before release. In the public
build, rows with a withheld quote have nothing to check; the build prints how many rows it skipped
and runs every other check on them.

Rows were checked by machine (quotes, enumerations, duration logic) and then in a second reading
pass: 26 randomly chosen rows (one from each of 26 sources) plus about 80 targeted rows from the
papers with the most interpretation were compared with the source text. Rows whose design did not
support a stability verdict were removed at that stage (see `data/excluded_sources.csv`). Where a
reading was uncertain, `notes` says so and names the table or figure to check. No study-quality
assessment (for example against the EFLM WG-PRE CRESS checklist,
https://doi.org/10.1515/cclm-2020-0061) was done.

## 5. Derived fields

- Durations are parsed by `build.parse_duration`: min = 1/60 h, h = 1 h, day = 24 h, week = 168 h,
  month = 730.5 h (30.4375 days), year = 8766 h (365.25 days). Freeze–thaw findings use cycles, and
  their hour fields are empty.
- Measured matrix: serum for `serum`, `whole-blood-clotted` and `capillary-serum`; plasma for
  plasma specimens and for whole blood held before centrifugation; whole blood for uncentrifuged
  storage (CBC, HbA1c); otherwise the specimen.
- LifeFrom markers whose definition names a specimen or fasting state (`build.MARKER_SCOPE`: e.g.
  `potassium-serum`, `sodium-serum`, `creatinine-serum`, `glucose-fasting`, `fasting-insulin`) get
  a specimen-neutral `analyte_key` (e.g. `potassium`, `glucose`). `marker_slug` is set only when the
  measured matrix matches and, for fasting markers, when the paper states the samples were fasting
  (`extraction/fasting_state.csv`, with a verbatim quote checked against the full text; blank, as
  above, for the two sources not licensed CC BY or CC0). Otherwise
  the marker goes in `related_marker_slug` and `marker_match` says why it is not exact.
- First authors and `source_label` come from the article's own JATS XML. Each is checked against
  Crossref; for three Biochemia Medica articles Crossref's deposited author order differs from the
  article and Europe PMC, and `sources.csv` (`first_author_check`) records this.
- `analyte_key` is otherwise the LifeFrom `marker_slug` when the measurand matches one in the
  LifeFrom release 1 marker list (`_raw/lifefrom-release-1/markers.csv`); otherwise it comes from `extraction/analyte_keys.csv`,
  which maps reported names of unmatched analytes (coagulation factors, ROTEM, carotenoids, cell
  population data, etc.) to one key and display name; otherwise a slug of the reported name.

## 6. Sources and DOIs

For each PMCID the Europe PMC core record (cached in `_raw/europepmc/core/`) gives the DOI, licence
and open-access flag. Each DOI is looked up at `https://api.crossref.org/works/<doi>` (cached in
`_raw/crossref/`). The build stops if Crossref has no record or if the Crossref title and the Europe
PMC title differ (difflib ratio below 0.85 after normalisation).

## 7. Summary table

`data/summary.csv` groups findings by analyte_key × specimen × processing state × condition × temperature (for
temperatures outside the four standard bands, by the reported temperature). For each group:

- per study, the study's shortest stable duration across its rows (different tubes, processing
  states or criteria) and its earliest failure;
- `shortest_stable`: the minimum over studies (conservative);
- `longest_stable`: the maximum over studies;
- `earliest_failure`: the earliest failing duration reported by any study;
- `n_studies_consistent`: studies that did **not** report stability at or beyond the earliest failure
  reported by another study in the group;
- `agreement`: `single study`, `all consistent`, or `conflicting`;
- `shortest_criterion_type`: the criterion type(s) behind the shortest value. A purely statistical
  criterion (`stat-significance`) often gives a much shorter limit than a clinical one.

Tube is not part of the grouping key, so a group can mix, for example, two brands of gel tube.
Every summary row has `study_quality_assessed = no` and a caveat that it is not a recommended limit. Read the findings rows before relying on a summary value.

## 8. Rebuild

```
cd sample-stability
python3 -I scripts/fetch_fulltext.py $(ls extraction/PMC*.csv | xargs -n1 basename | sed 's/.csv//')
python3 -I scripts/build.py
uv run --with pytest pytest -q
```

`build.py` fetches any missing raw file into `../_raw/`; `--offline` makes it fail instead. The
marker join needs `../_raw/lifefrom-release-1/markers.csv`. Tests that need raw files skip when
they are absent.
