Skip to content

Commit

Permalink
Elation: non-visit note refactor (#587)
Browse files Browse the repository at this point in the history
* elation_non_visit_note_refactor

* fix(): import

* chore(): error handling

* chore(): test

* chore(): test

* fix(): dont validate twice
  • Loading branch information
nckhell authored Feb 13, 2025
1 parent b5f6129 commit d4629ac
Show file tree
Hide file tree
Showing 11 changed files with 305 additions and 233 deletions.
73 changes: 0 additions & 73 deletions extensions/elation/actions/__tests__/createNonVisitNote.ts

This file was deleted.

155 changes: 0 additions & 155 deletions extensions/elation/actions/createNonVisitNote.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { type AxiosResponse } from 'axios'
import { type NonVisitNoteResponse } from 'extensions/elation/types'
import { type DeepPartial } from '../../../../../src/lib/types'

export const CreateNonVisitNoteMock = {
status: 200,
statusText: 'OK',
data: {
id: 1,
type: 'nonvisit',
bullets: [
{
id: 1,
author: 1,
category: 'Problem',
text: 'Test',
updated_date: '2023-01-01T00:00:00Z',
version: 2,
},
],
patient: 1,
practice: 1,
chart_date: '2023-01-01T00:00:00Z',
document_date: '2023-01-01T00:00:00Z',
tags: [],
},
} satisfies DeepPartial<AxiosResponse<NonVisitNoteResponse>>
12 changes: 12 additions & 0 deletions extensions/elation/actions/createNonVisitNote/config/dataPoints.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { type DataPointDefinition } from '@awell-health/extensions-core'

export const dataPoints = {
nonVisitNoteId: {
key: 'nonVisitNoteId',
valueType: 'number',
},
nonVisitNoteBulletId: {
key: 'nonVisitNoteBulletId',
valueType: 'number',
},
} satisfies Record<string, DataPointDefinition>
61 changes: 61 additions & 0 deletions extensions/elation/actions/createNonVisitNote/config/fields.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import {
type Field,
FieldType,
NumericIdSchema,
} from '@awell-health/extensions-core'
import z, { type ZodTypeAny } from 'zod'

export const fields = {
patientId: {
id: 'patientId',
label: 'Patient ID',
description: '',
type: FieldType.NUMERIC,
required: true,
},
// Practice ID is not required so leaving it out for simplicity
// practiceId: {
// id: 'practiceId',
// label: 'Practice',
// description: 'ID of a Practice',
// type: FieldType.NUMERIC,
// required: false,
// },
authorId: {
id: 'authorId',
label: 'Author',
description: 'The author of a note. Should be the ID of a User in Elation.',
type: FieldType.NUMERIC,
required: true,
},
category: {
id: 'category',
label: 'Category',
description:
'The Category of a note, defaults to "Problem". Read the extension documentation for the list of possible values.',
type: FieldType.STRING,
required: false,
},
tags: {
id: 'tags',
label: 'Tags',
description: 'Comma-separated list of tags IDs',
type: FieldType.STRING,
required: false,
},
text: {
id: 'text',
label: 'Text',
description: 'Text of a note',
type: FieldType.TEXT,
required: true,
},
} satisfies Record<string, Field>

export const FieldsValidationSchema = z.object({
patientId: NumericIdSchema,
authorId: NumericIdSchema,
tags: z.string().optional(),
category: z.string().optional(),
text: z.string(),
} satisfies Record<keyof typeof fields, ZodTypeAny>)
2 changes: 2 additions & 0 deletions extensions/elation/actions/createNonVisitNote/config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { fields, FieldsValidationSchema } from './fields'
export { dataPoints } from './dataPoints'
Loading

0 comments on commit d4629ac

Please sign in to comment.