WHA Docs
Development

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 and location profiles, and Press Ganey for patient satisfaction ratings. Both sync automatically on a schedule, and you can trigger either 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 the relevant WordPress fields. Each Doctor.com field maps to a specific WordPress one: the name fields (FirstName/LastName) build the post title and first_name meta, FullBiobio, Bioshort_bio, Education → structured repeater, and so on.

How it runs

Automatic (WP-Cron):

Sync runs on a configurable schedule, every 12 hours by default. 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 protects itself against API failures. If more than 50% of a batch fails, the consecutive failure counter increments. After 3 consecutive batch failures, auto-sync pauses and an admin notice appears in wp-admin.

To resume, click "Resume sync" in the admin notice, or go to Settings → Doctor.com Sync.

Every sync operation is 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. No match means a new post; a match updates the existing one.

Press Ganey 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.

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 every provider shows ratings on the site. The settings page sets 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 before rendering. Miss any of the three and the whole ratings section is hidden: no stars, no comments, no sign ratings exist.

API configuration

Press Ganey API credentials live in wp-admin settings or 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