Zambdas

Consider a situation where you're building a scheduling application on ZapEHR. You may want an API endpoint that:

  • Creates a new FHIR Patient
  • Creates a new FHIR Appointment
  • Updates the FHIR Slot status to busy
  • Sends the patient an email to confirm their appointment time

Since ZapEHR is your backend, you don't need to run your own server or use a cloud provider to configure this endpoint. ZapEHR Zambdas are functions that can be used to execute your code. By using Zambdas, developers have the flexibility to customize and extend ZapEHR's functionality to meet their requirements.

Zambdas are built on top of AWS Lambda and currently support NodeJS v20. Refer to the AWS Lambda FAQ (opens in a new tab) for more information.

Types of Zambdas

ZapEHR supports four kinds of Zambdas: public, authenticated, subscription, and scheduled.

  • Public Zambdas are for Zambdas that don't need authentication — for example, getting a list of available slots on an appointment scheduling application that doesn't require signing in
  • Authenticated Zambdas are for Zambdas that require authentication — for example, an organization that provides tests might send information about a patient's results
  • Subscription Zambdas are for Zambdas that should run automatically based on an event — for example, sending an email to a patient when a FHIR Patient is created that gives the patient login information
  • Scheduled Zambdas are for Zambdas that should run at regular intervals — for example, creating new appointment slots every week on an appointment scheduling application

Secrets

Sometimes you may want to use secrets in your Zambdas. Zapehr has support for Zambda Secrets.

Logs

You can write log messages from your Zambdas using console.log, and review logs with either the get-logs (opens in a new tab) endpoint, or on the Developer Console (opens in a new tab). Use logs to monitor and debug your Zambdas.