Sync encounter data via function call with token refresh
Recipe ToolsDeveloper ToolAPI Integration
What it does
When someone makes a function call, this automation retrieves encounter data from a healthcare system and searches a lookup table for matching codes. If an authorization error occurs, it regenerates the access token and retries the retrieval.
Who it's for
Engineering teams who integrate healthcare data and need reliable token refresh on authentication failures.
How teams use this
Sync encounters with automatic token refresh
Retrieve encounter records and automatically regenerate the access token if authorization fails, then retry without manual intervention. The lookup table enriches codes in one pass.
Enrich encounters with standard code mappings
Search the Code Systems lookup table to map encounter codes to standard terminologies. Add custom code mappings to the table so downstream systems receive normalized data for reporting.
Route encounters to error handling on persistent failures
When an encounter sync fails after retry, include the error details in a call to an error handler for logging and alerting. Teams can then review and resolve the root cause.
How it works
- Receive the function call. A real-time function call arrives with encounter identifiers and parameters needed to query the healthcare system.
- Retrieve encounter data via HTTP. Call the healthcare API to fetch encounter records. If an Unauthorized error appears, the automation detects it and calls the access token generator to obtain a fresh token, then retries the retrieval.
- Match codes in the lookup table. Search the Code Systems lookup table in batch mode to find matching encounter codes and enrich the data with standardized values from the table.
- Return the result to the caller. Send the enriched encounter data back to the caller. If errors persisted after retry, return the error details so the caller can investigate the root cause.