@awell-health/awell-extensions 2.1.152 → 2.1.154

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -160,8 +160,8 @@
160
160
  "changelog": "# MessageBird changelog"
161
161
  },
162
162
  "metriport": {
163
- "readme": "---\ntitle: Metriport\ndescription: Metriport is Plaid for healthcare data.\n---\n# Metriport\n\nMetriport is Plaid for healthcare data. We help digital health companies access and manage patient health and medical data, through an open-source and universal API.\n\nThrough a single integration, our API enables modern health companies to get the comprehensive patient data they need from both HIEs and EHRs, as well as popular wearable devices.\n\nAs a developer-first interoperability solution, Metriport is powering the next wave of innovative companies, accelerating a revolution in digital health.\n\nTo learn more visit [https://www.metriport.com/](https://www.metriport.com/)\n# Extension settings\n\nIn order to set up this extension, **you will need to provide a Metriport API key**. You can obtain an API key via the Metriport dashboard by selecting the `Developers tab`. To learn more on how to get started with Metriport visit our [quick start docs](https://docs.metriport.com/medical-api/getting-started/quickstart) for our Medical API. Also, to better understand how our API keys work check out the [API Keys section](https://docs.metriport.com/home/api-info/api-keys) of our docs as well.\n\n# Custom Actions\n\n**GENERAL NOTE: Make sure to create Organizations and Facilities in Metriport before using this extension. A Patient must be associated with a Facility by providing the facilityId when stated in the actions.**\n\n## Create Patient\n\nCreates a Patient in Metriport for the specified Facility where the Patient is receiving care.\n\nOptionally, providing a **Cohort** ID enrolls the Patient in real-time monitoring by adding them to that cohort. Note that enrolling a Patient in real-time monitoring has downstream consequences: once you start receiving updates about the Patient, you are expected to contribute data back to Metriport.\n\nVisit [endpoint docs](https://docs.metriport.com/medical-api/api-reference/patient/create-patient) for more info.\n\n## Update Patient\n\nUpdates the specified Patient.\n\nVisit [endpoint docs](https://docs.metriport.com/medical-api/api-reference/patient/update-patient) for more info.\n\n## Get Patient\n\nRetrieves the specified Patient.\n\nVisit [endpoint docs](https://docs.metriport.com/medical-api/api-reference/patient/get-patient) for more info.\n\n## Remove Patient\n\nRemoves a Patient at Metriport and at HIEs the Patient is linked to.\n\nVisit [endpoint docs](https://docs.metriport.com/medical-api/api-reference/patient/delete-patient) for more info.\n\n## List Documents\n\nLists all Documents that can be retrieved for a Patient.\n\nVisit [endpoint docs](https://docs.metriport.com/medical-api/api-reference/document/list-documents) for more info.\n\n**NOTE: It also returns the status of querying Document references across HIEs, indicating whether there is an asynchronous query in progress (status processing) or not (status completed). If the query is in progress, you will also receive the total number of Documents to be queried as well as the ones that have already been completed.**\n\n## Query Documents\n\nTriggers a Document query for the specified Patient across HIEs.\n\nVisit [endpoint docs](https://docs.metriport.com/medical-api/api-reference/document/start-document-query) for more info.\n\n**NOTE: When executed, this endpoint triggers an asynchronous Document query with HIEs and immediately returns the status of Document query, processing .**\n\n## Get Document Url\n\nGets a presigned URL for downloading the specified Document.\n\nVisit [endpoint docs](https://docs.metriport.com/medical-api/api-reference/document/get-document) for more info.\n\n**NOTE: This endpoint returns a URL which you can use to download the specified Document using the file name provided from the List Documents endpoint.**\n\n## Remove Patient from Cohort\n\nRemoves the specified Patient from a cohort.\n\nVisit [endpoint docs](https://docs.metriport.com/medical-api/api-reference/cohort/remove-patients-from-cohort) for more info.\n\n## Get Webhook Bundle\n\nFetches the FHIR bundle from a Metriport webhook payload URL — e.g. the [Encounter Bundle](https://docs.metriport.com/medical-api/handling-data/patient-encounter-bundle) from an ADT notification, or a discharge summary. Pass the `bundleUrl` data point emitted by the **Enrollment** webhook; the action downloads the bundle and returns it on the `bundle` data point.\n\nWhen the payload is a Patient Encounter Bundle, the action also rewrites it into an executable FHIR transaction and returns that on the `transactionBundle` data point, ready to hand to the Medplum **Find or create resource** action.\n\n**NOTE: Metriport pre-signed URLs are only valid for 10 minutes, so this action should run early in the care flow, shortly after the enrollment webhook fires.**\n\n| Field | Type | Description |\n| --- | --- | --- |\n| `url` | string | The pre-signed payload URL to fetch (the webhook's `bundleUrl` data point). |\n| `eventType` | string (optional) | The Metriport notification type — wire this from the enrollment webhook's `eventType` data point. Recorded on the import Provenance so admit, transfer and discharge can be told apart. |\n| `provenanceReason` | text (optional) | Free-text reason recorded on the import Provenance, describing why the data was imported. |\n\n| Data point | Type | Description |\n| --- | --- | --- |\n| `bundle` | json | The FHIR bundle fetched from the URL, exactly as Metriport sent it. |\n| `transactionBundle` | json | The same data rewritten as an executable FHIR transaction. Omitted when the payload is not a Patient Encounter Bundle. |\n\n### Building the transaction bundle\n\nMetriport delivers a bundle of `type: 'collection'`, which is **not executable**. Handing it straight to Medplum does nothing useful: no entry carries `request` metadata saying what to do with it, and every internal reference points at a Metriport UUID that means nothing in Medplum. The action therefore builds a second, executable bundle rather than passing the original through.\n\nThe transformation is a pure function with no Medplum access of its own — this extension holds Metriport credentials only. That rules out reading Medplum to reconcile against what is already there, so every lookup is expressed declaratively and resolved by the server when the transaction executes.\n\n**The Patient is never written.** Awell/Medplum is the source of truth for patient demographics, so the Patient entry is dropped entirely and every reference to it becomes a conditional reference:\n\n```\nPatient?identifier=https://awellhealth.com/patients|<awell patient id>\n```\n\nOmitting the entry guarantees structurally that a Metriport ADT feed can never overwrite the patient record.\n\n**Everything else is written idempotently.** Each Metriport resource is stamped with an identifier derived from its Metriport id and written with a conditional update:\n\n```\nidentifier: { system: 'https://metriport.com/fhir/encounter', value: '<metriport id>' }\nrequest: PUT Encounter?identifier=https://metriport.com/fhir/encounter|<metriport id>\n```\n\nA conditional update creates on zero matches and updates on one, so a redelivered notification updates in place instead of duplicating Conditions, Observations, Practitioners and Locations — and the admit and discharge notifications for one visit converge on a single Encounter. Existing identifiers are kept, so the Encounter keeps its HL7 `VN` visit number alongside ours.\n\n**References are rewritten to Metriport's own `fullUrl`s.** Metriport resolves its relationships correctly, but emits them in a form FHIR cannot match: entries carry `urn:uuid:` fullUrls while references to them are relative.\n\n```\nfullUrl: urn:uuid:3ca5e8d2-7c84-45ab-91e7-834f8becde12\nreference: Location/3ca5e8d2-7c84-45ab-91e7-834f8becde12\n```\n\nA transaction resolves an internal reference by matching it against `fullUrl` verbatim, and a relative reference does not match a `urn:uuid:` one — Medplum would read it as a reference to a *Medplum* Location with that id, which does not exist. Rewriting the reference to the entry's `fullUrl` closes the gap while keeping Metriport's identity. This is also why the result is a `transaction` and not a `batch`: `urn:uuid` resolution is a transaction feature.\n\n**`meta` is stripped from every resource.** Medplum's `meta.accounts` is inherited from the compartment of the Patient a resource references, but specifying `meta` at all on a create or update replaces those inherited accounts instead of adding to them. Metriport's Encounter arrives with a `meta`, so it is removed. `resource.id` is dropped too, for a separate reason: Medplum assigns identity, and the entry's `fullUrl` already carries the local identity the transaction needs.\n\n**Two entries are synthesised.** An `Organization` named *Metriport Realtime Monitoring*, created with `ifNoneExist` so an existing one is reused rather than overwritten; and a `Provenance` recording the import — what it created, when, which Metriport bundle it came from, and which ADT event triggered it (`patient.admit` → `A01`, `patient.transfer` → `A02`, `patient.discharge` → `A03`).\n\n`extensions/metriport/actions/webhookBundle/bundle/transform.test.ts` asserts the complete output for a real `patient.admit` bundle, if you want to see the whole before/after in one place.\n\n### Wiring it into a care flow\n\n1. **Enrollment** webhook fires and emits `bundleUrl` and `eventType`.\n2. **Get Webhook Bundle** — pass `bundleUrl` to `url` and `eventType` to `eventType`. Run this early; the URL expires after 10 minutes.\n3. Medplum **Find or create resource** — pass the `transactionBundle` data point to its `resourceJson` field. No changes to that action are needed; it detects a Bundle and executes it.\n\n**PREREQUISITE: for imported resources to be tagged with the Metriport organization, the Medplum Patient must already carry it in `meta.accounts` before the notification arrives.** Resources created without a `meta` inherit their accounts from the compartment of the Patient they reference, so tagging the Patient once causes every subsequent import to inherit it automatically. Note that this only covers resources *in* the patient compartment — `Location` and `Practitioner` are shared directory resources and are intentionally created untagged, since scoping a hospital or a physician to one patient's tenant would be wrong.\n\n**NOTE: the conditional Patient reference only resolves if your Medplum Patients carry an identifier under the `https://awellhealth.com/patients` system with the Awell patient id as its value. A conditional reference that matches no Patient fails the whole transaction.**\n\n### When the transaction bundle is omitted\n\n`Get Webhook Bundle` serves several Metriport webhook types and only ADT notifications carry encounter bundles. For any payload that is not a `collection` bundle, `transactionBundle` is simply omitted and `bundle` is emitted on its own — the action still succeeds.\n\nA `collection` bundle that is missing its Patient or Encounter entry is treated differently: that is an encounter bundle which does not describe an encounter, so the action **fails** rather than silently emitting a partial result.\n\n# Webhooks\n\n## Enrollment\n\nAn enrollment trigger that starts a care flow when Metriport sends a [real-time patient notification](https://docs.metriport.com/medical-api/handling-data/realtime-patient-notifications).\n\nMetriport POSTs every notification type to the same endpoint, so this webhook discriminates on the notification `type` and only enrolls on two events. The `eventType` data point carries the raw Metriport webhook type:\n\n- `patient.admit` (HL7 ADT^A01) → `eventType` = `patient.admit`. The payload carries a pre-signed URL to the [FHIR Encounter Bundle](https://docs.metriport.com/medical-api/handling-data/patient-encounter-bundle).\n- `medical.discharge-summary` → `eventType` = `medical.discharge-summary`. This event is currently undocumented by Metriport and is modelled on the published `medical.*` webhook family (a `patients` array).\n\nThe webhook validates the request, emits the data points (including the pre-signed bundle URL on `bundleUrl`), and replies immediately — it does **not** download the bundle. Fetch the bundle later in the care flow with the **Get Webhook Bundle** action, using the `bundleUrl` data point. Because the URL expires after 10 minutes, run that action early.\n\nUse the `eventType` data point in your care flow to branch on admit vs discharge. Every other notification type (`patient.discharge`, `patient.transfer`, ...) is acknowledged with a `200` but does not enroll a patient. Metriport [verification `ping` messages](https://docs.metriport.com/medical-api/getting-started/webhooks#the-ping-message) are answered with a `200` that echoes the ping value back as `pong: <value>`.\n\n### Data points\n\n| Data point | Type | Description |\n| --- | --- | --- |\n| `eventType` | string | The Metriport webhook type: `patient.admit` or `medical.discharge-summary` |\n| `metriportPatientId` | string | The Metriport patient ID (also used as the patient identifier for enrollment) |\n| `externalId` | string | Your external patient ID, if provided to Metriport |\n| `admitTimestamp` | date | When the patient was admitted (admit events only) |\n| `whenSourceSent` | date | When the source sent the notification, if available (admit events) |\n| `messageId` | string | The Metriport message ID for the notification |\n| `bundleUrl` | string | Pre-signed URL to the FHIR bundle; fetch it with the **Get Webhook Bundle** action (valid for 10 minutes) |\n\n### Verifying incoming requests\n\nOptionally set the **Webhook Key** setting to the webhook key from the Metriport dashboard (Settings/Developers tab). Metriport [authenticates each webhook](https://docs.metriport.com/medical-api/getting-started/webhooks#authentication) with an HMAC-SHA256 signature of the raw request body, keyed with your webhook key and sent in the `x-metriport-signature` header. When the setting is populated, the webhook recomputes the HMAC over the raw body and rejects any request whose signature is missing or does not match (`401`). When left empty, requests are not verified.\n\n## More Info\n\nFor more information on how to integrate with Metriport please visit our [Medical API docs](https://docs.metriport.com/medical-api/getting-started/quickstart)\n",
164
- "changelog": "# Metriport changelog\n\n## July 2026\n\n- Add `enrollment` webhook: an enrollment trigger for Metriport real-time patient notifications. The `eventType` data point carries the Metriport webhook type (`patient.admit` or `medical.discharge-summary`) so care flows can distinguish on it. The webhook validates and replies immediately, emitting the pre-signed FHIR bundle URL on the `bundleUrl` data point rather than downloading the bundle inline.\n- Add `Get Webhook Bundle` action: fetches the FHIR bundle from a Metriport webhook payload URL (the webhook's `bundleUrl`), for use later in the care flow.\n- Add optional `Webhook Key` setting used to verify incoming webhook requests via Metriport's HMAC-SHA256 signature (`x-metriport-signature` header), computed over the raw request body."
163
+ "readme": "---\ntitle: Metriport\ndescription: Metriport is Plaid for healthcare data.\n---\n# Metriport\n\nMetriport is Plaid for healthcare data. We help digital health companies access and manage patient health and medical data, through an open-source and universal API.\n\nThrough a single integration, our API enables modern health companies to get the comprehensive patient data they need from both HIEs and EHRs, as well as popular wearable devices.\n\nAs a developer-first interoperability solution, Metriport is powering the next wave of innovative companies, accelerating a revolution in digital health.\n\nTo learn more visit [https://www.metriport.com/](https://www.metriport.com/)\n# Extension settings\n\nIn order to set up this extension, **you will need to provide a Metriport API key**. You can obtain an API key via the Metriport dashboard by selecting the `Developers tab`. To learn more on how to get started with Metriport visit our [quick start docs](https://docs.metriport.com/medical-api/getting-started/quickstart) for our Medical API. Also, to better understand how our API keys work check out the [API Keys section](https://docs.metriport.com/home/api-info/api-keys) of our docs as well.\n\n# Custom Actions\n\n**GENERAL NOTE: Make sure to create Organizations and Facilities in Metriport before using this extension. A Patient must be associated with a Facility by providing the facilityId when stated in the actions.**\n\n## Create Patient\n\nCreates a Patient in Metriport for the specified Facility where the Patient is receiving care.\n\nOptionally, providing a **Cohort** ID enrolls the Patient in real-time monitoring by adding them to that cohort. Note that enrolling a Patient in real-time monitoring has downstream consequences: once you start receiving updates about the Patient, you are expected to contribute data back to Metriport.\n\nVisit [endpoint docs](https://docs.metriport.com/medical-api/api-reference/patient/create-patient) for more info.\n\n## Update Patient\n\nUpdates the specified Patient.\n\nVisit [endpoint docs](https://docs.metriport.com/medical-api/api-reference/patient/update-patient) for more info.\n\n## Get Patient\n\nRetrieves the specified Patient.\n\nVisit [endpoint docs](https://docs.metriport.com/medical-api/api-reference/patient/get-patient) for more info.\n\n## Remove Patient\n\nRemoves a Patient at Metriport and at HIEs the Patient is linked to.\n\nVisit [endpoint docs](https://docs.metriport.com/medical-api/api-reference/patient/delete-patient) for more info.\n\n## List Documents\n\nLists all Documents that can be retrieved for a Patient.\n\nVisit [endpoint docs](https://docs.metriport.com/medical-api/api-reference/document/list-documents) for more info.\n\n**NOTE: It also returns the status of querying Document references across HIEs, indicating whether there is an asynchronous query in progress (status processing) or not (status completed). If the query is in progress, you will also receive the total number of Documents to be queried as well as the ones that have already been completed.**\n\n## Query Documents\n\nTriggers a Document query for the specified Patient across HIEs.\n\nVisit [endpoint docs](https://docs.metriport.com/medical-api/api-reference/document/start-document-query) for more info.\n\n**NOTE: When executed, this endpoint triggers an asynchronous Document query with HIEs and immediately returns the status of Document query, processing .**\n\n## Get Document Url\n\nGets a presigned URL for downloading the specified Document.\n\nVisit [endpoint docs](https://docs.metriport.com/medical-api/api-reference/document/get-document) for more info.\n\n**NOTE: This endpoint returns a URL which you can use to download the specified Document using the file name provided from the List Documents endpoint.**\n\n## Remove Patient from Cohort\n\nRemoves the specified Patient from a cohort.\n\nVisit [endpoint docs](https://docs.metriport.com/medical-api/api-reference/cohort/remove-patients-from-cohort) for more info.\n\n## Get Webhook Bundle\n\nFetches the FHIR bundle from a Metriport webhook payload URL — e.g. the [Encounter Bundle](https://docs.metriport.com/medical-api/handling-data/patient-encounter-bundle) from an ADT notification, or a discharge summary. Pass the `bundleUrl` data point emitted by the **Realtime Update** webhook; the action downloads the bundle and returns it on the `bundle` data point.\n\nWhen the payload is a Patient Encounter Bundle, the action also rewrites it into an executable FHIR transaction and returns that on the `transactionBundle` data point, ready to hand to the Medplum **Find or create resource** action.\n\n**NOTE: Metriport pre-signed URLs are only valid for 10 minutes, so this action should run early in the care flow, shortly after the realtime update webhook fires.**\n\n| Field | Type | Description |\n| --- | --- | --- |\n| `url` | string | The pre-signed payload URL to fetch (the webhook's `bundleUrl` data point). |\n| `eventType` | string (optional) | The Metriport notification type — wire this from the realtime update webhook's `eventType` data point. Recorded on the import Provenance so admit, transfer and discharge can be told apart. |\n| `provenanceReason` | text (optional) | Free-text reason recorded on the import Provenance, describing why the data was imported. |\n\n| Data point | Type | Description |\n| --- | --- | --- |\n| `bundle` | json | The FHIR bundle fetched from the URL, exactly as Metriport sent it. |\n| `transactionBundle` | json | The same data rewritten as an executable FHIR transaction. Omitted when the payload is not a Patient Encounter Bundle. |\n\n### Building the transaction bundle\n\nMetriport delivers a bundle of `type: 'collection'`, which is **not executable**. Handing it straight to Medplum does nothing useful: no entry carries `request` metadata saying what to do with it, and every internal reference points at a Metriport UUID that means nothing in Medplum. The action therefore builds a second, executable bundle rather than passing the original through.\n\nThe transformation is a pure function with no Medplum access of its own — this extension holds Metriport credentials only. That rules out reading Medplum to reconcile against what is already there, so every lookup is expressed declaratively and resolved by the server when the transaction executes.\n\n**The Patient is never written.** Awell/Medplum is the source of truth for patient demographics, so the Patient entry is dropped entirely and every reference to it becomes a conditional reference:\n\n```\nPatient?identifier=https://awellhealth.com/patients|<awell patient id>\n```\n\nOmitting the entry guarantees structurally that a Metriport ADT feed can never overwrite the patient record.\n\n**Everything else is written idempotently.** Each Metriport resource is stamped with an identifier derived from its Metriport id and written with a conditional update:\n\n```\nidentifier: { system: 'https://metriport.com/fhir/encounter', value: '<metriport id>' }\nrequest: PUT Encounter?identifier=https://metriport.com/fhir/encounter|<metriport id>\n```\n\nA conditional update creates on zero matches and updates on one, so a redelivered notification updates in place instead of duplicating Conditions, Observations, Practitioners and Locations — and the admit and discharge notifications for one visit converge on a single Encounter. Existing identifiers are kept, so the Encounter keeps its HL7 `VN` visit number alongside ours.\n\n**References are rewritten to Metriport's own `fullUrl`s.** Metriport resolves its relationships correctly, but emits them in a form FHIR cannot match: entries carry `urn:uuid:` fullUrls while references to them are relative.\n\n```\nfullUrl: urn:uuid:3ca5e8d2-7c84-45ab-91e7-834f8becde12\nreference: Location/3ca5e8d2-7c84-45ab-91e7-834f8becde12\n```\n\nA transaction resolves an internal reference by matching it against `fullUrl` verbatim, and a relative reference does not match a `urn:uuid:` one — Medplum would read it as a reference to a *Medplum* Location with that id, which does not exist. Rewriting the reference to the entry's `fullUrl` closes the gap while keeping Metriport's identity. This is also why the result is a `transaction` and not a `batch`: `urn:uuid` resolution is a transaction feature.\n\n**`meta` is stripped from every resource.** Medplum's `meta.accounts` is inherited from the compartment of the Patient a resource references, but specifying `meta` at all on a create or update replaces those inherited accounts instead of adding to them. Metriport's Encounter arrives with a `meta`, so it is removed. `resource.id` is dropped too, for a separate reason: Medplum assigns identity, and the entry's `fullUrl` already carries the local identity the transaction needs.\n\n**Two entries are synthesised.** An `Organization` named *Metriport Realtime Monitoring*, created with `ifNoneExist` so an existing one is reused rather than overwritten; and a `Provenance` recording the import — what it created, when, which Metriport bundle it came from, and which ADT event triggered it (`patient.admit` → `A01`, `patient.transfer` → `A02`, `patient.discharge` → `A03`).\n\n`extensions/metriport/actions/webhookBundle/bundle/transform.test.ts` asserts the complete output for a real `patient.admit` bundle, if you want to see the whole before/after in one place.\n\n### Wiring it into a care flow\n\n1. **Realtime Update** webhook fires and emits `bundleUrl` and `eventType`.\n2. **Get Webhook Bundle** — pass `bundleUrl` to `url` and `eventType` to `eventType`. Run this early; the URL expires after 10 minutes.\n3. Medplum **Find or create resource** — pass the `transactionBundle` data point to its `resourceJson` field. No changes to that action are needed; it detects a Bundle and executes it.\n\n**PREREQUISITE: for imported resources to be tagged with the Metriport organization, the Medplum Patient must already carry it in `meta.accounts` before the notification arrives.** Resources created without a `meta` inherit their accounts from the compartment of the Patient they reference, so tagging the Patient once causes every subsequent import to inherit it automatically. Note that this only covers resources *in* the patient compartment — `Location` and `Practitioner` are shared directory resources and are intentionally created untagged, since scoping a hospital or a physician to one patient's tenant would be wrong.\n\n**NOTE: the conditional Patient reference only resolves if your Medplum Patients carry an identifier under the `https://awellhealth.com/patients` system with the Awell patient id as its value. A conditional reference that matches no Patient fails the whole transaction.**\n\n### When the transaction bundle is omitted\n\n`Get Webhook Bundle` serves several Metriport webhook types and only ADT notifications carry encounter bundles. For any payload that is not a `collection` bundle, `transactionBundle` is simply omitted and `bundle` is emitted on its own — the action still succeeds.\n\nA `collection` bundle that is missing its Patient or Encounter entry is treated differently: that is an encounter bundle which does not describe an encounter, so the action **fails** rather than silently emitting a partial result.\n\n# Webhooks\n\n## Realtime Update\n\nAn enrollment trigger that starts a care flow when Metriport sends a [real-time patient notification](https://docs.metriport.com/medical-api/handling-data/realtime-patient-notifications).\n\nMetriport POSTs every notification type to the same endpoint, so this webhook discriminates on the notification `type` and only enrolls on two events. The `eventType` data point carries the raw Metriport webhook type:\n\n- `patient.admit` (HL7 ADT^A01) → `eventType` = `patient.admit`. The payload carries a pre-signed URL to the [FHIR Encounter Bundle](https://docs.metriport.com/medical-api/handling-data/patient-encounter-bundle).\n- `medical.discharge-summary` → `eventType` = `medical.discharge-summary`. This event is currently undocumented by Metriport and is modelled on the published `medical.*` webhook family (a `patients` array).\n\nThe webhook validates the request, emits the data points (including the pre-signed bundle URL on `bundleUrl`), and replies immediately — it does **not** download the bundle. Fetch the bundle later in the care flow with the **Get Webhook Bundle** action, using the `bundleUrl` data point. Because the URL expires after 10 minutes, run that action early.\n\nUse the `eventType` data point in your care flow to branch on admit vs discharge. Every other notification type (`patient.discharge`, `patient.transfer`, ...) is acknowledged with a `200` but does not enroll a patient. Metriport [verification `ping` messages](https://docs.metriport.com/medical-api/getting-started/webhooks#the-ping-message) are answered with a `200` that echoes the ping value back as `pong: <value>`.\n\n### Data points\n\n| Data point | Type | Description |\n| --- | --- | --- |\n| `eventType` | string | The Metriport webhook type: `patient.admit` or `medical.discharge-summary` |\n| `metriportPatientId` | string | The Metriport patient ID (also used as the patient identifier for enrollment) |\n| `externalId` | string | Your external patient ID, if provided to Metriport |\n| `admitTimestamp` | date | When the patient was admitted (admit events only) |\n| `whenSourceSent` | date | When the source sent the notification, if available (admit events) |\n| `messageId` | string | The Metriport message ID for the notification |\n| `bundleUrl` | string | Pre-signed URL to the FHIR bundle; fetch it with the **Get Webhook Bundle** action (valid for 10 minutes) |\n\n### Verifying incoming requests\n\nOptionally set the **Webhook Key** setting to the webhook key from the Metriport dashboard (Settings/Developers tab). Metriport [authenticates each webhook](https://docs.metriport.com/medical-api/getting-started/webhooks#authentication) with an HMAC-SHA256 signature of the raw request body, keyed with your webhook key and sent in the `x-metriport-signature` header. When the setting is populated, the webhook recomputes the HMAC over the raw body and rejects any request whose signature is missing or does not match (`401`). When left empty, requests are not verified.\n\n## More Info\n\nFor more information on how to integrate with Metriport please visit our [Medical API docs](https://docs.metriport.com/medical-api/getting-started/quickstart)\n",
164
+ "changelog": "# Metriport changelog\n\n## August 2026\n\n- Rename the `enrollment` webhook to `realtimeUpdate`. The old name described what Awell does with the notification rather than what Metriport sends, which read confusingly next to the genuine enrolment concepts (the `Cohort` field, enrolling a patient into a care flow). Behaviour is unchanged. **Breaking: the webhook endpoint URL changes, so any webhook already configured in the Metriport dashboard must be repointed.**\n- `Date of Birth` on the `Create Patient` and `Update Patient` actions is now a date field rather than a free-text string, so care flows can map a date onto it directly instead of hand-formatting `YYYY-MM-DD`. The value is normalised to the date-only string Metriport expects, so care flows already passing `YYYY-MM-DD` are unaffected.\n\n## July 2026\n\n- Add `enrollment` webhook: an enrollment trigger for Metriport real-time patient notifications. The `eventType` data point carries the Metriport webhook type (`patient.admit` or `medical.discharge-summary`) so care flows can distinguish on it. The webhook validates and replies immediately, emitting the pre-signed FHIR bundle URL on the `bundleUrl` data point rather than downloading the bundle inline.\n- Add `Get Webhook Bundle` action: fetches the FHIR bundle from a Metriport webhook payload URL (the webhook's `bundleUrl`), for use later in the care flow.\n- Add optional `Webhook Key` setting used to verify incoming webhook requests via Metriport's HMAC-SHA256 signature (`x-metriport-signature` header), computed over the raw request body."
165
165
  },
166
166
  "nexuzhealth": {
167
167
  "readme": "---\ntitle: nexuzhealth\ndescription: Demo extension for nexuzhealth\n---\n\nThis is an extension that can only be used for demo purposes.",
@@ -122,7 +122,7 @@ export declare const actions: {
122
122
  id: string;
123
123
  label: string;
124
124
  description: string;
125
- type: import("@awell-health/extensions-core").FieldType.STRING;
125
+ type: import("@awell-health/extensions-core").FieldType.DATE;
126
126
  required: true;
127
127
  };
128
128
  genderAtBirth: {
@@ -259,7 +259,7 @@ export declare const actions: {
259
259
  id: string;
260
260
  label: string;
261
261
  description: string;
262
- type: import("@awell-health/extensions-core").FieldType.STRING;
262
+ type: import("@awell-health/extensions-core").FieldType.DATE;
263
263
  required: true;
264
264
  };
265
265
  genderAtBirth: {
@@ -84,7 +84,7 @@ export declare const createFields: {
84
84
  id: string;
85
85
  label: string;
86
86
  description: string;
87
- type: FieldType.STRING;
87
+ type: FieldType.DATE;
88
88
  required: true;
89
89
  };
90
90
  genderAtBirth: {
@@ -192,7 +192,7 @@ export declare const updateFields: {
192
192
  id: string;
193
193
  label: string;
194
194
  description: string;
195
- type: FieldType.STRING;
195
+ type: FieldType.DATE;
196
196
  required: true;
197
197
  };
198
198
  genderAtBirth: {
@@ -28,8 +28,8 @@ exports.createFields = {
28
28
  dob: {
29
29
  id: 'dob',
30
30
  label: 'Date of Birth',
31
- description: `The Patient's date of birth (DOB), formatted YYYY-MM-DD`,
32
- type: extensions_core_1.FieldType.STRING,
31
+ description: `The Patient's date of birth (DOB)`,
32
+ type: extensions_core_1.FieldType.DATE,
33
33
  required: true,
34
34
  },
35
35
  genderAtBirth: {
@@ -1 +1 @@
1
- {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../extensions/metriport/actions/patient/fields.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,gDAA6C;AAEhC,QAAA,YAAY,GAAG;IAC1B,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,iDAAiD;QAC9D,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,0BAA0B;QACvC,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,QAAQ,EAAE;QACR,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,yBAAyB;QACtC,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,GAAG,EAAE;QACH,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,yDAAyD;QACtE,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,aAAa,EAAE;QACb,EAAE,EAAE,eAAe;QACnB,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,+FAA+F;QAC5G,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,mBAAmB,EAAE;QACnB,EAAE,EAAE,qBAAqB;QACzB,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EAAE,uCAAuC;QACpD,IAAI,EAAE,2BAAS,CAAC,MAAM;KACvB;IACD,mB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AAE,OAAO;QACX,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,2DAA2D;QACxE,IAAI,EAAE,2BAAS,CAAC,MAAM;KACvB;IACD,KAAK,EAAE;QACL,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,6BAA6B;QAC1C,IAAI,EAAE,2BAAS,CAAC,MAAM;KACvB;IACD,MAAM,EAAE;QACN,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,QAAQ;QACf,WAAW,EAAE,+EAA+E;QAC5F,IAAI,EAAE,2BAAS,CAAC,MAAM;KACvB;CAC8B,CAAA;AAEpB,QAAA,YAAY,GAAG;IAC1B,EAAE,EAAE;QACF,EAAE,EAAE,IAAI;QACR,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,iCAAiC;QAC9C,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,GAAG,oBAAY;CACgB,CAAA;AAEpB,QAAA,SAAS,GAAG;IACvB,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,gBAAgB;QAC7B,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;CAC8B,CAAA;AAEpB,QAAA,YAAY,GAAG;IAC1B,GAAG,iBAAS;IACZ,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,iBAAiB;QAC9B,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;CACF,CAAA"}
@@ -3,7 +3,12 @@ export declare const genderAtBirthTransformSchema: z.ZodEffects<z.ZodEnum<["F",
3
3
  export declare const patientCreateSchema: z.ZodObject<{
4
4
  firstName: z.ZodString;
5
5
  lastName: z.ZodString;
6
- dob: z.ZodString;
6
+ /**
7
+ * Metriport expects a date-only string (YYYY-MM-DD). `DateOnlySchema`
8
+ * normalises whatever the DATE field hands over — a plain `1940-08-29` or a
9
+ * full ISO timestamp — down to the date part.
10
+ */
11
+ dob: z.ZodEffects<z.ZodDate, string, Date>;
7
12
  genderAtBirth: z.ZodEffects<z.ZodEnum<["F", "M", "O", "U"]>, "M" | "F" | "O" | "U", unknown>;
8
13
  addressLine1: z.ZodString;
9
14
  addressLine2: z.ZodOptional<z.ZodString>;
@@ -87,7 +92,7 @@ export declare const patientCreateSchema: z.ZodObject<{
87
92
  }, {
88
93
  firstName: string;
89
94
  lastName: string;
90
- dob: string;
95
+ dob: Date;
91
96
  city: string;
92
97
  zip: string;
93
98
  addressLine1: string;
@@ -107,7 +112,12 @@ export declare const patientUpdateSchema: z.ZodObject<{
107
112
  } & {
108
113
  firstName: z.ZodString;
109
114
  lastName: z.ZodString;
110
- dob: z.ZodString;
115
+ /**
116
+ * Metriport expects a date-only string (YYYY-MM-DD). `DateOnlySchema`
117
+ * normalises whatever the DATE field hands over — a plain `1940-08-29` or a
118
+ * full ISO timestamp — down to the date part.
119
+ */
120
+ dob: z.ZodEffects<z.ZodDate, string, Date>;
111
121
  genderAtBirth: z.ZodEffects<z.ZodEnum<["F", "M", "O", "U"]>, "M" | "F" | "O" | "U", unknown>;
112
122
  addressLine1: z.ZodString;
113
123
  addressLine2: z.ZodOptional<z.ZodString>;
@@ -192,7 +202,7 @@ export declare const patientUpdateSchema: z.ZodObject<{
192
202
  }, {
193
203
  firstName: string;
194
204
  lastName: string;
195
- dob: string;
205
+ dob: Date;
196
206
  id: string;
197
207
  city: string;
198
208
  zip: string;
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.patientUpdateSchema = exports.patientCreateSchema = exports.genderAtBirthTransformSchema = void 0;
37
37
  const z = __importStar(require("zod"));
38
+ const extensions_core_1 = require("@awell-health/extensions-core");
38
39
  const emailValidation_1 = require("../../../../src/utils/emailValidation");
39
40
  const api_sdk_1 = require("@metriport/api-sdk");
40
41
  /**
@@ -64,7 +65,12 @@ exports.genderAtBirthTransformSchema = z.preprocess((value) => {
64
65
  exports.patientCreateSchema = z.object({
65
66
  firstName: z.string().min(1),
66
67
  lastName: z.string().min(1),
67
- dob: z.string().length(10),
68
+ /**
69
+ * Metriport expects a date-only string (YYYY-MM-DD). `DateOnlySchema`
70
+ * normalises whatever the DATE field hands over — a plain `1940-08-29` or a
71
+ * full ISO timestamp — down to the date part.
72
+ */
73
+ dob: extensions_core_1.DateOnlySchema,
68
74
  genderAtBirth: exports.genderAtBirthTransformSchema,
69
75
  addressLine1: z.string().min(1),
70
76
  addressLine2: z.string().optional(),
@@ -1 +1 @@
1
- {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../../../extensions/metriport/actions/patient/validation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,2EAA2E;AAC3E,gDAG2B;AAE3B;;;;;;GAMG;AACH,MAAM,oBAAoB,GAGtB;IACF,CAAC,EAAE,GAAG;IACN,IAAI,EAAE,GAAG;IACT,CAAC,EAAE,GAAG;IACN,MAAM,EAAE,GAAG;IACX,CAAC,EAAE,GAAG;IACN,KAAK,EAAE,GAAG;IACV,CAAC,EAAE,GAAG;IACN,OAAO,EAAE,GAAG;IACZ,SAAS,EAAE,GAAG;CACf,CAAA;AAEY,QAAA,4BAA4B,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,EAAE;;IACjE,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAE3C,OAAO,MAAA,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,mCAAI,KAAK,CAAA;AAClE,CAAC,EAAE,6BAAmB,CAAC,CAAA;AAEV,QAAA,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC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,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1C,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,KAAK,EAAE,qCAAmB;IAC1B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAA;AAIW,QAAA,mBAAmB,GAAG,CAAC;KACjC,MAAM,CAAC;IACN,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACtB,CAAC;KACD,KAAK,CAAC,2BAAmB,CAAC,CAAA"}
@@ -7,14 +7,14 @@ exports.fields = {
7
7
  url: {
8
8
  id: 'url',
9
9
  label: 'Bundle URL',
10
- description: 'The pre-signed Metriport payload URL to fetch the FHIR bundle from. This is the `bundleUrl` data point emitted by the enrollment webhook. Note: Metriport pre-signed URLs are only valid for 10 minutes, so this action should run shortly after the webhook fires.',
10
+ description: 'The pre-signed Metriport payload URL to fetch the FHIR bundle from. This is the `bundleUrl` data point emitted by the realtime update webhook. Note: Metriport pre-signed URLs are only valid for 10 minutes, so this action should run shortly after the webhook fires.',
11
11
  type: extensions_core_1.FieldType.STRING,
12
12
  required: true,
13
13
  },
14
14
  eventType: {
15
15
  id: 'eventType',
16
16
  label: 'Event Type',
17
- description: 'The Metriport notification type, as emitted on the enrollment webhook `eventType` data point. Recorded on the Provenance of the importable bundle so admission, transfer and discharge imports can be told apart. Leave empty to omit it.',
17
+ description: 'The Metriport notification type, as emitted on the realtime update webhook `eventType` data point. Recorded on the Provenance of the importable bundle so admission, transfer and discharge imports can be told apart. Leave empty to omit it.',
18
18
  type: extensions_core_1.FieldType.STRING,
19
19
  required: false,
20
20
  options: {
@@ -1 +1 @@
1
- {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../extensions/metriport/actions/webhookBundle/fields.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,gDAA2D;AAE9C,QAAA,MAAM,GAAG;IACpB,GAAG,EAAE;QACH,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,YAAY;QACnB,WAAW,EACT,qQAAqQ;QACvQ,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,YAAY;QACnB,WAAW,EACT,2OAA2O;QAC7O,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE;YACP,eAAe,EAAE;gBACf;oBACE,KAAK,EAAE,2BAA2B;oBAClC,KAAK,EAAE,4BAAoB,CAAC,YAAY;iBACzC;gBACD;oBACE,KAAK,EAAE,6BAA6B;oBACpC,KAAK,EAAE,4BAAoB,CAAC,eAAe;iBAC5C;gBACD;oBACE,KAAK,EAAE,+BAA+B;oBACtC,KAAK,EAAE,4BAAoB,CAAC,gBAAgB;iBAC7C;aACF;SACF;KACF;IACD,gBAAgB,EAAE;QAChB,EAAE,EAAE,kBAAkB;QACtB,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EACT,8LAA8L;QAChM,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,KAAK;KAChB;CAC8B,CAAA"}
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../extensions/metriport/actions/webhookBundle/fields.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,gDAA2D;AAE9C,QAAA,MAAM,GAAG;IACpB,GAAG,EAAE;QACH,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,YAAY;QACnB,WAAW,EACT,0QAA0Q;QAC5Q,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,YAAY;QACnB,WAAW,EACT,gPAAgP;QAClP,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE;YACP,eAAe,EAAE;gBACf;oBACE,KAAK,EAAE,2BAA2B;oBAClC,KAAK,EAAE,4BAAoB,CAAC,YAAY;iBACzC;gBACD;oBACE,KAAK,EAAE,6BAA6B;oBACpC,KAAK,EAAE,4BAAoB,CAAC,eAAe;iBAC5C;gBACD;oBACE,KAAK,EAAE,+BAA+B;oBACtC,KAAK,EAAE,4BAAoB,CAAC,gBAAgB;iBAC7C;aACF;SACF;KACF;IACD,gBAAgB,EAAE;QAChB,EAAE,EAAE,kBAAkB;QACtB,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EACT,8LAA8L;QAChM,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,KAAK;KAChB;CAC8B,CAAA"}
@@ -12,7 +12,7 @@ exports.getWebhookBundle = {
12
12
  key: 'getWebhookBundle',
13
13
  category: extensions_core_1.Category.EHR_INTEGRATIONS,
14
14
  title: 'Get Webhook Bundle',
15
- description: 'Fetches the FHIR bundle from a Metriport webhook payload URL (e.g. the Encounter Bundle from an ADT notification, or a discharge summary). The URL is provided by the enrollment webhook on the `bundleUrl` data point and is only valid for 10 minutes.',
15
+ description: 'Fetches the FHIR bundle from a Metriport webhook payload URL (e.g. the Encounter Bundle from an ADT notification, or a discharge summary). The URL is provided by the realtime update webhook on the `bundleUrl` data point and is only valid for 10 minutes.',
16
16
  fields: fields_1.fields,
17
17
  previewable: true,
18
18
  supports_automated_retries: true,
@@ -1 +1 @@
1
- {"version":3,"file":"getWebhookBundle.js","sourceRoot":"","sources":["../../../../../extensions/metriport/actions/webhookBundle/getWebhookBundle.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AAErE,4DAA8D;AAC9D,qCAAiC;AACjC,6CAAqD;AACrD,6CAAyC;AACzC,+CAA2C;AAC3C,qCAAiD;AAEpC,QAAA,gBAAgB,GAIzB;IACF,GAAG,EAAE,kBAAkB;IACvB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,oBAAoB;IAC3B,WAAW,EACT,0PAA0P;IAC5P,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,IAAI;IACjB,0BAA0B,EAAE,IAAI;IAChC,UAAU,EAAV,uBAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAiB,EAAE;QACvE,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,mCAAsB,CAAC,KAAK,CACvE,OAAO,CAAC,MAAM,CACf,CAAA;YAED,MAAM,MAAM,GAAG,MAAM,IAAA,yBAAW,EAAC,GAAG,CAAC,CAAA;YAErC,wEAAwE;YACxE,wEAAwE;YACxE,wEAAwE;YACxE,yEAAyE;YACzE,sEAAsE;YACtE,MAAM,iBAAiB,GAAG,IAAA,+BAAsB,EAAC;gBAC/C,MAAM;gBACN,cAAc,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE;gBAClC,SAAS;gBACT,MAAM,EAAE,gBAAgB;aACzB,CAAC,CAAA;YAEF,MAAM,UAAU,CAAC;gBACf,WAAW,EAAE;oBACX,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;oBAC9B,GAAG,CAAC,iBAAiB,KAAK,SAAS;wBACjC,CAAC,CAAC,EAAE,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE;wBAC1D,CAAC,CAAC,EAAE,CAAC;iBACR;aACF,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAA,iCAAkB,EAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QACxC,CAAC;IACH,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"getWebhookBundle.js","sourceRoot":"","sources":["../../../../../extensions/metriport/actions/webhookBundle/getW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iCAAkB,EAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QACxC,CAAC;IACH,CAAC;CACF,CAAA"}
@@ -1,5 +1,5 @@
1
- export type { Enrollment } from './enrollment';
2
- export declare const webhooks: import("@awell-health/extensions-core").Webhook<"eventType" | "messageId" | "externalId" | "admitTimestamp" | "whenSourceSent" | "metriportPatientId" | "bundleUrl", import("./types").MetriportEnrollmentWebhookPayload, {
1
+ export type { RealtimeUpdate } from './realtimeUpdate';
2
+ export declare const webhooks: import("@awell-health/extensions-core").Webhook<"eventType" | "messageId" | "externalId" | "admitTimestamp" | "whenSourceSent" | "metriportPatientId" | "bundleUrl", import("./types").MetriportRealtimeUpdateWebhookPayload, {
3
3
  apiKey: {
4
4
  key: string;
5
5
  label: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.webhooks = void 0;
4
- const enrollment_1 = require("./enrollment");
5
- exports.webhooks = [enrollment_1.enrollment];
4
+ const realtimeUpdate_1 = require("./realtimeUpdate");
5
+ exports.webhooks = [realtimeUpdate_1.realtimeUpdate];
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/metriport/webhooks/index.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAG5B,QAAA,QAAQ,GAAG,CAAC,uBAAU,CAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/metriport/webhooks/index.ts"],"names":[],"mappings":";;;AAAA,qDAAiD;AAGpC,QAAA,QAAQ,GAAG,CAAC,+BAAc,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { type Webhook } from '@awell-health/extensions-core';
2
2
  import { type settings } from '../settings';
3
- import { type MetriportEnrollmentWebhookPayload } from './types';
3
+ import { type MetriportRealtimeUpdateWebhookPayload } from './types';
4
4
  /**
5
5
  * The identifier system used to enroll a patient based on their Metriport
6
6
  * patient ID.
@@ -36,6 +36,6 @@ declare const dataPoints: {
36
36
  valueType: "string";
37
37
  };
38
38
  };
39
- export declare const enrollment: Webhook<keyof typeof dataPoints, MetriportEnrollmentWebhookPayload, typeof settings>;
40
- export type Enrollment = typeof enrollment;
39
+ export declare const realtimeUpdate: Webhook<keyof typeof dataPoints, MetriportRealtimeUpdateWebhookPayload, typeof settings>;
40
+ export type RealtimeUpdate = typeof realtimeUpdate;
41
41
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.enrollment = exports.METRIPORT_PATIENT_IDENTIFIER_SYSTEM = void 0;
3
+ exports.realtimeUpdate = exports.METRIPORT_PATIENT_IDENTIFIER_SYSTEM = void 0;
4
4
  const lodash_1 = require("lodash");
5
5
  const zod_1 = require("zod");
6
6
  const zod_validation_error_1 = require("zod-validation-error");
@@ -45,9 +45,9 @@ const dataPoints = {
45
45
  };
46
46
  const isAdmit = (webhook) => webhook.meta.type === types_1.MetriportWebhookType.PatientAdmit;
47
47
  const isDischargeSummary = (webhook) => webhook.meta.type === types_1.MetriportWebhookType.DischargeSummary;
48
- exports.enrollment = {
49
- key: 'enrollment',
50
- description: 'Enrolls a patient when Metriport sends a real-time notification. The `eventType` data point carries the Metriport webhook type (`patient.admit` or `medical.discharge-summary`) so it can be distinguished on. The FHIR bundle is not fetched here — the pre-signed URL is passed on the `bundleUrl` data point and can be retrieved later with the "Get Webhook Bundle" action.',
48
+ exports.realtimeUpdate = {
49
+ key: 'realtimeUpdate',
50
+ description: 'Starts a care flow when Metriport sends a real-time patient notification. The `eventType` data point carries the Metriport webhook type (`patient.admit` or `medical.discharge-summary`) so it can be distinguished on. The FHIR bundle is not fetched here — the pre-signed URL is passed on the `bundleUrl` data point and can be retrieved later with the "Get Webhook Bundle" action.',
51
51
  dataPoints,
52
52
  onEvent: async ({ payload: { payload, rawBody, headers, settings, endpoint }, onSuccess, onError, helpers: { rateLimiter }, }) => {
53
53
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
@@ -193,4 +193,4 @@ exports.enrollment = {
193
193
  }
194
194
  },
195
195
  };
196
- //# sourceMappingURL=enrollment.js.map
196
+ //# sourceMappingURL=realtimeUpdate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realtimeUpdate.js","sourceRoot":"","sources":["../../../../extensions/metriport/webhooks/realtimeUpdate.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAC9B,6BAA8B;AAC9B,+DAAmD;AAKnD,0CAIoB;AACpB,6EAA6E;AAC7E,mCAGgB;AAChB,qDAAkF;AAElF;;;GAGG;AACU,QAAA,mCAAmC,GAC9C,oCAAoC,CAAA;AAEtC,MAAM,UAAU,GAAG;IACjB,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,QAAQ;KACpB;IACD,kBAAkB,EAAE;QAClB,GAAG,EAAE,oBAAoB;QACzB,SAAS,EAAE,QAAQ;KACpB;IACD,UAAU,EAAE;QACV,GAAG,EAAE,YAAY;QACjB,SAAS,EAAE,QAAQ;KACpB;IACD,cAAc,EAAE;QACd,GAAG,EAAE,gBAAgB;QACrB,SAAS,EAAE,MAAM;KAClB;IACD,cAAc,EAAE;QACd,GAAG,EAAE,gBAAgB;QACrB,SAAS,EAAE,MAAM;KAClB;IACD,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,QAAQ;KACpB;IACD,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAa/C,MAAM,OAAO,GAAG,CAAC,OAA6B,EAA2B,EAAE,CACzE,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,4BAAoB,CAAC,YAAY,CAAA;AAEzD,MAAM,kBAAkB,GAAG,CACzB,OAA6B,EACO,EAAE,CACtC,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,4BAAoB,CAAC,gBAAgB,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C,OAAO,EAAE,CAAC;oBACb,MAAM,OAAO,CAAC;wBACZ,QAAQ,EAAE;4BACR,UAAU,EAAE,GAAG;4BACf,OAAO,EAAE,kCAAkC,WAAW,kBAAkB,GAAG,uEAAuE,SAAS,yDAAyD,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,GAAG,mCAAI,QAAQ,GAAG;yBACjP;qBACF,CAAC,CAAA;oBACF,OAAM;gBACR,CAAC;YACH,CAAC;YAED,MAAM,SAAS,CAAC;gBACd,WAAW;gBACX,kBAAkB,EAAE;oBAClB,MAAM,EAAE,2CAAmC;oBAC3C,KAAK,EAAE,SAAS;iBACjB;aACF,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GACX,KAAK,YAAY,cAAQ;gBACvB,CAAC,CAAC,IAAA,mCAAY,EAAC,KAAK,CAAC,CAAC,OAAO;gBAC7B,CAAC,CAAE,KAAe,CAAC,OAAO,CAAA;YAC9B,MAAM,OAAO,CAAC;gBACZ,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;wBAC9B,IAAI,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE;wBACrB,KAAK,EAAE;4BACL,QAAQ,EACN,KAAK,YAAY,cAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc;4BAC5D,OAAO;yBACR;qBACF;iBACF;aACF,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF,CAAA"}
@@ -96,11 +96,11 @@ export interface MetriportPingWebhook {
96
96
  ping: string;
97
97
  }
98
98
  /**
99
- * The union of all payloads that can be received on the enrollment webhook
99
+ * The union of all payloads that can be received on the realtime update webhook
100
100
  * endpoint. Metriport POSTs every notification type to the same URL, so the
101
101
  * handler must discriminate on `meta.type`.
102
102
  */
103
- export type MetriportEnrollmentWebhookPayload = MetriportPatientAdmitWebhook | MetriportPatientDischargeWebhook | MetriportPatientTransferWebhook | MetriportDischargeSummaryWebhook | MetriportPingWebhook;
103
+ export type MetriportRealtimeUpdateWebhookPayload = MetriportPatientAdmitWebhook | MetriportPatientDischargeWebhook | MetriportPatientTransferWebhook | MetriportDischargeSummaryWebhook | MetriportPingWebhook;
104
104
  /**
105
105
  * The FHIR Encounter Bundle referenced by an ADT notification `url`.
106
106
  * https://docs.metriport.com/medical-api/handling-data/patient-encounter-bundle
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/awell-extensions",
3
- "version": "2.1.152",
3
+ "version": "2.1.154",
4
4
  "packageManager": "yarn@4.5.3",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"enrollment.js","sourceRoot":"","sources":["../../../../extensions/metriport/webhooks/enrollment.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAC9B,6BAA8B;AAC9B,+DAAmD;AAKnD,0CAIoB;AACpB,6EAA6E;AAC7E,mCAGgB;AAChB,qDAAkF;AAElF;;;GAGG;AACU,QAAA,mCAAmC,GAC9C,oCAAoC,CAAA;AAEtC,MAAM,UAAU,GAAG;IACjB,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,QAAQ;KACpB;IACD,kBAAkB,EAAE;QAClB,GAAG,EAAE,oBAAoB;QACzB,SAAS,EAAE,QAAQ;KACpB;IACD,UAAU,EAAE;QACV,GAAG,EAAE,YAAY;QACjB,SAAS,EAAE,QAAQ;KACpB;IACD,cAAc,EAAE;QACd,GAAG,EAAE,gBAAgB;QACrB,SAAS,EAAE,MAAM;KAClB;IACD,cAAc,EAAE;QACd,GAAG,EAAE,gBAAgB;QACrB,SAAS,EAAE,MAAM;KAClB;IACD,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,QAAQ;KACpB;IACD,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,QAAQ;KAC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