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

New schemas #23

Merged
merged 8 commits into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 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 All @@ -39,10 +38,6 @@ module.exports = {
'@typescript-eslint/no-inferrable-types': ['error', { ignoreParameters: true }],
'@typescript-eslint/no-empty-function': ['error', { allow: ['arrowFunctions'] }],
'import/extensions': 'off',
'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }],
'react/jsx-one-expression-per-line': 'off',
'react/jsx-wrap-multilines': 'off',
'react/jsx-props-no-spreading': 'off',
'arrow-body-style': ['warn', 'as-needed'],
'no-param-reassign': ['error', { props: false }],
'import/prefer-default-export': 'off',
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"test": "echo \"Error: no test specified\" && exit 0",
"build": "tsc",
"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 @@ -43,7 +45,9 @@
"cz-conventional-changelog": "^3.0.2",
"dateformat": "~3.0.3",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-prettier": "^3.1.2",
"husky": "~4.2.0",
"pouchdb": "^7.1.1",
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>