Building a data pipeline from Chinese public sources in python rarely fails because a library is missing. It fails when the toolchain is chosen around the first source instead of the full source mix, and when the engineering team defers the operational parts until after extraction works on the demo page. The recurring mistakes follow a pattern: fetcher picked before the inventory, selectors hard-coded without fixtures, schema frozen to one source, OCR treated as plain parsing, alerts wired to an inbox instead of a routed channel, and the queue left without restart safety. Each mistake has a fix that belongs in the build checklist, and this article walks the mistake log as it typically appears in an engineering lead’s first delivery cycle, with the toolchain choices each fix implies. The article covers public sources only; it does not cover access-control bypass or usage-limit evasion.
Mistake one: choosing the fetcher before the source inventory
The first mistake is reaching for a browser-based fetcher or an HTTP-only client before the source list is inventoried. HTTP-only clients are lighter, faster, and easier to restart for pages that render from their own HTML and send structured responses; a rendered browser session costs more resources and adds a failure surface, but it is needed where the source builds the list through JavaScript or loads records through scripts after the initial page. Choosing the heavy tool first wastes resources on simple sources; choosing the light tool first forces a rewrite when a script-built source appears. The choice per source is the comparison covered in headless rendering versus HTTP-only collection, and the inventory should classify each source before the fetcher layer is fixed.
A related error is assuming one fetcher setting covers all sources. Timeouts, retries, pacing, and header conventions differ between official feeds, bulletins, and directory pages; the fetcher should hold these as per-source configuration rather than global constants. The inventory record, built before toolchain work, lists source type, access route, document format, and publication cadence, and that record drives every later tool decision instead of the other way around.
Toolchain versions and dependencies deserve the same early decision. Python runtime version, parser libraries, data-processing stack, and database drivers should be pinned in the project’s dependency files, with documented upgrade paths; a pipeline that drifts on unpinned libraries breaks when a dependency releases a breaking change. The environment should be reproducible from the repository, so a rebuild on another machine follows the runbook without guessing which versions were in use. Where the team relies on third-party components, their license terms should be recorded alongside the source inventory, especially if the delivered pipeline will be hosted or operated under the buyer’s account.
Mistake two: hard-coded selectors without fixtures and tests
The second mistake writes selectors straight into parser code with no saved fixture pages. When the source redesigns its markup, the only way to repair the parser is to reverse-engineer the live page again, and the repair breaks quietly in production before anyone notices. The fix is a selector map with one entry per source, paired with a stored fixture page per source, so a parser change can be developed against the fixture and tested against the recorded sample before touching the live source.
Fixtures should be saved from real public pages, including the awkward ones: list pages with a missing field, an empty result, and a page with an attached document. Tests assert that required fields extract from each fixture and that a changed selector fails the test loudly rather than returning nulls silently. Selectors are the most perishable part of the pipeline, and the fixture-and-test structure is what makes later maintenance possible for a team that did not write the original code.
Mistake three: schema designed around the first source
The third mistake builds the normalized schema around the first source’s fields and naming. The second source uses different names for the same concept, omits a field, or adds a field the first source never had, and the schema either rejects the new record or stretches old records to fit. The fix is a source-agnostic normalizer: the schema defines the target concepts once, and per-source mapping layers translate each source’s fields into those concepts. Source-native identifiers and source labels are retained alongside the normalized fields so a match can be corrected later without losing the original record.
Field typing, date normalization, currency and unit conventions, and timezone handling belong in the normalizer, not in downstream analysis. Records from different sources arrive in different local times and units; a comparison built before those are normalized reads convention differences as real movement. The validation pipeline that checks required fields, types, and cross-field consistency after normalization is laid out in validation pipelines for extracted records, and the schema should make those checks expressible as rules rather than ad hoc review.
Mistake four: OCR without a confidence threshold or review gate
The fourth mistake treats scanned attachments the same as digital text: run the recognition, load the fields, move on. Scanned documents lose characters at the edges, confuse similar glyphs, and merge table columns; an unflagged OCR error lands in the record set as if it were copied from the source. The fix splits ocr extraction into recognition, field extraction, and a review gate: each extracted field carries a confidence score, fields below a threshold go to a review queue, and the raw image and raw OCR text stay in short-lived staging rather than the long-term store.
Text-layer PDFs parse deterministically and should not go through the OCR path at all. The acceptance sample should come from the buyer’s own document mix: fifty real scanned pages, with the count of fields requiring human correction reported before the price and schedule are fixed. The pipeline should expose which path each record went through, so OCR-assisted fields are not counted alongside copied fields in completeness reports.
Mistake five: alerts sent to an inbox instead of a routed channel
The fifth mistake sends pipeline failures and record signals to a developer’s inbox, where they sit until that person reads mail. The alert bot layer should route by event type: feed gaps and source outages go to operations, deadline and new-record signals go to the business owner, validation failures go to the data engineering contact. A general inbox receives nothing by default. Repeated alerts for the same unresolved event are grouped, and false alarms from volatile page fragments are tuned out over the first weeks of operation.
Alert records should carry source, record identifier, event type, and timestamp, so a recipient can trace the event back to the source record. Escalation matters too: a source that stops delivering should re-alert after a set window rather than being forgotten after the first message. Channel choice, routing targets, severity tiers, and acknowledgment expectations are the subject of alerting channels and escalation for change monitors, and those rules should be set before go-live rather than added after the first missed deadline.
Mistake six: no restart safety, no queue state, no health check
The sixth mistake runs the pipeline on a single machine with an in-memory queue and no restart policy. A reboot, a deploy, or an outage loses the in-flight work; on recovery, the pipeline restarts from the beginning and produces duplicates, or it resumes from an unclear point and produces gaps. The fix persists queue state, records which records have been processed, and makes retries idempotent so a repeated run does not double-count records. A dead-man’s-switch alert fires when a source stops delivering, so silence is detected as a failure rather than assumed to mean an empty source.
Health checks should measure record count per source, null-field rate, and processing lag against the baseline, not just whether the process is alive. Capacity planning accounts for peak periods when publication volume rises; a queue that backlogs after an outage needs a documented catch-up policy that marks backfilled records and avoids repeating old alerts. The queue should keep collection bounded and paced to the source’s tolerance, and restart safety is one of the queue properties the pilot should demonstrate.
What a toolchain-ready handover looks like
A pipeline that is ready to hand over leaves the next team able to understand, repair, and operate it without the original author. The repository holds the inventory record, the selector map with fixtures, the schema and per-source mapping layers, the validation rules, the OCR review procedure, the alert routing map, and the runbook for deploy, restart, and rollback. Accounts, storage, and credentials sit in the buyer’s own cloud account where possible, with vendor operator access that can be revoked.
Acceptance checks before handover: a fixed sample of records per source compared field by field against hand-collected originals, the OCR correction rate measured on real scanned pages, restart and replay tested on purpose, and an export of accumulated records confirmed readable in a standard format. For a Chinese-built delivery, the buyer should also confirm hosting region, support timezone, and the language of operational documentation, so the team maintaining the pipeline after launch can actually read its records. When those artifacts exist, the Python toolchain choice stops being a vendor lock-in and becomes a maintainable system the buyer can operate, repair, or migrate.
Operational ownership should be named in the handover: who monitors health alerts, who reviews the OCR queue, who updates the selector map when a source changes, and who owns the retention and deletion schedule. A pipeline without named owners falls back to the original vendor whenever a source changes, which recreates the dependency the handover was meant to remove. The runbook should cover these ownership handoffs as procedures, with contact roles rather than named individuals where possible, so staff changes do not leave the pipeline without a maintainer.
Leave a Reply