Scraper Bot for Real Estate Listings: Field Mapping

A web scraper built for real estate leads succeeds or fails on field mapping: turning each listing portal’s own labels, units, and formats into one consistent record that comparison tools and lead reports can use. Different portals call the same attribute by different names, quote prices in different currencies and per-area units, and split the same facts across a main listing page, an embedded brochure, and an agent contact block. This article sets out a canonical field table that covers typical residential listings, then works through the two mapping specs that decide whether the normalized data is usable: the listing identifier strategy, and the price, area, and unit normalization rules. pdf parsing covers the brochures, floor plans, and documents attached to some listings, where extra fields often appear.

The canonical listing field table

The shared schema separates core listing facts, location attributes, property details, contact and attribution fields, and source-specific extension attributes. Core fields are populated from every source; extension fields hold attributes that appear on some portals but not others, so a new source can add a detail without changing the core model.

Canonical field Typical source labels vary as Normalization notes
Listing identifier Portal ID, listing reference, property code Source-prefixed key; not reused across portals
Property type Apartment, house, condo, villa, townhouse, plot Mapped to a controlled vocabulary per source
Listing status For sale, for rent, sold, pending, off market Normalized to a fixed status set; date tracked when status changes
Price Asking price, monthly rent, offer price Currency, amount, and price period stored separately
Area Living area, built-up area, plot size, floor area Metric value with unit recorded; imperial converted where needed
Rooms and bedrooms Bedrooms, bathrooms, rooms total, floor count Integer counts; missing values stay blank rather than zero
Location City, district, neighborhood, address, coordinates Administrative fields standardized; raw address kept in extension
Construction details Year built, condition, heating, parking, balcony Source-specific; held in extension where the vocabulary differs
Contact attribution Agent name, agency, contact channel, listing date Personal contact fields handled under documented rules
Source metadata Source URL, fetch timestamp, pipeline version Provenance attached to every record

Controlled vocabularies matter more than field names. A source that uses local category labels should map those labels to the shared property type and status lists, with unmapped values flagged for review rather than dropped silently. Extension fields should retain the source’s original label and value, so a mapping that turns out to be wrong can be corrected without rebuilding the record. The normalizer should be source-agnostic: each source maps into the same core model, and source-specific quirks live in per-source mapping rules rather than in special cases scattered through the shared code.

Spec one: listing identifiers that survive duplicates and source changes

The identifier strategy decides whether the same listing appears once or many times, and whether a returning listing can be matched to its earlier record. A stable key combines the source portal identifier with a source prefix, so two listings from different portals that happen to share a numeric code never collide. The portal’s own listing reference is usually present on the listing page and in its URL; where a source has no stable ID, a derived key from a stable combination of URL path, address, and price snapshot can substitute, with the method recorded in the mapping rules.

Duplicate handling distinguishes two cases. The same source reposting the same listing across cycles should match on the source-prefixed key and update the existing record rather than create a second copy. The same physical property appearing on two portals is a cross-source match that should not be forced by identifier alone; it can be flagged for possible match based on location and details, with a human or explicit rule deciding whether to merge. Status changes—sold, rented, relisted—should be tracked against the same identifier so the record keeps its history instead of closing and reopening as a new entry.

Identifiers also support the provenance trail required for any later audit: which source published the listing, when it was first and last fetched, and which pipeline version mapped the current fields. When a source restructures its pages, the selector repair should preserve the existing identifier mapping so repaired records do not fork into duplicate copies. The handover artifacts that make this repair possible are covered in maintaining a China-built scraper when sites change, and the identifier rules should be documented in the selector map alongside the field mappings.

Spec two: price, currency, and area normalization

Real estate data mixes price bases in a way that defeats naive numeric parsing. A sale price is a one-time amount; a rental price is a monthly period; some listings quote price per square meter or per square foot rather than total price. The mapping should store the amount, the currency, the price basis (total sale, monthly rent, per-area unit), and the price period separately, so a comparison can convert or filter correctly instead of comparing a monthly rent to an asking sale price. Currency should be read from the listing itself rather than assumed from the source’s country, because some portals list foreign-currency prices for specific listings.

Area normalization follows the same separation: store the numeric area, the source unit, and the normalized metric value. Measurements in square feet or other imperial units convert to metric with the original unit retained, and built-up area versus usable area should not be merged, because the two describe different things. Rooms, bedrooms, and bathrooms stay as integer counts, and a missing count stays blank; treating an unknown bedroom count as zero would understate the property in every comparison. Dates such as year built and listing date parse to a standard format, with implausible values flagged for review rather than corrected by guesswork.

Price-per-area calculations derive from the normalized fields rather than from raw strings, so that a source formatting its numbers with spaces, commas, or decimal conventions does not produce a wrong ratio. Where a listing includes a negotiable offer range or a price change, the original figure and the change date should be recorded; the comparison layer can decide how to treat ranges. Validation checks that catch malformed amounts, inconsistent room counts, and implausible dates are part of the pipeline described in validation pipelines for extracted data, and the normalization rules there should match the field mapping before records enter storage.

Attached documents: what pdf parsing adds to the record

Many listings attach brochures, floor plans, price sheets, or property sheets as PDF files. pdf parsing on these documents can pull additional attributes—room dimensions, finishes, amenities, floor plans, and sometimes a second price or fee schedule—that the main listing page omits. Text-layer brochures parse deterministically; scanned or image-based documents need OCR with a confidence threshold and a review path, the same split described for general document extraction. Extracted document fields should be mapped into the same extension vocabulary, with a note that the field came from an attachment rather than the page.

Documents need their own ingestion checks: the file opens, the page count matches expectations, and the attachment is actually the listing’s brochure rather than a generic agency document or an unrelated form. A document that repeats a contact name or agency detail should not override the page-level attribution without a rule for which source takes precedence. Where a brochure carries legal terms, fee schedules, or disclaimer text, those should be recorded as document content rather than parsed as property facts. The document-side accuracy standards and review workflow are detailed in PDF and scanned-document extraction bots, and the 50-page sample test should include real brochures from the buyer’s target portals.

Contact and lead fields: what the schema should and should not carry

Real estate leads often mean agent and brokerage contact information attached to a listing, not personal data about the property buyer. The schema should distinguish the listing’s public attribution—agent name, agency, public contact channel, listing date—from any private message handle, personal phone, or email that appears outside a public contact block. Fields that identify individuals should be retained only under the documented basis for the use case, with a retention window and a deletion path, and the pipeline should screen records against the same redaction rules applied elsewhere in the data program.

Buyers should confirm with their own counsel what lead contact data may be collected, stored, and reused for the intended marketing or outreach use, because public contact details on a listing page do not automatically authorize every downstream communication. The mapping rules should record which contact fields are retained and why, and any personal field dropped at extraction should be absent from exports, not merely hidden in a report view.

Mapping acceptance: sample listings checked field by field

Acceptance testing should use real listings from each target portal, not placeholder examples. Pull 50 listings per source on a fixed day, map them through the pipeline, and compare every canonical field against the live page and any attached brochure. Record fill rate, mapping accuracy per field, unmapped category labels, currency and area conversion errors, and document-extraction misses. A mapping that scores below the agreed bar on required fields should be repaired and retested before handover. The handover package should include the controlled vocabularies, the per-source mapping rules, the identifier strategy, and the document parsing configuration, so a future engineer can add a new portal by writing a mapping into an existing schema rather than redesigning the model.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *