Skip to content

Commit

Permalink
fix(metriport): broken and outdated npm package needed updating
Browse files Browse the repository at this point in the history
  • Loading branch information
bejoinka committed Feb 3, 2025
1 parent cee20e6 commit 80b150c
Show file tree
Hide file tree
Showing 24 changed files with 264 additions and 70 deletions.
141 changes: 121 additions & 20 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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
33 changes: 22 additions & 11 deletions extensions/metriport/actions/document/dataPoints.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
import { type DataPointDefinition } from '@awell-health/extensions-core'

export const documentsDataPoints = {
queryStatus: {
key: 'queryStatus',
valueType: 'string',
},
queryProgressTotal: {
key: 'queryProgressTotal',
valueType: 'string',
},
queryProgressComplete: {
key: 'queryProgressComplete',
valueType: 'string',
documents: {
key: 'documents',
valueType: 'json',
},
} satisfies Record<string, DataPointDefinition>

Expand All @@ -21,3 +13,22 @@ export const documentUrlPoints = {
valueType: 'string',
},
} satisfies Record<string, DataPointDefinition>

export const documentQueryDataPoints = {
downloadStatus: {
key: 'downloadStatus',
valueType: 'string',
},
downloadTotal: {
key: 'downloadTotal',
valueType: 'number',
},
downloadSuccessful: {
key: 'downloadSuccessful',
valueType: 'number',
},
requestId: {
key: 'requestId',
valueType: 'string',
},
} satisfies Record<string, DataPointDefinition>
7 changes: 0 additions & 7 deletions extensions/metriport/actions/document/fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ export const listFields = {
type: FieldType.STRING,
required: true,
},
facilityId: {
id: 'facilityId',
label: 'Facility ID',
description: 'The ID of the Facility where the patient is receiving care',
type: FieldType.STRING,
required: true,
},
} satisfies Record<string, Field>

export const getUrlFields = {
Expand Down
8 changes: 3 additions & 5 deletions extensions/metriport/actions/document/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,15 @@ export const listDocuments: Action<
dataPoints,
onActivityCreated: async (payload, onComplete, onError): Promise<void> => {
try {
const { patientId, facilityId } = startQuerySchema.parse(payload.fields)
const { patientId } = startQuerySchema.parse(payload.fields)

const api = createMetriportApi(payload.settings)

const resp = await api.listDocuments(patientId, facilityId)
const resp = await api.listDocuments(patientId)

await onComplete({
data_points: {
queryStatus: resp.queryStatus,
queryProgressTotal: String(resp.queryProgress?.total),
queryProgressComplete: String(resp.queryProgress?.completed),
documents: JSON.stringify(resp.documents),
},
})
} catch (err) {
Expand Down
9 changes: 5 additions & 4 deletions extensions/metriport/actions/document/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { createMetriportApi } from '../../client'
import { handleErrorMessage } from '../../shared/errorHandler'
import { listFields } from './fields'
import { startQuerySchema } from './validation'
import { documentsDataPoints as dataPoints } from './dataPoints'
import { documentQueryDataPoints as dataPoints } from './dataPoints'

export const queryDocs: Action<
typeof listFields,
Expand All @@ -30,9 +30,10 @@ export const queryDocs: Action<

await onComplete({
data_points: {
queryStatus: resp.queryStatus,
queryProgressTotal: String(resp.queryProgress?.total),
queryProgressComplete: String(resp.queryProgress?.completed),
requestId: resp.requestId ?? '',
downloadStatus: resp.download?.status ?? '',
downloadTotal: String(resp.download?.total ?? 0),
downloadSuccessful: String(resp.download?.successful ?? 0),
},
})
} catch (err) {
Expand Down
Loading

0 comments on commit 80b150c

Please sign in to comment.