WHA Docs

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

DataDirectionNotes
Provider profilesDoctor.com → WordPressName, bio, education, certifications, memberships, awards, languages, photo
Provider taxonomiesDoctor.com → WordPressSpecialties, locations, roles, languages — mapped to WP taxonomy terms
Location dataDoctor.com → WordPressOffice 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, FullBiobio, 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

DataNotes
Overall ratingAggregate score (e.g., 4.8) and total response count
Question scoresIndividual satisfaction question ratings
Patient commentsWritten 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:

ThresholdDefaultPurpose
Minimum responses25Provider needs at least this many survey responses
Minimum rating3.5Overall rating must be at or above this value
Minimum comments5Provider 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:

SettingEnv var fallbackPurpose
App IDPRESSGANEY_APP_IDAPI authentication
App SecretPRESSGANEY_APP_SECRETAPI authentication
Ratings daysHow far back to query (default: 540 days)
Comments daysHow far back to pull comments (default: 360 days)

Troubleshooting

ProblemCheck
Provider data not updatingIs auto-sync enabled? Check Settings → Doctor.com Sync. Try a manual sync.
Ratings not showing for a providerDoes 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 listingThe listing uses transient caching. Wait a few minutes or flush transients.
Stale data after manual syncFlush the object cache and transients. See Caching.

On this page