4.2 KiB
4.2 KiB
09. Attom Data Solutions API for Property Record Snapshots
meta: id: core-services-09 feature: core-services-implementation priority: P2 depends_on: [core-services-01] tags: [hometitle, attom, property-records, api-integration, real-estate]
objective:
- Replace the
fetchCountyRecords()stub that returns{ ownerName: "Unknown Owner" }with a real property data API integration using Attom Data Solutions, enabling actual property snapshot and change detection.
deliverables:
- Attom API client for property search, owner info, and tax/assessment data
- Property snapshot creation and storage in database
- Change detection pipeline wired to real data (your detector logic already works)
- Alert generation for ownership changes, liens, and tax status changes
steps:
- Sign up for Attom Data API at https://attomdata.com (pricing: ~$0.05–$0.10/record, enterprise plans available)
- Add
ATTOM_API_KEYto.env.exampleand validate inenv.ts - Create
hometitle/attom.client.ts:searchProperty(address)— find property by address, return parcel ID and metadatagetPropertyProfile(parcelId)— full property record: owner, deed date, tax info, liensgetPropertyHistory(parcelId)— historical ownership and transaction recordsgetTaxInfo(parcelId)— tax amount, delinquency status, exemptions
- Replace
fetchCountyRecords()inscanner.tswith Attom API call:- Use geocoding result (Google Maps API, already works) to get normalized address
- Query Attom by address → get parcel ID → fetch full property profile
- Parse response into
CountyRecord/SnapshotDataschema
- Implement snapshot storage:
- Store initial snapshot in
propertySnapshotstable - On re-scan, fetch new snapshot → compare with last → detect changes
- Store initial snapshot in
- Wire change detection (your
change.detector.tsis already implemented):ownership_transfer: owner name changed → critical alertlien_filing: lien count increased → warning/critical alerttax_change: tax amount changed → info alertdeed_change: deed date changed → critical alert
- Implement tier limits:
- Guard: 1 property monitored
- Fortress: 3 properties monitored
- Family: 5 properties monitored
- Add cost tracking: ~$0.05–$0.10 per property lookup, track per-user usage
tests:
- Unit: Mock Attom API responses, verify parsing and snapshot creation
- Integration: Test with real Attom API using known property address
- E2E: Add property to watchlist → trigger scan → verify snapshot created → simulate change → verify alert
acceptance_criteria:
fetchCountyRecords()makes real HTTP request to Attom API (not returning mock data)- Property snapshots contain real owner name, deed date, tax amount, lien count
- Change detection compares real snapshots and identifies actual changes
- Ownership transfer creates critical alert with property address in message
- Lien filing creates warning or critical alert depending on lien amount
- Alert severity matches existing
severityForChange()logic - Geocoding → Attom search → snapshot pipeline works end-to-end
- Cost tracking records each Attom API call for billing analytics
- Tier limits enforced: Guard = 1 property, Fortress = 3, Family = 5
- Graceful fallback: if Attom API fails, retry once, then alert user of monitoring gap
validation:
- Run
vitest run hometitle.test.ts— all tests pass with real Attom mock - Manual: Add real property address, trigger scan, verify snapshot in database
- Simulate change: Update snapshot in database with different owner, trigger detector, verify alert
- Check cost: Database shows Attom API usage per user per month
notes:
- Attom covers ~150M US properties but not all counties equally — some rural areas may have gaps
- For counties not covered by Attom, Phase 3 (task 10) implements county recorder web scrapers
- Property fraud is a real and growing problem: FTC reports $1B+ in losses annually
- This is a unique differentiator — no major identity protection competitor offers property monitoring
- Consider partnership with title insurance companies for added credibility
- The existing Google Maps geocoding already works — verify
GEOCODING_API_KEYis set