Research Workflow

Preserve Leading Zeros in Research Identifiers

Decide which fields are identifiers

A participant code may contain only digits without being a quantity. Arithmetic on it has no scientific meaning, and its leading zeros may be part of its identity. Mark participant, specimen, site and external accession fields as text in the import specification before loading the data.

The pandas CSV reader documentation provides explicit dtype controls rather than requiring type inference. The same principle applies in spreadsheet import dialogs: choose text for identifier columns and verify the resulting stored values, not just their visual formatting.

Test irreversible conversions

Create a synthetic import sample containing 0012, 12, a long digit string and an alphanumeric code. A display format that shows four digits can make the number 12 appear as 0012, but it does not recover whether the original source was 12 or 0012. Once both have become the same number, the distinction may be lost.

Large numeric-looking identifiers can also be rounded by software with limited numeric precision. Avoid scientific notation as an identifier storage format. Preserve the original export so a failed conversion can be repaired from evidence rather than by guessing the intended number of zeros.

Audit a hypothetical merge

Suppose a registry contains two distinct authorized codes, 0012 and 12. A laboratory export imports both as numeric 12. The apparent duplicate is caused by the import, not necessarily by duplicate specimens. A subsequent join may attach both laboratory rows to both registry rows or select one unpredictably.

If 500 original codes become 498 distinct imported values, investigate every collision group. Do not pad all values to four digits unless the identifier specification explicitly defines a four-character code and the original distinction is known to be irrelevant. Padding can create a different collision rather than repair the first one.

Preserve a verifiable mapping

Record source text, imported text, expected length or pattern, and any approved conversion. Check uniqueness within the correct scope: a participant code may be unique only within a site, making the site-plus-code pair the real key.

After exporting analysis data, reopen it with the intended downstream software and verify the synthetic identifiers again. This catches a correct first import followed by a destructive export-and-reopen cycle. The final check is exact agreement of identifiers and their relationships, not a plausible row count or a column that merely looks correctly padded on screen.

Source verification: 6 November 2026. Examples are hypothetical.

Related reading

Reading path: Prepare data. Guide 19 of 50. Choose any guide to suit your project.

Research Workflow

Audit Survey Strata and Primary Sampling Unit Identifiers

Check nesting, singleton strata and design metadata before estimating survey uncertainty.

Research Workflow

Audit Unicode Differences Before Matching Text Identifiers

Separate visually similar text from exact identifier equality and document any normalization that changes matches.

Browse this reading pathTools for this stageGuides and downloads for this stage