Data Sync
How provider profiles, locations, and patient ratings sync automatically from external sources.
The site pulls data from two external sources — Doctor.com for provider/location profiles, and PressGaney for patient satisfaction ratings. Both sync automatically on a schedule and can be triggered manually from wp-admin.
Doctor.com Sync
What It Syncs
| Data | Direction | Notes |
|---|---|---|
| Provider profiles | Doctor.com → WordPress | Name, bio, education, certifications, memberships, awards, languages, photo |
| Provider taxonomies | Doctor.com → WordPress | Specialties, locations, roles, languages — mapped to WP taxonomy terms |
| Location data | Doctor.com → WordPress | Office names, addresses, contact info |
The sync uses a field mapping system (FieldMap.php) to translate Doctor.com's API response into WordPress post meta and ACF fields. Each Doctor.com field maps to a specific WordPress field — FirstName → title, FullBio → bio, Education → structured repeater, etc.
How It Runs
Automatic (WP-Cron):
Sync runs on a configurable schedule, defaulting to every 12 hours. Settings are in wp-admin at Settings → Doctor.com Sync:
- Providers auto-sync — enable/disable + interval (every 6 hours, every 12 hours, daily, weekly)
- Locations auto-sync — enable/disable + interval (same options)
Scheduled syncs run at 2:00 AM local time.
Manual:
- Single provider/location — Click "Sync" next to any provider or location in the Doctor.com admin pages
- Batch sync — Click "Sync All" to sync every provider or location
Circuit Breaker
The sync has built-in protection against API failures. If more than 50% of a batch fails, the consecutive failure counter increments. After 3 consecutive batch failures, auto-sync pauses automatically and an admin notice appears in wp-admin.
To resume: click "Resume sync" in the admin notice, or go to Settings → Doctor.com Sync.
All sync operations are logged via the audit log plugin — synced, failed, batch start/complete, paused, resumed.
Matching Providers
The sync matches Doctor.com providers to WordPress posts using doctorcom_id and doctorcom_type post meta. When a Doctor.com provider doesn't match an existing post, the sync creates a new one. When it does match, it updates the existing post.
PressGaney Ratings Sync
What It Syncs
| Data | Notes |
|---|---|
| Overall rating | Aggregate score (e.g., 4.8) and total response count |
| Question scores | Individual satisfaction question ratings |
| Patient comments | Written feedback from patients |
Ratings are fetched using the provider's NPI (National Provider Identifier). Providers without an NPI are skipped during sync.
How It Runs
Automatic (WP-Cron):
Configurable in wp-admin at Provider Ratings → Settings. Schedule options: disabled, daily, twice daily, weekly. When enabled, the bulk sync runs through all providers with NPIs.
Manual:
- Single provider — Sync button on the provider ratings admin page
- Bulk sync — Syncs all providers in sequence
Display Thresholds
Not all providers show ratings on the site. The settings page defines minimum thresholds:
| Threshold | Default | Purpose |
|---|---|---|
| Minimum responses | 25 | Provider needs at least this many survey responses |
| Minimum rating | 3.5 | Overall rating must be at or above this value |
| Minimum comments | 5 | Provider needs at least this many written comments |
The wha_should_display_ratings() function checks these thresholds before rendering. If a provider doesn't meet all three, their ratings section is hidden — no stars, no comments, no indication that ratings exist.
API Configuration
PressGaney API credentials are stored in wp-admin settings or via environment variables:
| Setting | Env var fallback | Purpose |
|---|---|---|
| App ID | PRESSGANEY_APP_ID | API authentication |
| App Secret | PRESSGANEY_APP_SECRET | API authentication |
| Ratings days | — | How far back to query (default: 540 days) |
| Comments days | — | How far back to pull comments (default: 360 days) |
Troubleshooting
| Problem | Check |
|---|---|
| Provider data not updating | Is auto-sync enabled? Check Settings → Doctor.com Sync. Try a manual sync. |
| Ratings not showing for a provider | Does the provider have an NPI? Do they meet all three display thresholds? |
| Sync paused (admin notice) | Circuit breaker tripped — check the Doctor.com API status, then resume sync |
| New provider not appearing on listing | The listing uses transient caching. Wait a few minutes or flush transients. |
| Stale data after manual sync | Flush the object cache and transients. See Caching. |