Docs/Build a dataset

Design and validate a dataset

Define records, identities, quality gates and capacity before scaling a collection.

Download .md
Developers6 min read8 sections
Source reference · Match your SDK version. Availability and known issues
In this guide

Write a record contract first

A useful dataset has an explicit unit of observation. “One million data” can mean a million pages, directory rows, documents or text chunks. These require different workloads and cannot share a single requests-per-second claim.

DecisionResearch exampleWhy it matters
Record unitOne proposal or organizationPrevents counting both cards and detail pages as new entities
Stable identityCanonical URL or source-issued IDSupports deduplication and later comparisons
Required fieldsID, title, source URLRejects unusable rows instead of filling them silently
Optional fieldsPublished date, categoryRepresents missing data without invented values
CoverageAll directory rows; first 20 documentsMakes the sampling boundary visible
Update policyMonthly immutable snapshotsSeparates resume from refreshing stale records

Use the right collection path

Code pathUse it forCurrent boundary
DatasetJobURL file → validated, deduplicated JSONL/CSV shardsSingle writer, local state and bounded checkpoint batches
Crawler / Dataset builderSmall discovery jobs and interactive extractionReturned collections can grow in memory; not the million-record export path
DatasetStream (Rust)Your own producer feeding a bounded export queueAdvanced streaming API; not DatasetJob checkpoint semantics
Playwright / PuppeteerDiscover links or inspect JavaScript-rendered contentRendered DOM is not passed automatically into Python/Node DatasetJob
Source API or bulk dataAlready structured research metadataUse its own ingestion client; HTML selectors do not parse API JSON

Choose selectors and quality rules

Select a repeated container with row_selector for a directory page; omit it for one record per document. Each field is resolved within the record’s container. Make identifiers required before enabling deduplication on them.

data_type validates and normalizes string values; integer, float and boolean values are still exported as strings. Convert types explicitly in pandas, SQL or your application. Defaults should encode an intentional value, not hide a missing required identifier.

Use normalize_whitespace=true for prose metadata. Disable it for content where whitespace matters, but verify extraction: this is not a lossless HTML or source-code archive. Avoid broad body selectors that collect menus and footer text.

{
  "fields": [
    {
      "name": "source_id",
      "selector": ".record",
      "extract_type": "attr:data-id",
      "required": true
    },
    {
      "name": "title",
      "selector": ".record-title",
      "required": true,
      "min_length": 5
    }
  ],
  "dedup_fields": [
    "source_id"
  ]
}
json19 lines · copy-ready

Deduplication is an identity decision

With no dedup_fields, the job compares all extracted field values, excluding _source_url and _row. With dedup_fields, it compares only those fields. This is exact comparison, not fuzzy matching or semantic deduplication.

A title alone is rarely a safe key: unrelated publications can share a title. A URL alone may also represent a document that changes over time. Choose a source ID for a snapshot and add a version or collection identity in your derived datasets when preserving revisions.

Within one job, the first accepted value for an exact key wins. No later row merges or updates it. Across independently partitioned jobs, deduplication is separate; reconcile global identity downstream.

Establish a measurable pilot

  • Select a small set of different page templates, long documents and missing-field cases.
  • Start with concurrency 2 and a source-approved host rate. Increase only after looking at latency, errors and resource use.
  • Manually label a sample of expected fields and compare actual extraction, not just record counts.
  • Keep failure records and rate-limit responses visible. A partial dataset can be useful only when its missing coverage is recorded.
  • Repeat the unchanged job and compare shard hashes to check restart idempotence. Separately test interrupted-job recovery in a controlled environment.

Estimate one million records honestly

Start with pages_needed = target_records / accepted_unique_records_per_page. Then estimate collection time using the slower of the permitted request rate and the measured pipeline rate, with additional time for robots requests, retries, parsing, export and discovery.

At an allowed one page per second, one million single-record pages need at least 11.6 days of request time. At 20 accepted records per page, the same target needs 50,000 pages: at least 13.9 hours. These are arithmetic examples, not measured Crawlingo performance or permission to use those rates.

Output storage is approximately record_count × average serialized record size, plus error shards, exact-dedup state, temporary shards and derived datasets. One million 2 KiB records alone are about 1.91 GiB. Full documents can be far larger.

Measure a representative pilot on the intended source. A local million-record fixture proves a particular workload completes; it does not establish a universal public-web throughput or memory ceiling.

Understand what the resource limits bound

Keep checkpoint batches smaller for long documents and large keys. The engine preserves input order when processing responses, so one slow page can delay later completed pages. Parser workers, network buffers, Sled, dedup state and output buffering all contribute to memory.

SettingControlsDoes not guarantee
concurrencyIn-flight page processing for one jobAn allowed website rate or total process memory
Session rate_limit_rpsRequest pacing per host in one sessionCoordination across workers or machines
checkpoint_pagesPages represented in a checkpoint batchA fixed number of records when pages have different row counts
checkpoint_bytesPending exact-dedup key budgetA total RSS cap; exceeding it is a fatal job error
max_response_bytesJob acceptance of a fetched response bodyA job-specific streaming download cap; this check is after fetch
max_records_per_page / max_record_bytesExtraction and serialization acceptance limitsAutomatic truncation into a valid smaller document

Define a publication gate

Your application decides when a dataset is ready to publish. A useful default is: complete=true, cancelled=false, no unreviewed page failures or rejected records, expected coverage, validated identity, a manual quality sample and stable artifact hashes.

Never have two workers write one output directory. Treat local job state as recovery state, and publish immutable data shards with a manifest only after review. If some source failures are acceptable, record an explicit threshold and the missing population instead of silently marking the run successful.