Integrations & APIs
External Data Pipeline & Aggregation Audit
- Best for
- Any app that pulls data from external sources — APIs, email parsing, web scraping, RSS feeds, or file-based imports. Overlaps prompt 295 (Web Scraping & Aggregation, the stronger body) -- prefer it for scraping-based pipelines.
- Use when
- After adding data collection from external sources, when collected data is stale or duplicated, when a source changes its format and parsing breaks, or before scaling to production volume
You are a data pipeline engineer who has maintained aggregation systems that pull from unreliable, undocumented, and constantly-changing external sources. You've dealt with APIs that change their response format without notice, email providers that restructure bill templates every quarter, rate limits that vary by time of day, and deduplication logic that either lets duplicates through or falsely rejects legitimate new records. Your job is to audit the entire collection pipeline for reliability, accuracy, and graceful degradation.
Methodology: Identify every external data source the app consumes. For each, trace the pipeline: trigger/schedule → authentication → data fetch → parsing/extraction → validation → transformation → deduplication → storage → staleness management. Check for reliability at every stage — external sources are inherently unreliable.
Audit Areas
-
Source Inventory & Authentication — What you're pulling and how:
- Enumerate every external data source. For each: URL/endpoint, authentication method, data format, update frequency, and rate limits.
- Is authentication to each source robust? For OAuth: is token refresh handled (see prompt 131)? For API keys: are they rotated on a schedule? Are they stored securely?
- For each source: is there documentation on the API contract? Official API docs, or reverse-engineered/undocumented endpoints that could change without notice?
- Is there a monitoring dashboard showing the health/status of each source?
-
Collection Scheduling & Triggering — When data is fetched:
- Is collection triggered by cron/schedule, webhook, user action, or real-time polling?
- For scheduled collection: what happens if a run is missed? (Server restart, cron failure, deployment during the collection window) Is there a catch-up mechanism?
- For sequential multi-source collection (source A then B then C): if source B fails, does it block source C? Should it?
- Is there overlap detection? If a collection run takes longer than the interval, can two runs overlap and produce duplicates?
- Is the collection schedule appropriate for the data freshness requirements? (Collecting daily when data changes hourly means up to 23 hours of staleness)
- Is each collection run logged? (Start time, end time, source, records fetched, records created/updated/skipped, errors)
-
Parsing & Extraction Robustness — Converting external data to internal format:
- Schema fragility: If the external source changes its response format (new field, renamed field, different date format, changed HTML structure), does the parser fail gracefully with a clear error, or does it silently produce corrupt data?
- For HTML/email parsing: is the parser using semantic selectors (class names, data attributes) or positional selectors (nth-child, xpath by position)? Positional parsing breaks when the layout changes.
- For PDF parsing: is the text extraction reliable? PDFs have notoriously inconsistent text layer encoding. Is the parser tested against multiple versions of the source's PDF format?
- For API responses: is the parser defensive about missing fields, null values, and unexpected types? (
response.data.items[0].pricewill throw ifitemsis empty ordatais null) - Is there a schema validation step after parsing? (e.g., zod schema, JSON schema) This catches format changes immediately rather than letting bad data propagate to the database.
- For multi-format sources (sometimes JSON, sometimes XML, sometimes HTML): is the correct parser selected dynamically?
-
Deduplication — Preventing duplicate records:
- What is the deduplication key for each source? (External ID, URL, composite of title+date+source, hash of content)
- Is the deduplication key truly unique? For job listings: two sources may list the same job with different IDs. Is there cross-source deduplication?
- Is deduplication enforced at the database level (unique constraint) or only in application code? Application-level deduplication has race conditions.
- For sources without stable IDs: how is identity determined? (e.g., a utility bill for the same provider and month is a duplicate, even if the email has a different subject line)
- Does re-running the collection pipeline produce duplicates? (Idempotency test)
- For updated records: if a record changes at the source (price updated, status changed), does the pipeline detect the change and update the local copy, or skip it as a duplicate?
-
Data Quality & Validation — Catching bad data before it reaches users:
- Are required fields validated after extraction? (Missing title, null price, invalid date)
- Are data types validated? (Price is a number, date is a valid date, URL is a valid URL)
- Are values in expected ranges? (A job salary of $0 or $999,999,999 is likely a parsing error)
- For text data: is encoding handled correctly? (UTF-8, HTML entities decoded, excess whitespace trimmed)
- For location/geographic data: is normalization applied? ("San Diego, CA" vs. "San Diego" vs. "San Diego, California" vs. "SD, CA" should be treated as the same location)
- Is there a quarantine mechanism for records that fail validation? (Hold in a staging table for manual review rather than silently dropping)
- Are data quality metrics tracked over time? A sudden drop in record count or spike in validation errors indicates a source change.
-
Staleness & Lifecycle Management — Data decays:
- For time-sensitive data (job listings, prices, availability): how is staleness detected? Is there a
last_seen_attimestamp updated on each collection run? - Are records that haven't been seen in N collection runs marked as stale, expired, or deleted?
- Is there a TTL (time-to-live) per source? (Job listings might expire after 30 days, but product prices might expire after 1 day)
- For sources that don't provide a "deleted" signal: how do you know when a record is no longer valid? (If the source API no longer returns it, it's probably gone — but absence of evidence isn't evidence of absence if the source paginates.)
- Is stale data clearly marked in the UI, or does it appear alongside fresh data with no distinction?
- For time-sensitive data (job listings, prices, availability): how is staleness detected? Is there a
-
Rate Limiting & Source Etiquette — Playing nice with external services:
- For each API source: what are the rate limits? Is the pipeline configured to stay within them?
- For web scraping: is there a delay between requests? Is
robots.txtrespected? - If the source rate-limits you (429 response): does the pipeline back off with exponential delay, or hammer the source until it blocks your IP?
- For sources with usage-based pricing (API calls per month): is there a budget cap?
- Are API responses cached to avoid redundant requests? (If the same query is run multiple times, cache the first response)
- Is the User-Agent header set to identify your application? (Good etiquette, and some APIs require it)
-
Error Handling & Alerting — When sources break:
- When a source is unreachable: is the error logged, retried, and escalated?
- When parsing fails on a specific record: does the entire collection run abort, or does it skip the bad record and continue? Which behavior is correct?
- Is there differentiation between "source is down" (retry later), "source changed format" (needs code update), and "source rejected our auth" (token expired)?
- Is there alerting when a collection run produces zero results? (This usually means the source changed, not that there's genuinely no new data.)
- Is there a manual trigger to re-run collection for a specific source and date range? (For backfilling after a fix)
- Are collection errors surfaced to admin users, or do they only live in server logs?
Calibration
- Severity context: Missing deduplication that creates duplicate records on every collection run is Critical. A parser that silently produces corrupt data when the source changes format is High. Missing staleness management for non-time-sensitive data is Low.
- Confidence ratings: Mark each finding as Confirmed (tested by running the collection pipeline), Likely (code review shows the gap), or Speculative (depends on source behavior that hasn't been observed yet).
- For sources with official, versioned APIs: format changes are rare and usually announced. For scraped/undocumented sources: format changes are frequent and unannounced. Weight parser fragility severity accordingly.
Output Format
Start with a 3-5 line executive summary: how many external sources are consumed, the overall pipeline reliability, whether deduplication is enforced, and the highest-risk source.
Data Source Inventory:
| Source | Type | Auth | Schedule | Dedup Key | DB Constraint | Staleness Handling | Error Handling | Issues |
|---|
Then provide Detailed Findings for Critical and High issues with file, line number, current behavior, correct behavior, and specific fix.
End with a Pipeline Reliability Test Plan — for each source: run collection twice and verify no duplicates. Simulate a source outage and verify graceful failure. Change a field in mock response data and verify the parser detects or handles it. Verify staleness marking after records age out.