Skip to content

Commit

Permalink
Create a new "lab order signed" timer in the elation extension (#577)
Browse files Browse the repository at this point in the history
* chore: bump extensions core to latest version

* feat(elation): create new experimental lab order signed timer
  • Loading branch information
ebomcke-awell authored Feb 4, 2025
1 parent cd0ba46 commit f98b609
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 14 deletions.
16 changes: 8 additions & 8 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions extensions/elation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { type Extension } from '@awell-health/extensions-core'
import { settings } from './settings'
import { AuthorType, Category } from '@awell-health/extensions-core'
import { webhooks } from './webhooks'
import { timers } from './timers'

export const Elation: Extension = {
key: 'elation',
Expand All @@ -21,4 +22,5 @@ export const Elation: Extension = {
identifier: {
system: 'https://www.elationhealth.com/',
},
timers,
}
3 changes: 3 additions & 0 deletions extensions/elation/timers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { labOrderSigned } from './labOrderSigned'

export const timers = [labOrderSigned]
28 changes: 28 additions & 0 deletions extensions/elation/timers/labOrderSigned.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { type Timer } from '@awell-health/extensions-core'
import { isNil } from 'lodash'
import { type ElationWebhookPayload } from './types'

export const labOrderSigned: Timer = {
type: 'resource_updated',
key: 'lab_order.signed',
action_key: 'createLabOrder',
description: 'Wait for lab order to be signed',
resource_id: {
type: 'extension_data_point',
key: 'labOrderId',
},
evaluate: (input: unknown) => {
const payload = input as ElationWebhookPayload
const { data: labOrder, action } = payload
return (
action === 'saved' &&
payload.resource === 'lab_orders' &&
!isNil(labOrder.signed_by) &&
!isNil(labOrder.signed_date)
)
},
extractResourceId: (input: unknown) => {
const payload = input as ElationWebhookPayload
return payload.data.id
},
}
5 changes: 5 additions & 0 deletions extensions/elation/timers/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface ElationWebhookPayload {
action: string
data: { id: string; patient?: number } & Record<string, unknown>
resource: string
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
},
"dependencies": {
"@awell-health/awell-sdk": "^0.1.20",
"@awell-health/extensions-core": "1.0.17",
"@awell-health/extensions-core": "1.0.18",
"@awell-health/healthie-sdk": "^0.1.1",
"@dropbox/sign": "^1.8.0",
"@hubspot/api-client": "^11.2.0",
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ __metadata:
resolution: "@awell-health/awell-extensions@workspace:."
dependencies:
"@awell-health/awell-sdk": "npm:^0.1.20"
"@awell-health/extensions-core": "npm:1.0.17"
"@awell-health/extensions-core": "npm:1.0.18"
"@awell-health/healthie-sdk": "npm:^0.1.1"
"@dropbox/sign": "npm:^1.8.0"
"@faker-js/faker": "npm:^8.0.2"
Expand Down Expand Up @@ -193,9 +193,9 @@ __metadata:
languageName: node
linkType: hard

"@awell-health/extensions-core@npm:1.0.17":
version: 1.0.17
resolution: "@awell-health/extensions-core@npm:1.0.17"
"@awell-health/extensions-core@npm:1.0.18":
version: 1.0.18
resolution: "@awell-health/extensions-core@npm:1.0.18"
dependencies:
"@types/json-schema": "npm:^7.0.15"
axios: "npm:^1.7.4"
Expand All @@ -206,7 +206,7 @@ __metadata:
zod-validation-error: "npm:^3.2.0"
peerDependencies:
"@awell-health/awell-sdk": "*"
checksum: 10/6395df02c0c425cd8e219b407ca28c94205b0658ec49b975306b9216af23dcb02a78e0cb3ce8d839afca9c5fa870e0388108f73e2fd3a71382010355903cc53c
checksum: 10/f65aaf1c891b828d92cdf89d9fb2d61c00862d5ed3ef57c836d41039a845834e535bf39462c7e3fea870beb5d9f93c38709c16b639aad2971ad3d8287b6d22e0
languageName: node
linkType: hard

Expand Down

0 comments on commit f98b609

Please sign in to comment.