-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Elation: non-visit note refactor (#587)
* elation_non_visit_note_refactor * fix(): import * chore(): error handling * chore(): test * chore(): test * fix(): dont validate twice
- Loading branch information
Showing
11 changed files
with
305 additions
and
233 deletions.
There are no files selected for viewing
73 changes: 0 additions & 73 deletions
73
extensions/elation/actions/__tests__/createNonVisitNote.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
extensions/elation/actions/createNonVisitNote/__testdata__/CreateNonVisitNote.mock.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
12
extensions/elation/actions/createNonVisitNote/config/dataPoints.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
61
extensions/elation/actions/createNonVisitNote/config/fields.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
2
extensions/elation/actions/createNonVisitNote/config/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { fields, FieldsValidationSchema } from './fields' | ||
export { dataPoints } from './dataPoints' |
Oops, something went wrong.