All articles4 min read
Data pipelines

Timestamps that make web-data freshness measurable

Separate retrieval time, page dates and ingestion time before setting a freshness policy.

Generated editorial photograph of a researcher checking printed pages against a laptop beside a desk clock.

A page collected this morning can contain an offer that changed yesterday, an article published years ago or text copied from another page. One timestamp cannot express all of those possibilities. Give each date a defined role before using it to describe the freshness of collected web data.

Separate the clocks in the pipeline

Retrieval time records when your collector obtained a response under a stated convention. You might choose request completion as that boundary. Ingestion time records when the resulting observation entered storage. A backlog can make those moments meaningfully different.

A page's displayed publication or modification date is another field. Preserve the raw value and its location on the page when useful. Do not overwrite retrieval time with a displayed page date, or treat a missing page date as proof that the content is current.

Keep a resource's own event time separate as well. An event listing can describe a future performance while the listing itself was retrieved today. Each field should answer a specific question, rather than merely occupy a column named date.

Store an offset with an instant

A timestamp without a time-zone context does not identify one unambiguous instant. Use an offset-aware representation when you need to compare retrieval or ingestion times. A numeric UTC offset describes an offset for that timestamp; it is not a complete set of regional daylight-saving rules.

The helper below accepts Python's supported ISO-style datetime inputs, rejects values without a usable offset and converts the result to UTC. It is not a strict validator for every Internet timestamp profile.

from datetime import datetime, timezone

def utc_instant(text):
    value = datetime.fromisoformat(text)
    if value.tzinfo is None or value.utcoffset() is None:
        raise ValueError("timestamp needs an explicit offset")
    return value.astimezone(timezone.utc)

For example, two inputs with different offsets can represent the same instant. Test equality after conversion instead of comparing their original strings. Keep the original representation when you need to explain how a date was interpreted.

If a page provides only a local date or an ambiguous local time, record that limitation. Do not silently attach UTC just to make a validator accept the field. Any interpretation rule should follow the page's context and be visible to downstream consumers.

Measure the age you actually know

Observation age is the difference between a defined reference time and the relevant collection timestamp. It tells you how long ago the observation was made. It does not prove that the underlying content was recently changed or that the observation remains true now.

Record when an answer or export was produced if users need that distinction. A collection may have been acceptable when retrieved but exceed its freshness budget before the result is delivered. Monitor ingestion lag separately so that a queueing problem is not mistaken for a slow crawl schedule.

Check for timestamps unexpectedly far in the future or for inconsistent ordering under your pipeline's clock conventions. Investigate clock synchronization and parsing before treating a negative age as valid fresh data. A timestamp's presence alone is not evidence that its value is correct.

Set freshness budgets by use case

A documentation archive and a stock-availability monitor can need different refresh policies. Choose a budget from the decision being supported, the expected rate of change and the collection constraints. Do not apply one arbitrary interval to every field and market.

When an observation exceeds its budget, decide explicitly whether to refresh, omit it or label it as stale. Keep that decision separate from whether a request succeeded. A failed refresh should not automatically make an older stored value look newly observed.

For conditional requests, define how successful revalidation updates your metadata while preserving the distinction between the body originally obtained and the later validation. A validation response does not establish when the publisher last edited the content.

Test the timeline before relying on it

Use fixtures with equivalent instants expressed at different offsets, a missing offset and a delayed ingestion step. Include an observation outside its freshness budget and a failed refresh that leaves an older value available. Check the labels and decisions your downstream consumer receives.

Keep collection timestamps with export manifests and checkpoints, and document the boundaries used to generate them. For web-reading workflows, that metadata helps the application decide what it can responsibly use; it does not make the retrieved text inherently correct.

Contact us

Tell us what you want to collect.

See our Privacy Notice for how we handle your message.

Your message is sent to hello@crawlhub.ai. Please do not include passwords or API keys.