Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #23 from HospitalRun/new-schemas
Browse files Browse the repository at this point in the history
New schemas
  • Loading branch information
matteovivona committed May 27, 2020
2 parents 3a10a8a + 05deb63 commit de7b34a
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 4 deletions.
5 changes: 2 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ module.exports = {
env: {
browser: true,
es6: true,
'jest/globals': true,
},
extends: [
'airbnb',
'airbnb/base',
'plugin:@typescript-eslint/recommended',
'prettier',
'prettier/@typescript-eslint',
Expand All @@ -28,7 +27,7 @@ module.exports = {
},
},
},
plugins: ['react', '@typescript-eslint', 'prettier', 'jest'],
plugins: ['@typescript-eslint', 'prettier'],
ignorePatterns: ['node_modules/'],
rules: {
'@typescript-eslint/member-delimiter-style': 'off',
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
"lint:fix": "eslint \"src/**/*.{js,jsx,ts,tsx}\" --fix",
"prepare": "npm run build",
"lint": "eslint \"src/**/*.{js,ts}\"",
"lint:fix": "eslint \"src/**/*.{js,ts}\" --fix",
"semantic-release": "semantic-release"
},
"repository": {
Expand Down Expand Up @@ -56,7 +58,7 @@
"pouchdb": "^7.1.1",
"prettier": "^2.0.2",
"semantic-release": "^17.0.4",
"typescript": "^3.7.5"
"typescript": "3.8.3"
},
"husky": {
"hooks": {
Expand Down
20 changes: 20 additions & 0 deletions src/model/appointment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Type, Static } from '@sinclair/typebox'

import { BaseModelSchema } from './base'
import { DateTimeSchema } from './primitives/date-time'
import { PatientTypeSchema } from './elements/patient-type'

export const AppointmentSchema = Type.Intersect([
BaseModelSchema,
Type.Object({
resourceType: Type.Literal('appointment'),
type: PatientTypeSchema,
startDateTime: DateTimeSchema,
endDateTime: DateTimeSchema,
location: Type.String(),
reason: Type.String(),
patientId: Type.String(),
}),
])

export type Patient = Static<typeof AppointmentSchema>
12 changes: 12 additions & 0 deletions src/model/elements/appointment-type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Type, Static } from '@sinclair/typebox'

export const AppointmentTypeSchema = Type.Union([
Type.Literal('checkup'),
Type.Literal('in-patient'),
Type.Literal('emergency'),
Type.Literal('follow up'),
Type.Literal('routine'),
Type.Literal('walk in'),
])

export type PatientType = Static<typeof AppointmentTypeSchema>
21 changes: 21 additions & 0 deletions src/model/incident.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Type, Static } from '@sinclair/typebox'

import { BaseModelSchema } from './base'
import { DateTimeSchema } from './primitives/date-time'

export const IncidentSchema = Type.Intersect([
BaseModelSchema,
Type.Object({
resourceType: Type.Literal('incident'),
reportedBy: Type.String(),
reportedOn: DateTimeSchema,
code: Type.String(),
date: DateTimeSchema,
department: Type.String(),
category: Type.String(),
categoryItem: Type.String(),
description: Type.String(),
}),
])

export type Patient = Static<typeof IncidentSchema>

0 comments on commit de7b34a

Please sign in to comment.